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.2k stars 4.81k forks source link

[Sonoff Basic] How to get a TRIGGER (high-low) on GPIO14 to ONLY send MQTT message? #2740

Closed hvanmegen closed 6 years ago

hvanmegen commented 6 years ago

I'm trying to figure out a way to have a simple Radar sensor (The RCWL-0516) that goes high (3.3v) on GPIO14 only send a message to my MQTT broker and NOT switch my relay (that powers some LED lighting).

I only want it to send a MQTT message stating these pin states (1 when it's triggered (high, 3.3v) and 0 when it's back low (low, 0v) again). I don't want anything to happen locally with the relay, schedule or anything else.

Having it set up as button 2, 3 or 4 doesn't send an MQTT message, and having it set up as a switch doesn't work either; this only switches my relay on and off whenever I move...

The reason that I don't want that sensor to do anything locally is because all relay switching logic is handled externally over MQTT; I only want to use the Sonof basic as a simple MQTT enabled relay AND a single GPIO pin MQTT message sender whenever the pin goes high and back low again.

I tried looking it up in the documentation, but I'm not entirely sure how to handle this.. isn't there a simple sensor like a PIR that pulls high when it detects motion and then drops back to low a second or so later after the trigger has been sent?

Which one should I use? I can't seem to find the correct one.

wongnam commented 6 years ago

Wiki has all about what you need

https://github.com/arendst/Sonoff-Tasmota/wiki/Understanding-SwitchMode-and-SwitchTopic

Think about switchtopic and switchmode

hvanmegen commented 6 years ago

Aaah!! I have it switch switch2 to MQTT only by changing the SwitchTopic and SwitchMode!

Perfect, thanks for the help!

curzon01 commented 6 years ago

@hvanmegen - beside oneself with joy don't forget to close issues if it it solved - you opened it, you close it :wink:

danst0 commented 5 years ago

The wiki link is dead and I still do not get it. I changed the GPIO14 now to Switch2 but all messages in MQTT/console are still the same and power goes low after two seconds or so.

meingraham commented 5 years ago

@ascillato - can this page -(https://github.com/arendst/Sonoff-Tasmota/wiki/Understanding-SwitchMode-and-SwitchTopic) be restored?

@danst0 - I believe that the page basically just links to this video.

ascillato commented 5 years ago

@meingraham

Hi, the wiki page for buttons and switches has been renamed by @casper to https://github.com/arendst/Sonoff-Tasmota/wiki/Buttons-and-Switches

That is the new link to that page. It is in the sidebar of the wiki too. Now, I think it is better organized, so I agree with the change from @casper.

Hope this helps people reading the wiki ;)