Not looking to threadjack – but does anyone know where the ‘voltage’ attribute went?
I have had a 3EM since May and some of the sensors I created were voltage for each phase (per below). They working perfectly until in the last week the voltage attribute disappeared (don’t see in developer tools anymore either). These voltages are necessary inputs to automations I have that shut down pumps (i.e. for wells, irrigation etc) if phase imbalance gets above 10% or one of the phases drops (we’re in the boonies here and all sorts of weird stuff happens to power that ends up costing us new pumps more often than we would like…). Anyone noticed this, or perhaps happened as a firmware update recently? Any suggestions on getting it back? Worth switching to MQTT? Does that kill em3 availability in the shelly app? – now where it really matters to me but curious to know.
I don’t have the "total_increasing available as state_class (only measurement). If I try to add it in config.yaml it also throws an error. I have 2021.09.
@amitfin: Thanks for your feedback.
In my case for “energy_total” the “measurement” suits better than “total_increasing”.
Since 3 days I didn´t get any log regarding warning or failure. Therefore I want to share it with you guys.
Thank you for getting back to me!" This may have been an issue with my HA as I had to restore a backup … I’ve now managed to set the proper state_class and will be monitoring if everything will work OK
My sensors look like this, but as soon as I add state_class: measurment to either the total sensor or power sensor I get configuration error. state_class: total:_increasing is not allowed says Visual Code…?
Any suggestions please.
# bergvärme total energy
bv_total_energy:
friendly_name: 'BV total energy'
unique_id: '57831d02-53cb-497e-be9e-624b8d42230e'
unit_of_measurement: kWh
device_class: energy
value_template: "{{(
(
states('sensor.bv_energy1') | float +
states('sensor.bv_energy2') | float +
states('sensor.bv_energy3') | float
) | round(2)
)}}"
availability_template: >
{{ states('sensor.bv_energy1') not in ['unknown', 'unavailable', 'none'] and
states('sensor.bv_energy2') not in ['unknown', 'unavailable', 'none'] and
states('sensor.bv_energy3') not in ['unknown', 'unavailable', 'none'] }}
# bergvärme total power
bv_total_power:
friendly_name: 'BV total power'
unique_id: '36eedbec-c0f3-4920-88a7-003c0fb543b1'
unit_of_measurement: W
device_class: power
value_template: "{{(
(
states('sensor.bv_power1') | float +
states('sensor.bv_power2') | float +
states('sensor.bv_power3') | float
) | round(0)
)}}"
availability_template: >
{{ states('sensor.bv_power1') not in ['unknown', 'unavailable', 'none'] and
states('sensor.bv_power2') not in ['unknown', 'unavailable', 'none'] and
states('sensor.bv_power3') not in ['unknown', 'unavailable', 'none'] }}
Ha ha, such a stupid mistake . But id didn’t help:
Invalid config for [sensor.template]: [state_class] is an invalid option for [sensor.template]. Check: sensor.template->sensors->bv_total_energy->state_class. (See ?, line ?).
The is_number approach to availability is pretty neat!
And thanks for others as well in this topic. I was quite stuck with the false readings and couldn’t find out what was the problem with my calculated sensor.
Anyways, my code is as follows now:
- platform: template
sensors:
total_main_energy:
friendly_name: 'Total Main Energy'
device_class: energy
unit_of_measurement: "kWh"
entity_id:
- sensor.phase_1_energy
- sensor.phase_2_energy
- sensor.phase_3_energy
value_template: "{{ (states('sensor.phase_1_energy')|float +
states('sensor.phase_2_energy')|float +
states('sensor.phase_3_energy')|float )|round(3) }}"
availability_template: >-
{{
is_number(states('sensor.phase_1_energy')) and
is_number(states('sensor.phase_2_energy')) and
is_number(states('sensor.phase_2_energy'))
}}
- platform: template
sensors:
total_main_energy_returned:
friendly_name: 'Total Main Energy Returned'
device_class: energy
unit_of_measurement: "kWh"
entity_id:
- sensor.phase_1_energy_returned
- sensor.phase_2_energy_returned
- sensor.phase_3_energy_returned
value_template: "{{ (states('sensor.phase_1_energy_returned')|float +
states('sensor.phase_2_energy_returned')|float +
states('sensor.phase_3_energy_returned')|float)|round(3) }}"
availability_template: >-
{{
is_number(states('sensor.phase_1_energy_returned')) and
is_number(states('sensor.phase_2_energy_returned')) and
is_number(states('sensor.phase_2_energy_returned'))
}}
But now I have a question, how to correct the data on my energy dashboard?
Thanks for the is_number recommendation!
I’ve updated the original post at the top of this thread to include it.
Here is how the sensor looks now (IMHO, quite clean):