Hi,
I am trying to use an old shelly to work as I want with my PIR. As my PIR is not a momentary contact the shelly firmware is unable to properly cope with it. therefore I have created a ESPHOME config and flashed it.
Currently I am facing one last issue when I am trying to use an input number value as a delay.
substitutions:
device_name: haustur
device_description: "Haustür"
esphome:
name: ${device_name}
comment: ${device_description}
friendly_name: ${device_description}
platform: ESP8266
board: esp01_1m
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "jN6na5p8egGqmGyJ/="
ota:
- platform: esphome
password: "656546464"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Haustur Fallback Hotspot"
password: !secret ap_wifi_password
captive_portal:
# Enable Web server (optional).
web_server:
port: 80
# Text sensors with general information.
text_sensor:
# Expose ESPHome version as sensor.
- platform: version
name: ${device_description} ESPHome Version
# Expose WiFi information as sensors.
- platform: wifi_info
ip_address:
name: ${device_description} IP
ssid:
name: ${device_description} SSID
bssid:
name: ${device_description} BSSID
# Sensors with general information.
sensor:
# Uptime sensor.
- platform: uptime
name: ${device_description} Uptime
# WiFi Signal sensor.
- platform: wifi_signal
name: ${device_description} WiFi Signal
update_interval: 60s
switch:
- platform: gpio
name: ${device_description} Relay
pin:
number: GPIO4
id: shelly_relay
restore_mode: restore_default_off
- platform: template
name: ${device_description} Handsteuerung
id: manual
optimistic: True
turn_on_action:
- switch.turn_off: manualoff
- switch.turn_on: shelly_relay
turn_off_action:
- switch.turn_off: shelly_relay
- platform: template
name: ${device_description} Deaktivieren
id: manualoff
optimistic: True
turn_on_action:
- switch.turn_off: shelly_relay
- switch.turn_off: manual
binary_sensor:
- platform: gpio
pin:
number: GPIO5
name: ${device_description} PIR
on_press:
then:
- if:
condition:
and:
- switch.is_off: manual
- switch.is_off: manualoff
then:
- switch.turn_on: shelly_relay
- delay: 15s
# - delay: !lambda 'return id(light_time).state;'
- if:
condition:
- switch.is_off: manual
then:
- switch.turn_off: shelly_relay
id: button
number:
- platform: template
name: ${device_description} Timer
icon: mdi:timer
id: light_time
min_value: 15
max_value: 300
step: 15
mode: slider
restore_value: True
unit_of_measurement: "s"
optimistic: True
using 15s like in above code works like a charm. using however the lambda
- delay: !lambda ‘return id(light_time).state;’
fails not with a error, but the input number is not considered as seconds as far as I can see.
Any idea on how to solve that small issue?
BR,
Christian