Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use GPIO14 as a switch & get SAFE relay off #1991

Closed
Oxyandy opened this issue Feb 22, 2018 · 2 comments
Closed

How to use GPIO14 as a switch & get SAFE relay off #1991

Oxyandy opened this issue Feb 22, 2018 · 2 comments
Labels
stale Action - Issue left behind - Used by the BOT to call for attention

Comments

@Oxyandy
Copy link

Oxyandy commented Feb 22, 2018

Sonoff Basic - Sonoff-Tasmota 5.12.0
I need to stop a PulseTime(x) CYCLE instantly once a switch across GPIO14 changes from N/O to N/C.
I need SwitchMode 1 behaviour plus SwitchMode 0 direct relay control as a hybrid of the 2 for safety.

15:26:28 CMD: GPIO
15:26:28 MQT: stat/sonoff/RESULT = {"GPIO1":"0 (None)","GPIO3":"0 (None)","GPIO4":"0 (None)","GPIO14":"9 (Switch1)"}
15:26:30 CMD: SwitchMode
15:26:30 MQT: stat/sonoff/RESULT = {"SwitchMode1":1}
15:28:21 CMD: SwitchTopic
15:28:21 MQT: stat/sonoff/RESULT = {"SwitchTopic":"FLOAT"}

I am using Domoticz and 'currently' need to use a script to see change of switch state, which then turns the relay off.
This works as desired, but is not bullet proof.. Sometimes it lags, or say what if WiFi went down.. ?

The Switch across GPIO14 is for safety so must stop relay 'locally' (Not yet safe, reason for this post)
The switch across GPIO14 is also needed to log the state change - If no change, a fault generated.
So I need Domoticz to see the Switch state change as well.
Currently I seem to be able to have one or the other, not both.. ?
I compile bins so need a source change please, what line ;)
Thanks
++++++++++++++++++++++++++++++++++++++++++++
With SwitchTopic 1 - I get my switch change from N/O to N/C & instantly cuts the relay
(BUT only with my rule in Domoticz, not internal to Sonoff, can I change something to make cutting power to relay internal ?)

20:35:26 CMD: switchtopic 1
20:35:26 MQT: stat/sonoff/RESULT = {"SwitchTopic":"sonoff"}
20:35:31 MQT: domoticz/in = {"idx":4,"nvalue":1,"svalue":""}
20:35:31 MQT: stat/sonoff/RESULT = {"POWER":"ON"}
20:35:31 MQT: stat/sonoff/POWER = ON
20:35:42 MQT: domoticz/in = {"command":"switchlight","idx":11,"switchcmd":"Off"}
20:35:42 MQT: stat/sonoff/RESULT = {"POWER":"OFF"}
20:35:42 MQT: stat/sonoff/POWER = OFF

SwitchTopic 0 -- gives me local relay control instantly & internally to the Sonoff, without need for WiFi.
But my external float switch triggering the relay is missing in the MQTT output..
So my confirm "Did cycle work ??" is missing -If it fails a fault state (alarm) needs to be generated.
Plus because cause it's a float switch - it rises N/C, turns relay off, then as level lowers turns back on the relay N/O.

21:05:15 CMD: SwitchTopic 0
21:05:15 MQT: stat/sonoff/RESULT = {"SwitchTopic":""}
21:05:30 MQT: domoticz/in = {"idx":4,"nvalue":0,"svalue":""}
21:05:30 MQT: stat/sonoff/RESULT = {"POWER":"ON"}
21:05:30 MQT: stat/sonoff/POWER = ON
21:05:33 MQT: domoticz/in = {"idx":4,"nvalue":0,"svalue":""}
21:05:33 MQT: stat/sonoff/RESULT = {"POWER":"OFF"}
21:05:33 MQT: stat/sonoff/POWER = OFF

SwitchTopic 1 - 99.9% it's great, but not when there is lag or loss of wifi..
If either happened I would not be able to stop the pump in time & things would flood over.
...........
Options please
Can I declare my basic N/O - N/C Float Switch as a different device maybe a sensor on GPIO14?
cut power
Example of a float switch, N/O if level is high, becomes N/C if level lowers
My switch is mounted 180 degrees to this example, so can be N/C to N/O - or - N/O to N/C depending on it's orientation.

@Oxyandy Oxyandy changed the title How to use GPIO14 as a switch & get INSTANT relay off How to use GPIO14 as a switch & get SAFE relay off Feb 22, 2018
@stale
Copy link

stale bot commented Jun 20, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale Action - Issue left behind - Used by the BOT to call for attention label Jun 20, 2018
@stale
Copy link

stale bot commented Jul 5, 2018

This issue will be auto-closed because there hasn't been any activity for a few months. Feel free to open a new one if you still experience this problem.

@stale stale bot closed this as completed Jul 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Action - Issue left behind - Used by the BOT to call for attention
Projects
None yet
Development

No branches or pull requests

1 participant