arendst / Sonoff-MQTT-OTA-Arduino

Provide ESP8266 based itead Sonoff with Web, MQTT and OTA firmware using Arduino IDE - Now EOL
618 stars 198 forks source link

Sonoff touch: multi press action #273

Open marcelveldt opened 7 years ago

marcelveldt commented 7 years ago

Not sure if I'm missing something or if this is a feature request... Besides some wifi son offs and the TH sonoffs I just recently received the sonoff touch modules which seem to be a great alternative for the expensive HUE switches or z-wave modules.

Just flashed your firmware on one of them and it's working really well.

One question however: Would it be possible to configure an alternative topic for a different button action ? For example 2 taps/presses of the button sends MQTT topic button2 or with a long hold of the button or something like that ?

In that case you can just tap the switch once to toggle the light connected to the relay but have another action to toggle a scene in the room with my home automation software (or another light in the room).

Crawling through the code and documentation I see you have some stuff prepared for this. Especially some button sequences that you can use to enable the config mode or reset the device etc.

Maybe, just maybe, this could also be something configurable (by the web interface?) Specify the command to be executed:

1x short press --> select action (default: toggle relay) 2x short press --> select action (default toggle mitt topic 2) long press --> select action

etc.

Maybe I can add this myself and submit a PR but in that case I could use some hints where to start looking as the code is a bit overwhelming for my limited C experience :-)

gajotnt commented 7 years ago

This FW sorta has what youre looking for i guess https://github.com/davidmpye/Sonoff-Touch-MQTT