min was unchanged and the error is stating that it cannot iterate over an integer. Meaning what you’re using min on something that is not a list.
@ziepoeskenetnie post the template you are using as it most likely has syntax errors.
min was unchanged and the error is stating that it cannot iterate over an integer. Meaning what you’re using min on something that is not a list.
@ziepoeskenetnie post the template you are using as it most likely has syntax errors.
also, that template is unsafe.
{{ [states('sensor.shelly_em_c45bbe77e8ff_meter_power_0') | float(0), 0] | min }}
Well it used to work until the latest update so something changed. In any case I believe the solution I just posted is valid. The max function I also used in @ziepoeskenetnie earlier question is similarly affected so he just needs to make a similar change.
template:
- sensor:
- name: "Power Import"
unit_of_measurement: "W"
state_class: "measurement"
device_class: "power"
unique_id: power_imported
attributes:
last_reset: "1970-01-01T00:00:00+00:00"
state: '{{ states.sensor.shelley_power.state | float(0) | max(0) }}'
- name: "Power Export"
unit_of_measurement: "W"
state_class: "measurement"
device_class: "power"
unique_id: power_exported
attributes:
last_reset: "1970-01-01T00:00:00+00:00"
state: '{{ states.sensor.shelley_power.state | float(0) | min(0) | multiply(-1) }}'
Here you go
Yep, as expected you’re performing min on a single value, just as the error states.
state: "{{ [ states('sensor.shelley_power') | float(0), 0] | max }}"
state: '{{ [ states('sensor.shelley_power') | float(0), 0] | min | multiply(-1) }}
It did not work, it just didn’t produce an error, however it was erroring.
That looks exactly like what I just posted seven posts above but in any case @ziepoeskenetnie what @petro has just posted is what you need to replace your existing template with now.
P.S It was not previously causing an error @petro it was working fine,
Min was not working on it prior. It was silently erroring. It was basically doing nothing and just returning 0. Which made it appear like it was working.
I was mistaken btw, there was a change to min/max back in december. (long release cycle this time). Anways, the PR catches the error now and projects it to the user.
8 days ago when I posted the solution it was working for me. I tested it using my own sensors and I am pretty sure @ziepoeskenetnie would have said if he wasnt getting the expected values out but happy for him to say it hasn’t been working all along. In any case it will be working now.
I understand you think it was working properly. And that’s OK with me. But I can tell you, it was not. I’m staring at the changes right now, I spend most of my time contributing to this file (templates) for core. The previous iteration just extended the python min/max, which does not allow non-iterable items. We now catch this. You can see it in the PR if you like.
Have any other changes been made to Energy Management with HA new update? As of today, the Energy Dashboard no longer displays the consumption. However, the entities show me the currently correct values…
Error during startup process:
Logger: homeassistant.components.websocket_api.http.connection
Source: components/websocket_api/connection.py:96
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 18:12:49 (8 occurrences)
Last logged: 18:12:49
[547664452432] Received invalid command: energy/info
Same problem for me. After HA update.
Same here. After update…
+1 with the energy dashboard broken after update
did you see the notification that said the database was being upgraded and not to reboot?
Mine looks fine
No, I did not see that notification.
I rolling back to previous version (from backup), then all working again. There is problem in new HA version.
Is it possible that it now only works with
state_class total increasing
And no longer with
state_class measurement
Update:
OK. That’s it. My energy card works again
Yes - that’s exactly what seems to have happened.