I have a winch that I automated using HA. I’m currently using a time condition in my script to run the winch for x seconds to reel out the winch to the required point. I’m trying to find a way to tell HA that winch is at the point where it needs to stop. I first thought I could do this by cutting the power to the winch, but that won’t work.
Here is what I built to cut the power (which won’t work), the winch cable would run between the hoop with a stopper on it. The switch in the electrical box is a normally closed (NC) switch. When the stopper hits the loop it opens the circuit. Instead of cutting the power, I’m wondering if I can attach something to that NC switch that will broadcast a MQTT message when the circuit goes from closed to open. Does anyone know of something that will do that?
I’ve automated the grain dryer on our farm. We load 2,000 bushel of corn in the dryer (top portion of the bin). When the dryer stops the winch unreels to open the dryer floor and let the corn drop. If the winch failed to run the dryer would just stay closed. If the winch ran and didn’t stop we would just end up with an open dryer and a bunch of unwound wire. I still plan to keep the time condition in my script, but maybe make it “x+2” seconds instead of the current “x”. If the sensor fails the winch would just run a couple seconds too long. The winch is mounted about 5 feet up from the ground on the bin and there are never any kids around.
If you don’t want to mess about DIYing your own sensor the Shelly1 would also work with HA out of the box. No re-flashing required. https://shelly.cloud/shelly1-open-source/
I have heard of the Shelly1 before, but am not too familiar with it. Does it send MQTT messages? Or is there another way for it to communicate with HASSIO withoout relying on a cloud connection?
Would I just connect the 3.3V pin to one terminal on my NC switch and the gnd pin on the other NC switch terminal? Will the Shelly then see when that circuit goes from closed to open?
So, if I understand your question, you will not be using the switch to open the power to the motor?
You want a switch that can tell Home Assistant via mqtt if the switch is open or closed?
Just use a Wemos D1 Mini and Tasmota software. The Tasmota software defaults to a switch sensor so little setup would be needed- just your WiFi credentials and your mqtt broker credentials, plus a unique mqtt topic.
Or do I not understand your question?
Have you considered counting the revolutions of the drive pulley of the winch? This would give you a more granular feedback of the position.
You can configure Tasmota to use any available GPIO pin. D5 or D6 (GPIO 14 and 12 respectively) would be my preferred I/O pins.
On the winch, does the red part in the photo rotate? If so, then counting turns would be fairly easy, especially if you could attach hardware t the case above it.
The red part does turn, but this winch will be outside, exposed to the rain, a lot of dust, and other pretty bad conditions, so I’d be concerned about putting anything on the winch to count the rotations if it is sensitive to any of that.
I found a D1 Mini laying around and put Tasmota on it. Can you tell me what I should select in the tasmota config for the GPIO 12 and GPIO 14 pins?
given the nature of this i would suggest you design the circuit to fail safe (ie. off) and have multiple physical switches that all need to be closed to activate the motor.
much better for it to be dead in error than to be dangerous.
if you want to control and monitor this with one physical device a tasmotised sonoff basic should do it.
if you use RX (GPIO3) for your switches the sonoff wont even start up if the switches are commanding the motor to run. that way a power glitch is much less likely to lead to a uncommanded motor event. nice and safe.
to put HA (MQTT) in the middle (even safer still) change the switchtopic to one of your choosing with switchmode 7, this will decouple the relay and switch and set the switch to momentary.
@Jon_ctrl, I can appreciate the concern, but I assure you that very little could go wrong if this winch runs when we don’t expect it to. When the winch reels in (closing the grain dryer) it hits a gate that cuts power to the winch, so it can not reel in past a certain point. If the winch unexpectedly reel out it would just open the dryer and then unspool the cable after the dryer opened. At worst, we would have a load of wet corn dropped when we didn’t want it to be. Even then, it takes 10 minutes for the corn to drop, so we could catch it and shut it. Another reason I want HA to know that the dryer is open using a binary sensor.
We used this set up during the last harvest for 3 months. The only problem we had was that someone remotely opened the dryer (unreeled the winch) after someone else had already done so. It just unspooled some wire, but caused no damage. I’m trying to prevent that from happening again with this binary sensor that tells HA that the dryer is open.
There are Zigbee and Z-Wave door sensors with Reed Switches in them that you can probably bypass the same way I thought I needed to do it with the sensor of my alarm system:
I want to stick with a WiFi device using MQTT. My HASSIO box will be in a small shed, the D1 Mini will be in a weather tight electrical box mounted on a grain bin about 100 feet away. We use an external WiFi antenna on the shed to create a strong WiFi signal outside. I’m afraid a Z-Wave signal wouldn’t be strong enough.
I ended up getting this to work. I am connecting one wire of my switch to GND and one wire to D5 (GPIO 14) When the circuit is open I get “on” when it is closed I get “off”. Just what I need.
Here is my Config in Tasmota
And my configuration.yaml
binary_sensor:
- platform: mqtt
state_topic: "stat/dryeropensensor/POWER"
name: Dryer Open