Hellow, how can I get a number getting into a text sensor?
You convert it to a string and publish it to the sensor or use a template text sensor.
What yaml have you got so far?
button:
- platform: restart
name: "$friendly_name Restart"
- platform: template
name: "code"
on_press:
- logger.log: Button Pressed
- lambda: |-
id(codetext).publish_state(id(code1).c_str());
number:
- platform: template
id: code1
name: $friendly_name code
step: '1'
min_value: '0'
max_value: '9999'
optimistic: True
mode: box
text_sensor:
- platform: template
id: codetext
name: "$friendly_name codetext
´´´
I want to use a text_sensor for arming and disarming an alarm_panel in Esphome.
I want to change the code by using the webserver.
I have a number: code1, and when i press the button I would like that that value is in to text_sensor: codetext
Please take a moment to figure out how to format your code properly…
button:
- platform: restart
name: "$friendly_name Restart"
- platform: template
name: "code"
on_press:
- logger.log: Button Pressed
- lambda: |-
id(codetext).publish_state(id(code1).c_str());
number:
- platform: template
id: code1
name: $friendly_name code
step: '1'
min_value: '0'
max_value: '9999'
optimistic: True
mode: box
text_sensor:
- platform: template
id: codetext
name: "$friendly_name codetext
´´´
I want to use a text_sensor for arming and disarming an alarm_panel in Esphome.
I want to change the code by using the webserver.
I have a number: code1, and when i press the button I would like that that value is in to text_sensor: codetext