chunkysteveo / OpenEPaperLink-HA-Weatherman

Wetherman EPaper display using OpenEPaperLink and the HA Integration
37 stars 4 forks source link

Display does not update regularly #20

Closed peterthepeter closed 8 months ago

peterthepeter commented 8 months ago

Hello, I have the problem that my EPaper Dispaly with the weather data does not update regularly.

I have switched it 24 hours a day and always have the feeling that it only updates for the first time around 10 in the morning and the last time around 8 in the evening. Between 10am and 8pm the updates work 90% of the time.

I have several epaper displays running (with other HA data), all with the same settings for when to update. This works on all other displays without any problems, except for the weather.

Do you have any idea what the problem could be?

https://dpaste.org/VA807 -automation https://dpaste.org/SzPvq -template

chunkysteveo commented 8 months ago

The differences I see in your setup is you are waiting for a couple of conditions to be true, including a zonal condition.

My guess is that sometimes these conditions are not validating to run the automation to update the weather data, and thus the epaper display will not change as there's no seen change in the weatherman template sensor?

peterthepeter commented 8 months ago

That's what I thought at first, but even if I remove all the conditions, the problem remains.

I still have a display here which simply shows me data from HA with exactly the same conditions and this works without any problems.

The automation ran 13 minutes ago (see screenshot) but it does not appear on the display or in openEpaper.

Bildschirmfoto 2024-03-13 um 08 32 49

chunkysteveo commented 8 months ago

What do the traces say for the automation?

peterthepeter commented 8 months ago

I have removed all the conditions and it is somehow the same 8 pm is the last time that is updated and from 10 am it goes on.

I find an error in the trace (see screenshot).

Bildschirmfoto 2024-03-14 um 07 23 09
peterthepeter commented 8 months ago

I or ChatGPT has found the solution.

The following had to be adjusted (I had adjusted this according to the info because I had changed the display to 24h).

from: value: >- {{ '%0.2d' | format(state_attr('sensor.weatherman_data_tag','wm_time_0')) | string | upper }}

to: value: >- {{ '%0.2d' | format(state_attr('sensor.weatherman_data_tag','wm_time_0') | int) | string | upper }}

Now it works without errors.

chunkysteveo commented 8 months ago

Ahh, interesting! Most likely the formatting is the issue here, as it's trying to format a non-integer. Guessing the single and double digit values has something to do with the error and using "%0.2d" to account for things working and not working when time goes from e.g. 9am to 12am? Maybe?

But in my testing on https://YOUT_HA_IP/developer-tools/template I was able to replicate the error TypeError: %d format: a real number is required, not str when I didn't include the | int. So your fix checks out correct - thanks!

Interestingly though - timestamp_custom('%H') in the config for the sensor should be enough if you want 24H time, and we don't need to format() this in the code in the automation. I'm guessing I left that in from another version..? Meh....! I'll update the readme file with your correction and leave it as that!