Foltifeki
(Foltifeki)
July 15, 2022, 8:33pm
1
Hello
I would like to ask for help with the configuration
I use the local Tuya integration and I want to set a sensor for voltage, current and power, but it says that the configuration is invalid
- platform: template
sensors:
Smart_Plug_voltage:
value_template: >-
{{ states.switch.smart_plug.attributes.voltage }}
unit_of_measurement: "V"
Smart_Plug_current:
value_template: >-
{{ states.switch.smart_plug.attributes.current }}
unit_of_measurement: "mA"
Smart_Plug_current_consumption:
value_template: >-
{{ states.switch.smart_plug.attributes.current_consumption }}
unit_of_measurement: "W"
Tamsy
(Tamsy)
July 16, 2022, 3:28am
2
Use this:
- platform: template
sensors:
Smart_Plug_voltage:
value_template: >-
{{ state_attr('switch.smart_plug', 'voltage')|float(0) }}
unit_of_measurement: 'V'
Smart_Plug_current:
value_template: >-
{{ state_attr('switch.smart_plug', 'current')|float(0) }}
unit_of_measurement: 'mA'
Smart_Plug_current_consumption:
value_template: >-
{{ state_attr('switch.smart_plug', 'current_consumption')|float(0) }}
unit_of_measurement: 'W'
1 Like
Tamsy
(Tamsy)
July 16, 2022, 2:06pm
5
“Invalid slug for [sensor.template]…”
Upper-case/lower-case matters!
- platform: template
sensors:
smart_plug_voltage:
value_template: >-
{{ state_attr('switch.smart_plug', 'voltage')|float(0) }}
unit_of_measurement: 'V'
smart_plug_current:
value_template: >-
{{ state_attr('switch.smart_plug', 'current')|float(0) }}
unit_of_measurement: 'mA'
smart_plug_current_consumption:
value_template: >-
{{ state_attr('switch.smart_plug', 'current_consumption')|float(0) }}
unit_of_measurement: 'W'
1 Like