Ja zrobiłem tak:
W sensor.yaml
# Test
# switch.tuya_ha_local = gniazdko z local_tuya
# current_consumption = atrybut "watt"
- platform: template
sensors:
tuya_local_watt:
friendly_name: "Tuya local Watt"
unit_of_measurement: 'W'
value_template: "{{ state_attr('switch.tuya_ha_local','current_consumption') }}"
icon_template: "mdi:air-conditioner"
device_class: power
unique_id: tuya_local_watt
# watt na kWh
- platform: integration
source: sensor.tuya_local_watt # = wyżej utworzony sensor
unit_prefix: k
round: 2
name: Tuya Local kWh
unique_id: tuyalocalkWh
Otrzymałem:
Watt
kWh
Energia