Closed mike391 closed 2 years ago
Do you see any errors in the logs? Also see #180 as others were experiencing similar issues, maybe this will give you some pointers. Or maybe you have to wait a bit until the energy sensor has some data collected.
btw create_energy_sensor
on your sensor setup is unnecessary as you already supplied that in the global config. So this will be the default for all sensors.
Ah, yea I added create_energy_sensor
while I was troubleshooting :P.
I looked at #180 and the kWh
were not set on the switch.kitchen_stove_lights
but it was set on switch.kitchen_pot_lights
. I changed that but it still does not show up.
Just in case I also checked out the states
table. I found that the switch.kitchen_stove_lights
entity was missing properties unit_of_measurement, device_class
and also had "status":"paused"
while the switch.kitchen_pot_lights
entity had those keys and as well as "status":"collecting"
.
Ive added the missing properties there too just in case.... It did not make the switch.kitchen_stove_lights
entity appear yet, but maybe ill have to wait a bit like you said.
Also i did notice that there were 4 results for sensor.kitchen_stove_lights_kwh_usage
in the states
table. Is this normal?
EDIT: In the devtools, when I check the states of both of these, this is what their attributes are:
**sensor.kitchen_stove_light_power_meter**
unit_of_measurement: W
friendly_name: kitchen stove lights Power meter
device_class: power
**sensor.kitchen_pot_lights_power_meter**
calculation_mode: fixed
integration: powercalc
source_entity: switch.kitchen_pot_lights
source_domain: switch
unit_of_measurement: W
friendly_name: Kitchen Pot Lights Power meter
device_class: power
EDIT#2: In /.storage/core.entity_registry
I have an entity entry for the energy entity that is working, but the other one is not listed. Here is the one that is listed:
{
"entity_id": "sensor.kitchen_pot_lights_power_meter",
"config_entry_id": null,
"device_id": null,
"area_id": null,
"unique_id": "50:C7:BF:81:84:14",
"platform": "powercalc",
"name": null,
"icon": null,
"disabled_by": null,
"capabilities": {},
"supported_features": 0,
"device_class": "power",
"unit_of_measurement": "W",
"original_name": "Kitchen Pot Lights Power meter",
"original_icon": null
},
{
"entity_id": "sensor.kitchen_pot_lights_kwh_usage",
"config_entry_id": null,
"device_id": null,
"area_id": null,
"unique_id": "50:C7:BF:81:84:14_energy",
"platform": "powercalc",
"name": null,
"icon": null,
"disabled_by": null,
"capabilities": {
"state_class": "total_increasing"
},
"supported_features": 0,
"device_class": null,
"unit_of_measurement": null,
"original_name": "Kitchen Pot Lights kWh usage",
"original_icon": "mdi:lightning-bolt"
}
How would I modify these entities? I already tried doing so in the database...
It's strange that sensor.kitchen_stove_light_power_meter
which is also a powercalc sensor does not contain all the attributes. calculation_mode
, integration
, source_domain
, source_entity
should also be there.
Could you also enable debug logging for powercalc (see the readme)? Maybe this will give some pointers.
Maybe you had setup sensor.kitchen_stove_light_power_meter
before using some template sensor, than powercalc is not able to create a power sensor with the same name and id.
Look up in google / HA forum how to completely remove an entity from Home Assistant.
Also i did notice that there were 4 results for sensor.kitchen_stove_lights_kwh_usage in the states table. Is this normal?
I think this is quite normal as every change in value is a change in state and will be a new record in the database.
I've enabled debug mode and removed those entities. For testing purposes I gave the Stove Light a new name and also added a sink light entity.
I've noticed that the sink and stove light entities (not working) don't have unique IDs when they are created (unique_id=None). However the pot lights (working) do have a unique_Id.
2021-09-11 11:26:15 WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration bureau_of_meteorology which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2021-09-11 11:26:15 WARNING (SyncWorker_3) [homeassistant.loader] We found a custom integration hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2021-09-11 11:26:15 WARNING (SyncWorker_4) [homeassistant.loader] We found a custom integration scheduler which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2021-09-11 11:26:15 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration webrtc which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2021-09-11 11:26:15 WARNING (SyncWorker_2) [homeassistant.loader] We found a custom integration monitor_docker which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2021-09-11 11:26:15 WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration aarlo which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2021-09-11 11:26:15 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration powercalc which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2021-09-11 11:26:15 WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration braviatv_psk which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2021-09-11 11:26:15 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration nicehash which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2021-09-11 11:26:15 WARNING (SyncWorker_4) [homeassistant.loader] We found a custom integration mail_and_packages which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2021-09-11 11:26:15 WARNING (SyncWorker_5) [homeassistant.loader] We found a custom integration openmediavault which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2021-09-11 11:26:27 DEBUG (MainThread) [custom_components.powercalc.sensor] Creating power sensor (entity_id=switch.kitchen_stove_lights sensor_name=Stove Lights Power meter strategy=FixedStrategy manufacturer= model= standby_usage=None unique_id=None)
2021-09-11 11:26:27 DEBUG (MainThread) [custom_components.powercalc.sensor] Creating energy sensor: Stove Lights kWh usage
2021-09-11 11:26:27 DEBUG (MainThread) [custom_components.powercalc.sensor] Creating utility_meter sensor: Stove Lights kWh usage daily
2021-09-11 11:26:27 DEBUG (MainThread) [custom_components.powercalc.sensor] Creating utility_meter sensor: Stove Lights kWh usage yearly
2021-09-11 11:26:27 DEBUG (MainThread) [custom_components.powercalc.sensor] Creating utility_meter sensor: Stove Lights kWh usage monthly
2021-09-11 11:26:27 DEBUG (MainThread) [custom_components.powercalc.sensor] Creating power sensor (entity_id=switch.kitchen_pot_lights sensor_name=Kitchen Pot Lights Power meter strategy=FixedStrategy manufacturer= model= standby_usage=None unique_id=50:C7:BF:81:84:14)
2021-09-11 11:26:27 DEBUG (MainThread) [custom_components.powercalc.sensor] Creating energy sensor: Kitchen Pot Lights kWh usage
2021-09-11 11:26:27 DEBUG (MainThread) [custom_components.powercalc.sensor] Creating utility_meter sensor: Kitchen Pot Lights kWh usage daily
2021-09-11 11:26:27 DEBUG (MainThread) [custom_components.powercalc.sensor] Creating utility_meter sensor: Kitchen Pot Lights kWh usage yearly
2021-09-11 11:26:27 DEBUG (MainThread) [custom_components.powercalc.sensor] Creating utility_meter sensor: Kitchen Pot Lights kWh usage monthly
2021-09-11 11:26:27 DEBUG (MainThread) [custom_components.powercalc.sensor] Creating power sensor (entity_id=switch.kitchen_sink_lights sensor_name=Kitchen Sink Light Power meter strategy=FixedStrategy manufacturer= model= standby_usage=None unique_id=None)
2021-09-11 11:26:27 DEBUG (MainThread) [custom_components.powercalc.sensor] Creating energy sensor: Kitchen Sink Light kWh usage
2021-09-11 11:26:27 DEBUG (MainThread) [custom_components.powercalc.sensor] Creating utility_meter sensor: Kitchen Sink Light kWh usage daily
2021-09-11 11:26:27 DEBUG (MainThread) [custom_components.powercalc.sensor] Creating utility_meter sensor: Kitchen Sink Light kWh usage yearly
2021-09-11 11:26:27 DEBUG (MainThread) [custom_components.powercalc.sensor] Creating utility_meter sensor: Kitchen Sink Light kWh usage monthly
2021-09-11 11:26:27 DEBUG (MainThread) [custom_components.powercalc.sensor] Creating power sensor (entity_id=light.living_room_lamp_46bf44fe_level_on_off sensor_name=Living Room Lamp Power meter strategy=FixedStrategy manufacturer= model= standby_usage=None unique_id=84:2e:14:ff:fe:44:bf:46-1)
2021-09-11 11:26:27 DEBUG (MainThread) [custom_components.powercalc.sensor] Creating energy sensor: Living Room Lamp kWh usage
2021-09-11 11:26:27 DEBUG (MainThread) [custom_components.powercalc.sensor] Creating utility_meter sensor: Living Room Lamp kWh usage daily
2021-09-11 11:26:27 DEBUG (MainThread) [custom_components.powercalc.sensor] Creating utility_meter sensor: Living Room Lamp kWh usage yearly
2021-09-11 11:26:27 DEBUG (MainThread) [custom_components.powercalc.sensor] Creating utility_meter sensor: Living Room Lamp kWh usage monthly
2021-09-11 11:26:54 DEBUG (MainThread) [custom_components.powercalc.sensor] State changed to "on" for entity "switch.kitchen_pot_lights". Power:28.0
2021-09-11 11:26:54 DEBUG (MainThread) [custom_components.powercalc.sensor] State changed to "off" for entity "light.living_room_lamp_46bf44fe_level_on_off". Power:0
2021-09-11 11:26:55 WARNING (SyncWorker_3) [scapy.runtime] Unable to guess type (interface=enp3s0 protocol=0x3 family=1). Using <member 'name' of 'Packet' objects>
2021-09-11 11:26:55 WARNING (DHCPWatcher) [scapy.runtime] Unable to guess type (interface=enp3s0 protocol=0x3 family=1). Using <member 'name' of 'Packet' objects>
@mike391 Everything looks fine and exactly as expected. Not sure why it is not working.
The unique id will be picked from the source entity, for example switch.kitchen_pot_lights
, and the power sensor will get the same unique id to make sure there exists only one power sensor for the switch, and also allows to change settings (for example friendly name in the UI).
Some entities does not provide a unique id (i.e. switch.kitchen_sink_lights
), so powercalc will create the power sensor without a unique id, because it cannot guess a unique id if the source integration does not provide one.
This is not a problem and the entities should still function correctly.
Now 17 hours has passed do you still don't have access to these entities in energy dashboard?
See #228 for potential solution.
I'll give it a shot, thanks. That ticket looks very similar to what I am seeing
Finally got it working!
My steps in case anyone else is interested:
Im running HASS Core 2021.9.5 with 0.6.1 version of this plugin.
Ive added the following to my configuration:
However in my energy dashboard, it only allows me to add the
kitchen_pot_lights
entity, and thekitchen_stove_lights
entity does not appear on the list at all. Ive tried adding a bunch of devices and it seems to be a hit and miss. Both of these are the same model of TPlink switch (if that matters).Not really sure how to debug this. I can supply more info just ask.