Open blair287 opened 3 years ago
The core Shelly integration works ok I ended up deleting this hacs version to use the core one
The integration has to be updated to show a reset time for power
The same goes for the temperature/humidity sensors in combination with the new statistics graph card. The are missing the state_class: measurement.
The core Shelly integration works ok I ended up deleting this hacs version to use the core one
The integration has to be updated to show a reset time for power
The default Shelly integration doesn't allow decimal or other readings from the Shelly em
What reading is missing you have to enable some of them as not enabled by default . This hacs version is good but needs updating to work fully with 2021.8
I made a little workaround to get my new 2.5 working with the energy settings, should be doable for any of them.
I'm using a package but you can do the same in the configuration.yaml if you want to. The trick is to add a customize to add the last reset, device class and state class.
homeassistant:
customize:
sensor.shelly_shsw_25_1_total_consumption:
last_reset: "2021-07-30T00:00:00+00:00"
device_class: energy
state_class: measurement
sensor.shelly_shsw_25_2_total_consumption:
last_reset: "2021-07-30T00:00:00+00:00"
device_class: energy
state_class: measurement
Not sure what's better to use, the total consumption or current consumption but the process is the same on whatever sensor you want to add! :D
I decided to use this template code in the developer panel to generate the list of all my shelly4hass customizations:
{% for state in states.sensor -%}
{% if state.entity_id is match("^sensor\.shelly_.+_total_consumption$", ignorecase=False) -%}
{{ state.entity_id }}:
last_reset: "1970-01-01T00:00:00+00:00"
device_class: energy
state_class: measurement
{% endif -%}
{% endfor %}
Then it was just a matter of copy/paste into the customize location mentioned above. Worked like a charm!
Obviously it would be better if the shelly4hass integration supported this, but this is a useful workaround for now.
After the recent HA update to 2021.9 the last_reset is not necessary any longer. But device_class needs to be energy (currently it is power and that is simply wrong for a total amount) and state_class needs to be total_increasing. If HA detects a decreasing value, it will think that the device has been reset. This makes only sense for total consumption. E.g.:
homeassistant:
customize:
sensor.shelly_shplg_s_5b1234_total_consumption:
device_class: "energy"
state_class: "total_increasing"
A fix should be easy, just set the correct values in all total_consumption shelly entries.
@m-reuter After a power outage the total consumption is set to 0 (on my shelly PM2). So wouldnt it make more sense to have a state_class: "total".
No should be total_increasing . See https://developers.home-assistant.io/blog/2021/08/16/state_class_total/ . If the value shrinks, it will interpret it as an intermediate reset to zero, which is what we want.
Will this feature be implementet into shelly for hass or should i migrate to the native shelly integration? It would be really nice to be able to add all my plygs to the energy dashboard.
Environment
Describe the bug
Home assistant said to give this link to Dev for integration.
https://developers.home-assistant.io/docs/core/entity/sensor#long-term-statistics
Shelly em total consumption entity won't show in the options for the new energy option in HA.
Steps to Reproduce
Expected behavior
Screenshots
Traceback/Error logs
Additional context