I’m fairly new with HA and, I’m trying to see how HA can help me to automate and monitor some devices in my home.
One issue or question that I have, is with a Shelly device (plus 1pm), that I’m using to monitor power usage on my HeatPump. I’ve added it in HA via Shelly integration, which seems to be working, but…I’m disappointed that the power data refresh interval is way to high. For ex, when I’m checking the power data on the senzor, sometimes is shows even “20mins ago” data.
How can I make it to capture and show the consumption like ever 1 sec or, at least to a couple of seconds, not minutes.
With regards to HA, I have 2 integrations that I’ve build so far (for testing), one via a Synology NAS with Docker and one inside a VM. (both have same result though)
Hello, I just experienced the same issue.
I solved it by defining an additional REST sensor in yaml that polls the local Shelly Gen 2 Device API every second:
rest:
- resource: "http://<local ip of your shelly>/rpc/Switch.GetStatus?id=0"
scan_interval: 1
timeout: 1
sensor:
- name: "Shelly Power"
value_template: "{{ value_json.apower | round(0) }}"
device_class: "power"
unit_of_measurement: "W"
icon: "mdi:solar-power"
unique_id: "put something here to be able to customize the entity via UI"
# force_update: true
I round the value provided by the Shelly to prevent negligible changes to be stored in the database. I don’t care about fractions of Watts and besides that I don’t think a Shelly measures that accurate at all.
I used force_update to test if it works and disabled it to prevent unchanged values being written to the database.
During my experiments I experienced that reloading REST or even all YAML configuration did not reload this sensor. Maybe because I defined it in packages. HA restart applied the YAML changes though.
I just noticed the same issue with Shelly Plus Plug S’s and PM Mini gen3’s after updating these from 1.4.2 to 1.4.4.
Is there any way to use your solution to update the existing sensors (instead of creating new ones) so that I do not have to recreate the sankey chart that tracks power consumption of all the Shelly’s I’ve got?
Also:
" I used force_update to test if it works and disabled it to prevent unchanged values being written to the database."
So unchanged values are not written by default? I was already thinking of adding an if-statement to only process new values if they are not equal to the last one.
Tuxinator94 Uhm, I didn’t have to, Home Assistant picked the devices up without problems and gets values, just suddenly a whole lot less often since a firmware update.
Ah okay , enabled it and set ws:/HASS-IP:8123/api/shelly/ws (later tried wss://), followed by rebooting the plug. After startup it sends data, then it goes quiet for long periods of time again, especially compared to gen1’s.