Yes this looks like a bug in Home Assistant / the light integration you are using. As @CM000n indicates the brightness should never exceed 255. I can make it failsafe in my integration to force it to 255 when it exceeds 255.
But this is very strange behaviour. Which integration does control this light? Than you can also create a bug report for this integration, so it can be fixed at the source of the problem.
Tuya. I will check tomorrow if this happens with other lights provided by this integration as well and create a bug report.
Thanks.
Yes you should definitely create a bug report at Tuya component.
Nevertheless I fixed it also in my integration, so it will never create wrong power readings , see this Pull Request.
Will be in next release v0.5.3
@bramski What Happend in version v0.5?
I made update and Lost kWh in grouped sensor.
Is config changed?
Not sure why this happened.
There has been some changes in naming of the power and energy sensors, maybe this is related. See #106 and #108. However when the entity_id of the power sensor would have changed in your situation than the grouped sensor should not work at all.
How is this group sensor configured?
Itās grouped according to the manual which you updated a week or two weeks ago.
- platform: template
sensors:
all_lights_consumption:
friendly_name: "Total Light Consumption"
unit_of_measurement: kWh
value_template: >-
{{states('sensor.garderoba_energy') | float + states('sensor.spizarnia_hue_energy') | float [...] }}
attribute_templates:
last_reset: "2021-08-01T00:00:00+00:00"
state_class: measurement
device_class: energy
icon_template: mdi:transmission-tower
But I check template in Developers Tools ā Templates, and now I have only 6 energy - before more than 20.
ENERGY SENSORS:
{% for state in states -%}
{%- if 'energy' in state.entity_id and state.attributes.device_class == "energy" -%}
states('{{ state.entity_id }}') | float +
{% endif -%}
{%- endfor -%}
I found what might cause a problem. Iāve got a 24 powercalc (Power) sensors but only 6 energy sensors.
The reason is that energy sensors changed names. ex:
Previously I had: sensor.oswietlenie_taras_power
+ sensor.oswietlenie_taras_energy
Now I have: sensor.oswietlenie_taras_power
+ sensor.taras_light_energy
It looks that energy and power change naming is different.
- Power gets a name from switch entity name
- Energy gets a name froms switch entity_id
@bramski Is that actually changed?
Yes it has changed that the entity_ids from power and energy sensors should both be extracted from the source entity_id in your case switch.taras_light
. Previously the entity_id was constructed from the name (or friendly name), and this was actually wrong (unwanted) behaviour.
So in your case you should have:
sensor.taras_light_power
and sensor.taras_light_energy
. The reason why the power sensor has not changed the entity_id would be because it has a unique id assigned and already exists in your installation with sensor.oswietlenie_taras_power
. The integration is than unable to change the entity_id I think.
So what you could try is to change the entity_id from sensor.oswietlenie_taras_power
to sensor.taras_light_power
.
This renaming of entities is only once. From now it should stay this way. Sorry for the inconvenience.
I wondering if I can change entity id of _energy sensors - it will be easier for me because itās already in template sensor.
Or it will broke again after HA restart?
BTW. I see now that energy sensors doesnāt have a device_class = energy
state_class: measurement
last_reset: 2021-08-30T15:14:43.704624+00:00
source: sensor.taras_light_power
source_entity: switch.taras_light
source_domain: switch
friendly_name: OÅwietlenie Taras energy
icon: mdi:lightning-bolt
Not sure about all the magic in HA internals. But I would say it is better to rename the power sensors as this is in line with the way powercalc would name them. Also itās more logical when looking at your entity listing, as the energy and power sensors have the exact same entity_id as the source entity only postfixed with _power
and _energy
. This would prevent any unwanted side effects and other things I canāt forsee. Itās only a one time process to do it now, to also rename your template sensors.
Iām pretty confident I donāt need to do any major changes in the naming logic in the future, so it will stay this way.
OK i manually changed a _power sensor entity_id. Hope it will work correctly from now.
I saw in change log that you added a utility_meter. I didnāt check that but for a energy dashboard is better to add normal summary entity or utility_meter? Or maybe it will works with both types for entity?
Under the hood this energy sensor is just an integration sensor. I have looked into the code of this component, and it seems the device class energy will be set after the first integration is calculated. So itās just a matter of time I think.
As far as I know you have to use the total collection energy meter (the one that never resets), in your case āOÅwietlenie Taras energyā. The utility meters can be used in lovelace dashboard, or automations etc. Not sure if they already have a use in the energy dashboard.
Thanks for your all help and patience.
This integration with help of community might be one of the best extension to HA!
I saw there is a idea to simplify a process of testing and adding new models of bulbs. That might be a great opportunity to grow this integration community. Iām also slowly preparing for helping with that.
Your welcome.
Yes I did a rewrite of measure script to support more power meters and also we are working on better readme / wiki to help people getting this up and running, so more can contribute for new light models.
Iāve updated to 2021.9.0 and I have error in Energy Configuration
Unexpected state class
The following entities do not have the expected status class ātotal_increasingā
- sensor.all_lights_consumption (measurement)
(translated)
Is this sensor created by powercalc integration or is this a template sensor you created yourself? Looking at the naming I suspect the second.
As always you are right.
Im not sure if is just state_class changed from measurement to total_increasing?
Yes thatās something changed in home assistent 2021.9. You can just change the state class. Also last reset is not neccesary anymore afaik
Hi,
didnāt had the time yet to thank you for fixing adjusting it that quick!
Thanks!
Hello,
First of all, thank you so much for this component! Putting actual numbers on energy consumption is the best way to make people realise what the situation is, and what can be done.
Iāve read the documentation and this thread entirely, but Iām afraid I missed something obvious:
Letās say I have an appliance I know the consumption of, but which has no entity related to it in HA. My freezer for example, whose power draw I know, and whose total consumption Iād like to keep track of.
Is there a way for me to declare that āthis thing called āa freezerā is constantly drawing 30Wā, so that in the end I can have it show up in the new Energy āindividual deviceā monitoring?