Using a Tasmota Sonoff as a sensor in homekit

361 views
Skip to first unread message

Dylan Robinson

unread,
Jan 18, 2018, 12:12:26 PM1/18/18
to SonoffUsers
Hi guys,

I  have several sonoffs configured to control lights, but I want to use a sonoff as a sensor to alert me to a gate opening via homekit.

I want to connect a switch/reed switch between GPIO14 and gnd. I don't require the relay on the sonoff to operate. I just need to know the state of the switch.

Currently when I add a new sonoff to homebridge I do this by adding/duplicating ' SonoffMQTT_accessory.js ' . This works great but is there a way of changing the accessory type from a 'light' or 'outlet' to say a sensor so that I'm able to set it up and use differently in the 'home' app.

I've tried to compare the code to other accessories found here to see where the 'SonoffMQTT_accessory.js' file states it a light/power socket, thinking it might be an easy code change but a bit confused.

Is what I'm asking even possible, I've looked everywhere about adding other types of accessories but as I'm a complete novice to this and MMQT i've not found anything simple enough to follow.

Thanks in advance,

Dylan

Mike Roberts

unread,
Jan 19, 2018, 4:55:52 AM1/19/18
to SonoffUsers
Dylan

I wrote and instuctable on adding sensors that might help see:  https://www.instructables.com/id/Home-Automation-Sonoff-Tasmota-Sensors-LEDs-Develo/

You are probably best to keep the device type the same as the hardware as this will restrict the IO to the ones that are available.  However if you are connecting to a IO pin that is not normally available then you might need to change the device type - e.g. if you are soldering direct to an ESP8266 pin.  Type WeMos D1 mini gives you the most flexibility.
Tasmota is incredibly flexible.  For example you could remove the relay and its MOSFET driver chip and use that output as your reed input (with pullup resistor)

Note also that the Basic was proibably not designed for external connetions and I do not believe satisfys double isolation standards.  Hence treat any connections as mains. Alternatively (better) go for a low votlage board.

Mike
Reply all
Reply to author
Forward
Message has been deleted
0 new messages