Closed fraserp closed 1 year ago
@mykhailog might need to check I've used all the right units of measurements, and there might be some icon tweaking needed, but providing this as a starting point if anyone wants to add the sensor attributes to their overview dashboard or similar.
I added the following to my configuration.yaml:
sensor: - platform: waveshare_ups_hat binary_sensor: - platform: waveshare_ups_hat` template: - sensor: - name: UPS Capacity state: "{{ state_attr('sensor.waveshare_ups_hat', 'capacity' )}}" unit_of_measurement: '%' icon: mdi:battery-unknown - name: UPS PSU Voltage state: "{{ state_attr('sensor.waveshare_ups_hat', 'psu_voltage' )}}" unit_of_measurement: 'V' icon: mdi:lightning-bolt - name: UPS Load Voltage state: "{{ state_attr('sensor.waveshare_ups_hat', 'load_voltage' )}}" unit_of_measurement: 'V' icon: mdi:lightning-bolt - name: UPS Shunt Voltage state: "{{ state_attr('sensor.waveshare_ups_hat', 'shunt_voltage' )}}" unit_of_measurement: 'V' icon: mdi:lightning-bolt - name: UPS Current state: "{{ state_attr('sensor.waveshare_ups_hat', 'current' )}}" unit_of_measurement: 'mA' icon: mdi:current-dc - name: UPS Power state: "{{ state_attr('sensor.waveshare_ups_hat', 'power' )}}" unit_of_measurement: 'W' icon: mdi:power-plug - name: UPS Power Calculated state: "{{ state_attr('sensor.waveshare_ups_hat', 'power_calculated' )}}" unit_of_measurement: 'W' icon: mdi:power-plug - name: UPS Charging state: "{{ state_attr('sensor.waveshare_ups_hat', 'charging' )}}" unit_of_measurement: '' icon: mdi:battery-charging - name: UPS Online state: "{{ state_attr('sensor.waveshare_ups_hat', 'online' )}}" unit_of_measurement: '' icon: mdi:battery-charging-100 - name: UPS Low Battery state: "{{ state_attr('sensor.waveshare_ups_hat', 'low_battery' )}}" unit_of_measurement: '' icon: mdi:battery-low
yes, it looks good. The only one fix is to change 'v' to 'V'
Good spot, fixed
@mykhailog might need to check I've used all the right units of measurements, and there might be some icon tweaking needed, but providing this as a starting point if anyone wants to add the sensor attributes to their overview dashboard or similar.
I added the following to my configuration.yaml: