invalidateDecorationsAllViews - not working? #1511
-
I am trying to link external sensor data from a Home Assistant https://www.home-assistant.io/ / https://www.npmjs.com/package/homeassistant instance into the viewer app. Values for this sensor are updated every 10 seconds. To update the live data feed, I am trying to use: `
` Instead of updating or removing the decorators every 5 seconds, a new decorator is added. Here’s a link to a video describing the issue: https://www.dropbox.com/s/o8bbna3co27xiii/invalidateDecorationsAllViews.mp4?dl=0 Any idea how I could resolve this? Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Based on your code snippet, you create and add a new SmartDeviceDecorator every 5 seconds, and never drop the previously-added ones.
Alternatively, if there's only ever one SmartDeviceDecorator, just store the most recent one in some variable instead of searching for it. Note: add/dropDecorator take care of invalidating decorations - you should not have to do that yourself here. |
Beta Was this translation helpful? Give feedback.
Based on your code snippet, you create and add a new SmartDeviceDecorator every 5 seconds, and never drop the previously-added ones.
Try something like:
Alternatively, if there's only ever one SmartDeviceDecorator, just store the most recent one in some variable instead of searching for it.
Note: add/dropDecorator take care of invalidating decorations - you should not have to do that yourself here.