mykhailog / hacs_waveshare_ups_hat

Waveshare UPS Hat integration for Home Assistant.
MIT License
19 stars 9 forks source link

Full set of attributes for Lovelace Card #4

Closed fraserp closed 1 year ago

fraserp commented 2 years 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
mykhailog commented 1 year ago

yes, it looks good. The only one fix is to change 'v' to 'V'

fraserp commented 1 year ago

Good spot, fixed