Open Nunsferatus opened 1 year ago
don't use states.switch.plant_lights.voltage, use this instead:
state_attr('switch.plant_lights', 'voltage')
p.s. it is better when you copy the code than upload a photo.
Thank you for your help.
I have made the adjustment that you suggested
now I'm getting an error saying “duplicate key”
Doing this in the configuration.yaml Is this the correct place?
Once again thank you.
He is the code:
sensor:
platform: template sensors: switch.plant_lights_voltage: value_template: >- {{ state_attr('switch.plant_lights', 'voltage') }} unit_of_measurement: 'V'
switch.plant_lights_current:
value_template: >-
{{ state_attr('switch.plant_lights', 'current') }}
unit_of_measurement: 'mA'
switch.plant_lights_current_consumption:
value_template: >-
{{ state_attr('switch.plant_lights', 'consumption') }}
unit_of_measurement: 'W'
On Mon, 21 Nov 2022 at 13:01, Marcin @.***> wrote:
don't use states.switch.plant_lights.voltage, use this instead:
state_attr('switch.plant_lights', 'voltage')
p.s. it is better when you copy the code than upload a photo.
— Reply to this email directly, view it on GitHub https://github.com/rospogrigio/localtuya/issues/1133#issuecomment-1321874136, or unsubscribe https://github.com/notifications/unsubscribe-auth/AT7H4ZFYJRFZWVY7HO3FCUDWJNI7LANCNFSM6AAAAAASFMM65M . You are receiving this because you authored the thread.Message ID: @.***>
maybe it's just my subjective impression, but this code looks strange to me. In my case the custom sensor looks like this:
template:
- sensor:
- name: "Socket Voltage"
state: "{{ float(states('sensor.smart_socket_voltage'), 0) / 10 }}"
unique_id: madre_gniazdkoV
unit_of_measurement: V
Let me start by saying that I'm a NOOB.
I've been trying to configure the sensors that I have in one of my plugs. I have tried everything that I could think of and I always get some kind of error. "Failed to restart Home Assistant The system cannot restart because the configuration is not valid: Integration error: sensor - Integration 'sensor' not found."
I'm really stuck and out of ideas. can anyone help me? It seems to work correctly in the template…
Thanks for the help