I got a high skylight window (Velux) and installed a linear actuator to open and close it remotely. Open en closing works fine but when the window is locked it’s still possible to activate the cover. I mounted a simple doorsensor on the lock handle.
How do I code that the cover can’t be used if the handle is locked?
My code:
esphome:
name: keukenraam
esp8266:
board: esp01_1m
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
password: "**************************"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
manual_ip:
# Set this to the IP of the ESP
static_ip: 192.168.0.116
# Set this to the IP address of the router. Often ends with .1
gateway: 192.168.0.1
# The subnet of the network. 255.255.255.0 works for most home networks.
subnet: 255.255.255.0
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Keukenraam Fallback Hotspot"
password: "*************"
captive_portal:
output:
- platform: esp8266_pwm
pin: 2
frequency: 1000 Hz
id: sh_speed_pin
- platform: gpio
pin: 4
id: sh_direction_pin1
inverted: true
- platform: gpio
pin: 5
id: sh_direction_pin2
inverted: true
cover:
- platform: template
device_class: window
name: "Velux"
id: velux
open_action:
- output.turn_on: sh_direction_pin2
- output.turn_on: sh_speed_pin
- delay: 15s
- output.turn_off: sh_direction_pin2
- output.turn_off: sh_speed_pin
close_action:
- output.turn_on: sh_direction_pin1
- output.turn_on: sh_speed_pin
- delay: 15s
- output.turn_off: sh_direction_pin1
- output.turn_off: sh_speed_pin
stop_action:
- output.turn_off: sh_direction_pin1
- output.turn_off: sh_direction_pin2
- output.turn_off: sh_speed_pin
optimistic: true
binary_sensor:
- platform: gpio
pin:
number: 0
mode: INPUT_PULLUP
name: "sensor velux"
device_class: window