Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get consumption values for Ledvance WiFi plug #129

Closed
AlexMuc2 opened this issue Feb 18, 2023 · 21 comments
Closed

Get consumption values for Ledvance WiFi plug #129

AlexMuc2 opened this issue Feb 18, 2023 · 21 comments

Comments

@AlexMuc2
Copy link

There is one more problem with the Ledvance WiFi plug at least in my Fhem installation on my old raspberry.
Sometimes, when this occurs, the Logfile from fhempy shows an error like this one
2023-02-18 16:25:47,999 - ERROR - fhempy.lib.fhem: FHEM took 7001ms for readingsBeginUpdate($defs{'plug_LedvanceMeter1'});;
Loosing this event occurs even sometimes at night when fhem has all time for it… so something seems blocking something. Normally the event occurs 30 minutes so that the daily count should be 48. but most often, 4-6 events will lost so the cumulated energy count is currently useless. The Ledvanceapp and it’s cloudservice got these events. At least the daily log looks more accurate…

any clues or hints what ICan check on my raspberry what happens (not).

Michael

@fhempy
Copy link
Owner

fhempy commented Feb 18, 2023

Please update fhem and fhempy and check if it happens with the latest version as well.

If you can reproduce the error with the latest version, you can try to use freezemon to identify the root cause:

define myFreezemon freezemon
attr myFreezemon fm_logFile ./log/freeze-%Y%m%d-%H%M%S.log

Freezemon creates a log file with verbose 5 during the freeze which can be analyzed afterwards.

@AlexMuc2
Copy link
Author

Thanks, i will give freezemon a chance.
I‘ve updated everything yesterday before posting here but today some events are lost again.

@fhempy
Copy link
Owner

fhempy commented Feb 18, 2023

As long as you don't get a "NO RESPONSE" error in fhempy log none of the events should get lost.

@fhempy
Copy link
Owner

fhempy commented Feb 18, 2023

So even during a freeze period of 7s or longer (max. 180s) the events are handled.

@AlexMuc2
Copy link
Author

Just checked the log from today: until now there are 5 events lost somewhere. The only shown error was readingsBeginUpdate. The main Fhem Log doesn‘t show any Errors at the times when the event is expected.
I will keep an eye on this

@fhempy
Copy link
Owner

fhempy commented Feb 18, 2023

Did it work sometime before? How do you know that 5 events got lost?

@AlexMuc2
Copy link
Author

No, every day some events are lost. Because most times one event every 30 Minutes occurs it‘s easy to cont the missing ones. If I sum up the energy values and compare them with the log from the App, my sum is always lower than there :-(

@fhempy
Copy link
Owner

fhempy commented Feb 18, 2023

Which DPs do you use to retrieve the used energy?

There is currently an ongoing discussion about handling energy data here:
jasonacox/tinytuya#282

@AlexMuc2
Copy link
Author

The naming as in j0zozzoarutv0nu1 looks fine. Only the last DP isn’t used by the Ledvance plug.
The addElem occurs every 30 minutes and is sent to the „Ledvance cloud“ (confirmed by ledvance support). We need to sum up all sent values ourself in Fhem. So the sum (and it’s daily history) is stored only in the cloud from which the App gets it :-(
That’s why I’ve opens the other issue with loosing some addElem events.

@fhempy
Copy link
Owner

fhempy commented Feb 19, 2023

Hmm... actually I'm not polling the device but just keep the connection active by sending a request every 5s. What happens if you check with tinytuya every 30min? Does it receive the event properly everytime?

@AlexMuc2
Copy link
Author

AlexMuc2 commented Feb 19, 2023

I will check it if i notice that the event seems missing.
[ignore the following]But how is it possible, when the the DP17 gets an update. Simply waiting that the value changes is to simple because it is not impossible that two successive values are the same. How does a device will signal a "real" new value? [end Ignore] Found the answer here: jasonacox/tinytuya#282

@AlexMuc2
Copy link
Author

Fhem still looses events. Even if the LedvanceApp sisn‘t running on any device. Mostly the events lost are between midnight and 8.00 in the morning. But sometimes also at other times.
Only at one time I could check directly after the loss the status with tinyTuya. Looks like there was no new data ad DP 17. or it was the same as the last one (really rare Situation by the recorded values in the log…).
Until now, I don‘t find a working way to retrieve the data from „the cloud“. Does anyone know if the events there (with other devices) have a timestamp)? If yes, I will trying to get access to the cloud the LedvanceApp uses. The have told me, they don‘ t collect data themselves but using the Tuyacloud. So hopefully there is a way to access the Ledvancedata from there.

@fhempy
Copy link
Owner

fhempy commented Feb 21, 2023

Are you sure that fhempy looses events? Could it be that the consumption values in DP 17 follow another logic as mentioned in the tinytuya discussion? I think that fhempy is not loosing events, but the device doesn't send the expected events.

I haven't found a way to get the data from tuya iot cloud.

@fhempy fhempy changed the title Loosing Event addElem sometimes Get consumption values for Ledvance WiFi plug Feb 21, 2023
@AlexMuc2
Copy link
Author

AlexMuc2 commented Feb 21, 2023 via email

@fhempy
Copy link
Owner

fhempy commented Feb 21, 2023

I mean, that fhem is not loosing an event, actually it's not receiving one or tuya has some special implementation how events are triggered.

Have you had one full day where the values were correct? It would be very strange if every day just one value is missing.

@AlexMuc2
Copy link
Author

AlexMuc2 commented Feb 21, 2023 via email

@fhempy
Copy link
Owner

fhempy commented Feb 21, 2023

Btw, the readings are only updated if they are changed. Could it be that the missing value is exactly the same value as the one 30min before?

@AlexMuc2
Copy link
Author

AlexMuc2 commented Feb 21, 2023 via email

@fhempy
Copy link
Owner

fhempy commented Feb 21, 2023

I think I can create a separate reading energy which takes care of the energy consumption of the device. I'm doing a short test with one of my devices and if it works I'm going to release it.

@AlexMuc2
Copy link
Author

Hello Dominik, das ist sicher eine sehr gute Idee.
Unfortunely I've to send my Ledvance Plug back to Amazon. Yerstday evening it has decided to not meterlang correct values. Even After a few ersetz all Corrvalues which showöd applied a missing or Zero. Even the App dosen't show animos correct values... So it is going back and I can't help any longer :-(
Now I'm looking for something better...

@fhempy
Copy link
Owner

fhempy commented Feb 22, 2023

Hi,
I just implemented the energy reading which calculates the energy based on cur_power. Please open a new issue if it doesn't work for you.

@fhempy fhempy closed this as completed Feb 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants