diff --git a/source/_integrations/vesync.markdown b/source/_integrations/vesync.markdown index 5a2cee259bb..5d564692c40 100644 --- a/source/_integrations/vesync.markdown +++ b/source/_integrations/vesync.markdown @@ -110,21 +110,17 @@ Adapted from the [TP-Link integration](https://www.home-assistant.io/integration {% raw %} ```yaml -sensor: - - platform: template - sensors: - vesync_switch_watts: - friendly_name_template: "{{ states.switch.vesync_switch.name}} Current Consumption" - value_template: '{{ states.switch.vesync_switch.attributes["current_power_w"] | float }}' - unit_of_measurement: "W" - vesync_switch_total_kwh: - friendly_name_template: "{{ states.switch.vesync_switch.name}} Total Consumption" - value_template: '{{ states.switch.vesync_switch.attributes["today_energy_kwh"] | float }}' - unit_of_measurement: "kWh" - vesync_switch_volts: - friendly_name_template: "{{ states.switch.vesync_switch.name}} Voltage" - value_template: '{{ states.switch.vesync_switch.attributes["voltage"] | float }}' - unit_of_measurement: "V" +template: + - sensor: + - name: "Vesync current comsumption" + state: "{{ state_attr('switch.vesync_switch', 'current_power_w') | float(default=0) }}" + unit_of_measurement: "W" + - name: "Vesync total consumption" + state: "{{ state_attr('switch.vesync_switch', 'today_energy_kwh') | float(default=0) }}" + unit_of_measurement: "kWh" + - name: "Vesync voltage" + state: "{{ state_attr('switch.vesync_switch', 'voltage') | float(default=0) }}" + unit_of_measurement: "V" ``` {% endraw %}