arendst / Sonoff-MQTT-OTA-Arduino

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

Help: Get only state of GPIO #158

Closed Nayar closed 7 years ago

Nayar commented 7 years ago

Hi,

I am connecting a HC-SR501 to my sonoff. However I wish to send the state only via MQTT so that my external server can decide what to do. e.g. it makes no sense to power on lights during the day when motion detected. I want my logics to be on the server-side.

The closest I've seen in the configs is #define USE_WALL_SWITCH. Is there an option that when activated, only sends something like /stat/GPIO ON or something. An option like STAT for SWITCH_MODE would be great.

arendst commented 7 years ago

Define a ButtonTopic and you'll receive a cmnd/\<ButtonTopic>/POWER message when USE_WALL_SWITCH is enabled.

arendst commented 7 years ago

See #141 too

Nayar commented 7 years ago

Unfortunately it changes the topic of the physical button of the sonoff itself. I'll try to see what can be done