vbPhil Posted January 18, 2023 Share Posted January 18, 2023 (edited) Not sure I'm asking this correctly but here's what I got. This z-wave switch, Aeotec Heavy Duty Smart Switch Gen5 US, is in my IoX and it has 6 nodes. As seen in the Admin Console one node is the actual switch with a Status attribute and On, Off buttons. The other nodes may or may not have any attributes shown. One node labeled, Energy Meter, has 4 attributes: Total Energy, Current Power, Current Voltage, Current Current. In HA I'm getting the switch node showing as a switch entity and behaves as a typical on/off switch. The Energy Meter node, however, is labeled as a sensor entity but is "unknown" and isn't showing any of the associated attribute values. Image from HA Settings/Devices I see that I'm able to access these attributes, i.e. the Energy Meter,Total Energy, like in an automation as: state_attr('sensor.zy_023_energy_meter','total_energy_used') What is the best way to approach z-wave devices like this and have HA show these attributes, like on a dashboard, where's it's keeping history on the value of the attribute? Would it be best to add a Sensor template to configuration.yaml for each of these attributes. Like quoted below? Or is there a preferred way that provides for other usages of the entity that I'm not familiar with yet? Quote template: - sensor: - name: "Total Energy" device_class: power state: > {{ state_attr('sensor.zy_023_energy_meter','total_energy_used')}} availability: > {{ not 'unavailable' in ('sensor.zy_023_energy_meter','total_energy_used')}} Edited January 18, 2023 by vbphil typo Link to comment
shbatm Posted January 19, 2023 Share Posted January 19, 2023 7 hours ago, vbphil said: Would it be best to add a Sensor template to configuration.yaml for each of these attributes. Like quoted below? Or is there a preferred way that provides for other usages of the entity that I'm not familiar with yet? Yes, that's the best way (for now) https://www.home-assistant.io/integrations/template/#state-based-sensor-exposing-sun-angle The sensors behave like that because they don't have an actual State value and the integration doesn't understand the details of the Z-Wave device. It's looking for a 'ST' value to show as the main state, but only getting the other attributes like 'Total Energy'. In a future update, there are plans to support these directly but the template is best for now. Link to comment
Recommended Posts