Please help with ideas to newbie in HA.
I’m trying to introduce feedback/state control to RF433MHz/IR based switches that doesn’t have state control.
The solution is on picture.
Switch powers on some load (light bulb for example). It can be pressed manually or controlled externally, but can’t send any state/notification. I install sonoff basic in parallel with the load, i.e. when load is powered on- sonoff is powered as well.
This sonoff basic (with custom firmware) sends message to MQTT stat topic on start and continues sending these messages with some interval to handle cases when switch is pressed manually. Sonoff is not used as switch - only as a WiFi MQTT sender.
I’m trying to configure HA - add mqtt switch:
switch:
- platform: mqtt
name: "Light switch"
command_topic: "cmnd/switch/power"
state_topic: "stat/switch/power"
qos: 1
payload_on: "ON"
payload_off: "OFF"
retain: true
but I’ve faced some problems:
-
sonoff basic takes ~10 seconds to send first message after power- on. HA expects that message in state_topic is received within ~2 seconds after sending a command, message doesn’t arrive and switch returns to OFF state. Is it possible to extend this interval (clone some python source - switch component)?
-
I can’t send OFF state because sonoff is posered off (I’ve made some attempts with ESP.getVcc, extended capacitor in circuit etc- result is unstable). So the only solution I see is to somehow check that after power off is pressed - ping sonoff (or send MQTT message and wait 1 seconв for response) and if it is not available - threat switch as turned off.
-
I’d like to do an “error handling” - if command haven’t been executed (433RF/IR signal wasn’t read by switch) - it should be re-executed.
Is it possible to configure such behavior using existing Homeassistant functions?