hassio-addons/addon-appdaemon3

States are not refreshed when waking from sleep, until they change again.

WazWaz opened this issue · 3 comments

Problem/Motivation

My setup is a tablet running AppDaemon in a Fully Kiosk Browser. It sleeps after 30 seconds and wakes up if anything walks in front of the camera. Any setup with sleeping will show the same issues, such as a phone.

Expected behavior

When the device wakes up, the dashboard should refresh all widgets from states immediately.

Actual behavior

Nothing happens until the relevant state changes. The clock updates are a few seconds, but other data
that changes less frequently shows whatever state it had prior to sleeping, regardless of any changes
that have happened in the mean time. For example, data that only updates every minute will show
the old data, possibly hours old, for up to 60 seconds.

Steps to reproduce

Create a hassio sensor that updates every 60 seconds:

  - platform: rest
    resource: http://now.httpbin.org/
    name: "HttpBinTime"
    scan_interval: 60
    value_template: '{{ value_json.now.iso8601 }}'

and a corresponding dashboard element:

layout:
    - test

test:
    widget_type: sensor
    entity: sensor.httpbintime

Observe that it works if you keep watching it. Now open it on a phone (so that you can trust it to sleep). Wait 10 minutes, turn on phone, see that time is out of date. It helps to view it on another device so you can easily switch to it just after it changes and so see that it does indeed take 60 seconds to refresh.

Proposed changes

Have some javascript in the outer wrapper that observes the time every 0.5 seconds and
refreshes all widgets if the amount of clock time that passes between checks is more than 10
seconds.

👋 Thanks for opening your first issue here! If you're reporting a 🐛 bug, please make sure you include steps to reproduce it. Also, logs, error messages and information about your hardware might be usefull.

Moved to correct tracker:

AppDaemon/appdaemon#357

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.