home-assistant / home-assistant.io

:blue_book: Home Assistant User documentation
https://www.home-assistant.io
Other
4.76k stars 7.18k forks source link

Insufficient info #21564

Closed macf0x closed 2 years ago

macf0x commented 2 years ago

Feedback

Seems this page could be greatly improved. If your Individual device does not appear, there should be clear instructions on why.

In my case I had a dozen Tasmota powerplugs that refused to be listed, despite the state_class and device_class and native_unit_of_measurement being set correctly as per https://developers.home-assistant.io/docs/core/entity/sensor/#long-term-statistics, the powerplugs would not show.

Looking at other Zwave devices revealed it was necessary for the Entity to include '_kwh' in the ID to make it show.

URL

https://www.home-assistant.io/docs/energy/individual-devices/

Version

2022.2.5

Additional information

No response

frenck commented 2 years ago

In my case I had a dozen Tasmota powerplugs that refused to be listed, despite the state_class and device_class and native_unit_of_measurement being set correctly as per developers.home-assistant.io/docs/core/entity/sensor/#long-term-statistics, the powerplugs would not show.

That sounds like a bug, not something that needs to be documented.

Looking at other Zwave devices revealed it was necessary for the Entity to include '_kwh' in the ID to make it show.

That is not related at all.

Based on the above posted, it sounds like you are experiencing an issue and not lack of documentation.

macf0x commented 2 years ago

Thanks Frenck,

Probably so. I couldn't see any documentation or reference to the entity name needing to include '_kwh', but I could reproduce this across the ZwaveJS and Tasmota integrations. Tasmota and ZWave being popular components, I assumed this must be known behaviour, just not documented.

Simply renaming the entity dictated if it will show in the individual (energy) devices list. Assuming the device and state classes were set correctly, which both integration do. The Zwave Integration adds the the _kwh suffix to the entities by default, where as Tasmota doesn't. Perhaps this is why it hasn't gained much visibility.

Happy to troubleshoot further or see if someone else can reproduce.

CloCkWeRX commented 2 years ago

This is a little tricky to work out what criteria is considered supported, even for say custom component developers or people using the Integration plugin.

Examples from forums:

For example (note: I am not looking for support, just documenting the process I went through), reading through: https://developers.home-assistant.io/docs/core/entity/sensor/#long-term-statistics

  - platform: template
    sensors:
      localtuya_pc287ha_current_consumption:
        value_template: '{{ states.switch.pc287ha.attributes.current_consumption }}'
        unit_of_measurement: 'W'
        device_class: energy
      localtuya_pc191ha_current_consumption:
        value_template: '{{ states.switch.pc191ha.attributes.current_consumption }}'
        unit_of_measurement: 'W'
        device_class: energy
      localtuya_pc191ha_current_consumption_kw:
        unit_of_measurement: "kW"
        value_template: "{{ states('localtuya_pc191ha_current_consumption') | float * 0.001 }}"
      localtuya_pc287ha_current_consumption_kw:
        unit_of_measurement: "kW"
        value_template: "{{ states('localtuya_pc287ha_current_consumption') | float * 0.001 }}"
  - platform: integration
    name: "Washing machine current consumption (template integration)"
    source: sensor.localtuya_pc191ha_current_consumption
    unit_prefix: k
    round: 2
  - platform: integration
    name: "Fridge current consumption (template integration)"
    source: sensor.localtuya_pc287ha_current_consumption
    unit_prefix: k
    round: 2
  - platform: integration
    name: "Washing machine current consumption (template integration, calculated)"
    source: sensor.localtuya_pc191ha_current_consumption_kw
  - platform: integration
    name: "Fridge current consumption (template integration, calculated)"
    source: sensor.localtuya_pc287ha_current_consumption_kw

It's only by spying on the websocket behaviour itself that I see my sensors are probably right; just missing some filtering criteria like name:

{"type":"history/list_statistic_ids","id":27}
{"id":27,"type":"result","success":true,"result":[{"statistic_id":"sensor.co2_intensity","name":null,"source":"recorder","unit_of_measurement":"gCO2eq/kWh"},{"statistic_id":"sensor.power_production_now","name":null,"source":"recorder","unit_of_measurement":"W"},{"statistic_id":"sensor.power_production_now_2","name":null,"source":"recorder","unit_of_measurement":"W"},{"statistic_id":"sensor.localtuya_fridge_voltage","name":null,"source":"recorder","unit_of_measurement":"V"},{"statistic_id":"sensor.fridge_voltage_non_sensor","name":null,"source":"recorder","unit_of_measurement":"V"},{"statistic_id":"sensor.sensor_localtuya_pc287ha_current_consumption_integral","name":null,"source":"recorder","unit_of_measurement":"Wh"},{"statistic_id":"sensor.fridge_ma_integration","name":null,"source":"recorder","unit_of_measurement":"mAh"},{"statistic_id":"sensor.fridge_current_consumption_template_integration","name":null,"source":"recorder","unit_of_measurement":"kWh"},{"statistic_id":"sensor.washing_machine_current_consumption_template_integration","name":null,"source":"recorder","unit_of_measurement":"kWh"},{"statistic_id":"sensor.bentley_energy_meter","name":null,"source":"recorder","unit_of_measurement":"kWh"},{"statistic_id":"sensor.bentley_power_meter","name":null,"source":"recorder","unit_of_measurement":"W"},

From a documentation point of view, having a better idea of the filtering criteria - even if it were a link to relevant bits in github - this would probably lead to more insights.

At the moment, you can start with the integration plugin and get some historical statistics showing up from the documentation, in combination with the statistics card; but you don't get good insights why those statistics aren't suitable for the energy dashboard.

frenck commented 2 years ago

This is a little tricky to work out what criteria is considered supported, even for say custom component developers or people using the Integration plugin.

That is backward thinking. The developer documentation provides documentation for (custom) integration developers for all properties, including these. One does not implement long-term statistics, one provides correct data and data meta information. If this meta data is provided correctly, Home Assistant can decide if and how it would gather statistics for it.

It's not a toggle to turn on.

Added template sensors ontop of that to convert W to kW

Not sure, but all that isn't relevant or needed at all.

Again, if integration doesn't work with long-term statistics, the integration developer needs to check/review the properties it provides. It is missing metadata or provides incorrect property values. All those cases are things that need to be fixed on integration levels, not in templates or any other customization.

CloCkWeRX commented 2 years ago

The frontend filtering for individual devices is only discernable by reading the source; to discover kWh, and device class: energy is expected. I feel that's very much a gap in documentation that makes it very hard to discover mistakes.

The end user documentation covers:

You try a few times and then follow the UI links that suggest they will help with figuring out the problem: https://www.home-assistant.io/more-info/statistics/ (introduced in #18657)

You then experiment, and maybe you get some results in the gas consumption selector, which you wouldn't expect: image

But you don't get the same options in other areas (due to #10076).

You read the initial docs, then most users likely move straight onto the developer docs - either looking for more context or to create a proper bug report.

With the newer statistics developer tools, it's easier to at least see and understand if you are producing long term statistics and in a relevant unit; but once you have verified that you are often left in the dark as to why you appear to be doing "everything" necessary, but the UI doesn't display entities as selectable.

This second level of developer documentation doesn't do a good job either; as it focuses on the collection of statistics rather than the criteria the energy dashboard uses.

To improve this I'd really encourage: