I want to read in a value for 'deep sleep via mqtt, then set it and delete the topic. This value is set via an automation at a certain time.
My problem is that on_value is executed all the time (loop) and does not exit. Is there any way to solve this? Also the attempt to solve it via on_value_range does not work.
log:
[22:38:18][D][sensor:124]: 'Sleep time long': Sending state 1.00000 min with 0 decimals of accuracy
[22:38:18][V][mqtt:414]: Publish(topic='esp-dht11-01/sensor/sleep_time_long/state' payload='1' retain=1)
[22:38:18][V][sensor:074]: 'Sleep time long': Received new state 1.000000
[22:38:18][D][sensor:124]: 'Sleep time long': Sending state 1.00000 min with 0 decimals of accuracy
[22:38:18][V][mqtt:414]: Publish(topic='esp-dht11-01/sensor/sleep_time_long/state' payload='1' retain=1)
[22:38:18][V][sensor:074]: 'Sleep time long': Received new state 1.000000
... ...
esphome:
sensor:
- platform: mqtt_subscribe
name: "Sleep time long"
id: sleep_time_long
unit_of_measurement: min
accuracy_decimals: 0
topic: esp-dht11-01/sensor/sleep_time_long/state
on_value_range:
- above: 0
then:
- logger.log: "neue sleep_time_long!"
- mqtt.publish:
topic: esp-dht11-01/sensor/sleep_time_long/state
retain: true
payload: ""
- delay: 1s
- lambda: |-
id(this_deep_sleep).set_sleep_duration(id(sleep_time_long).state * 1000 * 60);