My Garge Switch is a pushbutton
its was I first thing I Tasmota so it only had 5.10.0b Had a Idea can I do a long Press and turn ON/OFF the workshop lights
1st upload New verson of tasmota Tasmota latest
- get the sonoff-minimal.bin and the Latest my case 6.2.1
- upload minimal first then upload the latest
it work!! didnt have to take out of the wall
Now go into the Console
we need to change the switchmode
as we want to change switch1
so we just type in “SWITCHMODE1 5” = Set switch mode to PUSHBUTTON (Normally 1, 0 = toggle, Hold = hold)
now we need to change its Topic
so type in “SwitchTopic 1” = Set MQTT switch topic to Topic
and we also need to change the setoption32
I want to hold the button for 4 sec and do its thing
we just type in setoption32 4
now my log say
10:31:14 MQT: cmnd/SONOFF5/POWER1 = ON
10:31:14 MQT: stat/SONOFF5/RESULT = {"POWER":"ON"}
10:31:14 MQT: stat/SONOFF5/POWER = ON (retained)
10:31:17 MQT: cmnd/SONOFF5/POWER1 = OFF
10:31:17 MQT: stat/SONOFF5/RESULT = {"POWER":"OFF"}
10:31:17 MQT: stat/SONOFF5/POWER = OFF (retained)
10:31:19 MQT: cmnd/SONOFF5/POWER1 = HOLD
10:31:19 MQT: stat/SONOFF5/RESULT = {"POWER":"OFF"}
10:31:19 MQT: stat/SONOFF5/POWER = OFF (retained)
10:31:22 MQT: cmnd/SONOFF5/POWER1 = ON
10:31:22 MQT: stat/SONOFF5/RESULT = {"POWER":"ON"}
10:31:22 MQT: stat/SONOFF5/POWER = ON (retained)
10:31:25 MQT: cmnd/SONOFF5/POWER1 = OFF
10:31:25 MQT: stat/SONOFF5/RESULT = {"POWER":"OFF"}
10:31:25 MQT: stat/SONOFF5/POWER = OFF (retained)
10:31:27 MQT: cmnd/SONOFF5/POWER1 = HOLD
10:31:27 MQT: stat/SONOFF5/RESULT = {"POWER":"OFF"}
10:31:27 MQT: stat/SONOFF5/POWER = OFF (retained)
NOTE the cmnd/SONOFF5/POWER1 we have to change HA to this
In the light section
- platform: mqtt
entity_id: GarageLight
name: "Garage"
friendly_name: "Garage Lights"
state_topic: "stat/SONOFF5/POWER"
command_topic: "cmnd/SONOFF5/POWER1" # was cmnd/SONOFF5/POWER
payload_on: "ON"
payload_off: "OFF"
now we add a sensor to read the command_topic
but in HA we put it in the state_topic:
in the sensor section
- platform: mqtt
name: "Garge Light"
state_topic: "cmnd/SONOFF5/POWER1"
qos: 1
expire_after: "1" # Forget what just happen
note expire_after: this just expire the sensor value back to Unknown
so we dont have to right a automation to set it out of the HOLD
Now the fun bit the Automation
- id: 'hold garge light'
alias: Hold Garge Light
initial_state: true
trigger:
- entity_id: sensor.garge_light
platform: state
to: 'HOLD'
action:
- data:
entity_id: light.workshop
service: light.toggle
NOW when I long PRESS the garage light the workshop light toggle
well that has save me 3 steps