Hi there,
I have a strange problem with my setup, I tried many time to search on the forum or on the web but none of other topic help me as well… The problem is this: When the Sonoff reboot (caused it crashes or simply loose connection to my router) and reconnect to my MQTT server on Hassio it turn ON the relay and than immediately OFF, causing my garage to open randomly :S I have the Sonoff Pro 4ch, and ad I can see in the log page of tasmota this problem is only on the relay where I connect my garage (I mean that if I change to relay3, modifying my configuration from POWER4 to POWER3 the problem goes to relay3.
This is my configuration:
#MQTT
mqtt:
broker: !secret mqtt_broker
port: !secret mqtt_port
client_id: home-assistant-1
keepalive: 60
username: !secret mqtt_username
password: !secret mqtt_password
protocol: 3.1
discovery: true
discovery_prefix: homeassistant
birth_message:
topic: "tele/hass1/LWT"
payload: "Online"
qos: 1
retain: true
will_message:
topic: "tele/hass1/LWT"
payload: "Offline"
qos: 1
retain: true
# Script
script: !include_dir_merge_named script
# Switch
switch: !include_dir_merge_list switch
# Cover
cover: !include_dir_merge_list cover
Cover:
- platform: template
covers:
saracinesca:
friendly_name: "Saracinesca"
value_template: >-
{% if is_state('binary_sensor.door_window_sensor_158d0001fd6296', 'on') %}
open
{% else %}
closed
{% endif %}
open_cover:
service: script.attivagarage
close_cover:
service: script.attivagarage
stop_cover:
service: script.attivagarage
icon_template: >-
{% if is_state('binary_sensor.door_window_sensor_158d0001fd6296', 'on') %}
mdi:garage-open
{% else %}
mdi:garage
{% endif %}
Switch:
- platform: mqtt
name: "Sonoff Garage 1"
command_topic: "cmnd/garage/power1"
state_topic: "tele/garage/POWER1"
availability_topic: "tele/garage/LWT"
qos: 1
payload_on: "ON"
payload_off: "OFF"
payload_available: "Online"
payload_not_available: "Offline"
retain: false
- platform: mqtt
name: "Sonoff Garage 2"
command_topic: "cmnd/garage/power2"
state_topic: "tele/garage/POWER2"
availability_topic: "tele/garage/LWT"
qos: 1
payload_on: "ON"
payload_off: "OFF"
payload_available: "Online"
payload_not_available: "Offline"
retain: false
- platform: mqtt
name: "Sonoff Garage 3"
command_topic: "cmnd/garage/power3"
state_topic: "tele/garage/POWER3"
availability_topic: "tele/garage/LWT"
qos: 1
payload_on: "ON"
payload_off: "OFF"
payload_available: "Online"
payload_not_available: "Offline"
retain: false
- platform: mqtt
name: "Sonoff Garage 4"
state_topic: "tele/garage/POWER4"
command_topic: "cmnd/garage/power4"
availability_topic: "tele/garage/LWT"
qos: 1
payload_on: "ON"
payload_off: "OFF"
payload_available: "Online"
payload_not_available: "Offline"
retain: true
Script:
attivagarage:
alias: "Apri-Chiudi"
sequence:
- service: switch.turn_on
data:
entity_id: switch.sonoff_garage_4
I set in tasmota console:
PowerOnState 0
PowerRetain 0
When this appen, I mean the garage Open/Close randomly I see that “mosquitto_sub -h MYIP -p MYPORT -u MYUSER -P MYPASSWORD -t cmnd/garage/power4” send me an answer ON. For remove the saved state I use this command “mosquitto_pub -h MYIP -p MYPORT -u MYUSER -P MYPASSWORD -d -n -r -t cmnd/garage/power4” where -n sends an empty key and the -r store this change permanently as the wiki say.
I hope that some one can help me to understand wits wrong here…