-
Notifications
You must be signed in to change notification settings - Fork 6
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_device_reading sometimes returns all readings instead of single reading #13
Comments
Hello, data = fh.get_device_reading("myWeather", ["fc1_day_of_week", "fc1_code"], value_only=True)
temp_1_code = data["temp_1_code"]
temp_1_wday = data["temp_1_wday"] Your problem is, that the json data coming from FHEM are not well-formed and can not be parsed by python. I assume that this error is in jsonlist2 of FHEM or in telnet transmission. Maybe this could be catched by requesting the data again when a decode error occours @domschl ? Maybe with a parameter that sets how often? To catch this problem for the moment you could also do something like this: # Try 5 times to get correct data
for x in range(5):
data = fh.get_device_reading("myWeather", ["fc1_day_of_week", "fc1_code"], value_only=True)
if data:
break |
This is most probably caused by a performance-problem with telnet. In telnet, there are no markers that indicate the actual end of a block, so timing has to be used to infer end-of-transmission. [I can reproduce this error, if I set The errors indicate a JSON decode of an incomplete block, so somehow the system doesn't finish the transmission within I would try:
In the end, when using telnet, proper configuration of |
Hi again, Thanks 4 your help and explications! |
@d1nd141, you're welcome, and thanks @Andre0512 for the help and advice. |
Hi,
If use f.ex.
temp_1_wday = fh.get_device_reading("myWeather", "fc1_day_of_week")
temp_1_wday = temp_1_wday['day_of_week']
temp_1_wday = temp_1_wday['Value']
or
temp_1_code = fh.get_device_reading("myWeather", "fc1_code")
temp_1_code = temp_1_code['fc1_code']
temp_1_code = temp_1_code['Value']
to get a specific reading.
Unfortunately sometimes (not always, and also not everytime the same device) i get all readings.
Not sure if it's FHEM related or python-fhem:
or
The text was updated successfully, but these errors were encountered: