arendst / Tasmota

Alternative firmware for ESP8266 and ESP32 based devices with easy configuration using webUI, OTA updates, automation using timers or rules, expandability and entirely local control over MQTT, HTTP, Serial or KNX. Full documentation at
https://tasmota.github.io/docs
GNU General Public License v3.0
22.04k stars 4.78k forks source link

can Gpio switch not direct action? #84

Closed hamwong closed 7 years ago

hamwong commented 7 years ago

can Gpio switch not direct perform relay action and publish status to MQTT?

davidelang commented 7 years ago

I think it does that if it's not able to reach a mqtt server

hamwong commented 7 years ago

on my test environment, I got MQTT online, only result is switch direct turn on/off relay and post MQTT, I wish there is an option don't switch relay and post MQTT, let server - openhab decide on or off,

davidelang commented 7 years ago

you can set the button to send a different message, that's what the switchtopic is for.

set the button to send a different topic and openhab will make the decision.

hamwong commented 7 years ago

Thanks @davidelang, as too many commands, and not much description on command usage, I didn't aware switchtopic for this usage, another issue come, is this is a bug or limit as if I got 2 gpio set for same function(switch). only one of gpio will work, other one won't function,

I set as below: {"GPIO3":9 (Switch), "GPIO4":0 (None), "GPIO14":9 (Switch)} than only GPIO14 works, GPIO3 no response, or the other way around.

I like to set itworks as below condition, GPIO14 connect to HC-SR501 PIR and work with MQTT (openhab), and GPIO3 work with wall switch (direct control), so that user may manually overide on/off and not from PC/mobile.

as far as I test, I only may work out as switch + DHT22 on GPIO 3,14, but not both switch.

Nayar commented 7 years ago

https://github.com/arendst/Sonoff-MQTT-OTA-Arduino/issues/158

I injected some codes into the firmware that read the GPIO then published on /stats/sonoff/GPIO topic. Then I could implement this: https://nayarweb.com/blog/2017/iot-series-smart-lightsensors-in-the-kitchen/

I need to rewrite the patch and maybe merge it upstream

hamwong commented 7 years ago

Hi @Nayar Thanks, I am so excite that this feature will come, I look at #158, does that mean I can assign GPIO14 connect to HC-SR501 PIR and work with MQTT (openhab), and GPIO3 work with wall switch (direct control)?