Hello I try to create a cost sensor but it doesn’t work. It still unvailable …
my code :
- name: "cout lave linge cycle euros"
device_class: monetary
unit_of_measurement: 'Euros'
unique_id: 7b95373c-b73a-11ec-b897-0242ac120002
state: "{{ (sensor.conso_lave_linge_cycle * input_text.cout_electricite)| float }}"
anyome can help me ? thx a lot
petro
(Petro)
May 19, 2022, 12:51pm
2
that’s not valid templating
both have to be accessed using states('entity_id')
and both need | float
after each one
like that ??
- name: "cout lave linge cycle euros"
device_class: monetary
unit_of_measurement: 'Euros'
unique_id: 7b95373c-b73a-11ec-b897-0242ac120002
state: "{{ states('input_number.consommation_lave_linge_cycle')| float * states('input_text.cout_electricite')| float }}"
You can test your syntax is the UI, go to developer tools / templates and paste that expression in there. When it works there, paste it back into the YAML
thx a lot !!! i Will test