Hello everyone,
I bought a Tuya socket with consumption measurement. It works, but the power information is in the attributes and not as separate sensors. I have created sensors for the information I need. However, these are “deviceless” and only exist as entities. Is it possible to add sensors to existing devices, similar to how the BatteryNotes integration does it?
The socket is controlled via LocalTuya.
Sensor Code:
- platform: template
sensors:
waschmaschine_power:
friendly_name: "Waschmaschine Stromverbrauch"
unique_id: "waschmaschine_power"
entity_id: switch.waschmaschine
value_template: "{{ state_attr('switch.waschmaschine', 'current_consumption') }}"
unit_of_measurement: 'W'
#device_class: apparent_power
waschmaschine_status:
friendly_name: "Waschmaschine Status"
unique_id: "waschmaschine_status"
value_template: >-
{% set power = states('sensor.waschmaschine_power')|float %}
{% if power == 0 %}
aus
{% elif power > 1 and power < 10 %}
wartend
{% elif power > 10 %}
läuft
{% endif %}