#Sensors from configuration.yaml are not availble for energy dashboard
1 messages · Page 1 of 1 (latest)
I include a separate file for sensor configurations:
sensor: !include sensors.yaml
In the sensor.yaml I defined the following:
- platform: integration
source: sensor.desk_socket_office_w
unique_id: desk_socket_office_kwh
unit_prefix: k
round: 2
- platform: integration
source: sensor.floor_lamp_socket_office_w
unique_id: floor_lamp_socket_office_kwh
unit_prefix: k
round: 2
- platform: integration
source: sensor.lab_socket_office_w
unique_id: lab_socket_office_kwh
unit_prefix: k
round: 2
- platform: group
type: sum
entities:
- sensor.desktop_socket_office_kwh
- sensor.floor_lamp_socket_office_kwh
- sensor.lab_socket_office_kww
unique_id: office_power_consumption_kwh
device_class: energy
Unfortunately the group sensor is not available in my energy dashboard as a source.
do all the integration sensors have valid values?
Nope, they don't
???
If I go to Geräte & Dienste -> Entitäten and search for one of the sensors (e.g. sensor.sensor.desk_socket_office_kwh), I got no results.
The source sensors can be found
well then they weren't created
obviously, the question is why and how can I debug here?
did you reload the yaml config? If yes, try reloading HA itself
can you try creating the integration sensor in the UI
This will work
But I want to have the ability to change riemann sum sensors if needed, but this is not possible in ui
I tested a bit with the configuration. If I comment out unique_id the sensor will be created. But without this parameter no changes in Web UI are possible.
Do I facing here a bug or what could I do to create sensors this way with own unique_ids and names?
have you tried generating a true uuid?
unique_id: "aa29bace-88cd-4eb4-b41e-54ed284193be" for example
the unique_id doesn't have to be anything readable because you will not see it (it's not the entity_id)
An UUID does not make any difference. But in my mind the unique_id is shown in the WebUI as Entity-ID
If I follow the documentation for Riemann sum integral (https://www.home-assistant.io/integrations/integration/) than unique_id needs only to be unique and not an uuid.
unique_id string (optional)
An ID that uniquely identifies the integration sensor. Set this to a unique value to allow customization through the UI.
no, its not the same thing
yes, but it might not be unique for whatever reason
that might block it from being created
that was the only thing I could think of, otherwise I have no idea
Ok got it. Finally, with this information I was able to make the sensors and groups available. I did the following:
- Use an UUID as proposed for
unique_id. Other values than UUID don't seem to work - Use my naming scheme for
name(e.g.entertainment_socket_living_room_kwh) - Restart Home Assistant, as YAML reload doesn't seem enought for integrations
Finally, my sensors.yaml looks like this:
- platform: integration
source: sensor.entertainment_socket_living_room_w
name: entertainment_socket_living_room_kwh
unique_id: 065641b3-18dd-414a-8c67-a1f8605ac937
unit_prefix: k
round: 2
- platform: group
type: sum
entities:
- sensor.entertainment_socket_living_room_kwh
name: power_consumption_living_room
unique_id: dd5b852d-cc86-4b3e-a747-8089ec19287f
device_class: energy
With this configuration I am also able to configure details for the entities within the WebUI.
I would suggest to adapt the documentation to reflect the findings.
You can use anything in the unique_id field as long as it's unique across the integration you're using.
You can verify that by looking at my configuration, i do not use UUID's for any unique_id.
You can also use anything for the name, it does not need to have _'s.
For me this naming scheme works well. For Sensors I will place on an dashboard, I set a user friendly name via WebUI
Alright, I'm just informing you that you have a miss conception about bullet 1
Also, bullet 3 you have a miss conception as well
yaml reloading only works if the integration supports yaml reloading. If you add an integration for the first time, you have to restart HA.
After that, a button will appear on the reloading page if the integration supports it. If it does, the reload button at the top will work.