Hi everyone (i’m sorry for my bad english), I would like a hand to configure two sonoffs with tasmota, I need to open a gate (first sonoff button) and at the same time to turn on a light that after 15 minutes must be turned off (sonoff number 2, switch)
You need to give us some more information but, with what i have:
switch:
- platform: mqtt
name: "sonoff_1"
state_topic: "stat/sonoff_1/POWER"
command_topic: "cmnd/sonoff_1/power"
availability_topic: "tele/sonoff_1/LWT"
qos: 1
payload_on: "ON"
payload_off: "OFF"
payload_available: "Online"
payload_not_available: "Offline"
retain: false
- platform: mqtt
name: "sonoff_2"
state_topic: "stat/sonoff_2/POWER"
command_topic: "cmnd/sonoff_2/power"
availability_topic: "tele/sonoff_2/LWT"
qos: 1
payload_on: "ON"
payload_off: "OFF"
payload_available: "Online"
payload_not_available: "Offline"
retain: false
script:
turn_on_sonoff_2_for_15m_when_i_turn_on_sonoff_1:
sequence:
- service: switch.turn_on
entity_id: switch.sonoff_2
- delay:
seconds: 900
- service: switch.turn_off
entity_id: switch.sonoff_2
automation:
- id: '1542159999941'
alias: Automatic Sonoff 2 when Sonoff 1 is switched
trigger:
- entity_id: switch.sonoff_1 # this will trigger when you turn on sonoff 1
from: 'off'
platform: state
to: 'on'
- entity_id: switch.sonoff_1 # this will also trigger when you turn off sonoff 1
from: 'off'
platform: state
to: 'on'
condition: # This will check if it it's after sunset and before sunrise, replace with condition: [] if you dont want it
- condition: or
conditions:
- after: sunset
after_offset: '-1:00:00'
condition: sun
- before: sunrise
before_offset: '1:00:00'
condition: sun
action:
- data:
entity_id: script.turn_on_sonoff_2_for_15m_when_i_turn_on_sonoff_1
service: script.turn_on
Each part will need to go to the respective file of your configuration or as a whole within a package folder if you are working with packages.
Also, double check the entities, I might have forgotten to change everything as i copy/pasted it from my configurration.
Hope this covers your issue
hello thanks for your answer, after having confirmed your configuration gives me this error:
Invalid config for [script]: [turn_on_cancello_for_15m_when_i_turn_on_portone] is an invalid option for [script]. Check: script->script->script->turn_on_cancello_for_15m_when_i_turn_on_portone. (See /config/configuration.yaml, line 74). Please check the docs at https://home-assistant.io/components/script/ Invalid config for [automation]: [automation] is an invalid option for [automation]. Check: automation->automation. (See /config/configuration.yaml, line 73). Please check the docs at https://home-assistant.io/components/automation/
hi guys i found the solution there was a syntax error in
action:
- data:
entity_id: script.turn_on_sonoff_2_for_15m_when_i_turn_on_sonoff_1
service: script.turn_on
in practice I deleted the entry
- data: