thehookup / Motorized_MQTT_Blinds

Motorized_MQTT_Blinds
293 stars 75 forks source link

Physical buttons #20

Open sajovicd opened 4 years ago

sajovicd commented 4 years ago

Hello,

I found this very useful, but in some rooms like toalet I would like to have also buttons for close and open shades. Is taht possible? How do you solve the problem where you dont have your phone or tablet at the hand and want to close the shades?

binaryn3xus commented 4 years ago

It should be possible to wire up a momentary button that could do this. This is actually a really good idea since for most people you have to remove the twist rod mechanism.

virtualJonesie commented 4 years ago

I'm working on this currently. I try to always have a non-phone, non-voice way to operate my smart devices. When I get this working, I'll post it here.

binaryn3xus commented 4 years ago

@virtualJonesie If you need someone to test, let me know. I just bought some momentary switches for this same issue.

virtualJonesie commented 4 years ago

I bought some of these a while back. My goal is to make one sire open, and one side close. They're momentary, SPDT rocker switches, and they just so happen to fit in the factory hole for the tilt rod mechanism. No permanent modification of the blinds needed.

https://www.digikey.com/short/z4v1pv

My blinds are the 2" faux wood blinds from Home Depot.

https://www.homedepot.com/p/Home-Decorators-Collection-White-Cordless-Faux-Wood-Blind-with-2-in-Slats-10793478184453/206301010

virtualJonesie commented 4 years ago

Here is my recreation of the original, with a SPDT rocker switch (linked above) included. I have not updated the code yet, but this should take care of the hardware side of things. Again, my plan is to use one side of the button for "open" and one side for closed, similar to the Home Assistant implementation created by The Hook Up.

MQTT-Blinds-2020-v1_bb

virtualJonesie commented 4 years ago

I made some very minor changes to the code. On button press, I have it publish either OPEN or CLOSE to the blindsCommand topic, depending on which button is pressed. Again, I'm using a SPDT momentary rocker switch, so one side is Open, one side is Closed. This way, the exisitng code handles the open/closing, and I don't have to check to see if the blinds are already in their desired state.

In the definitions section, I added definitions for the Button Pins

#define BUTTON_OPEN_PIN           D1
#define BUTTON_CLOSE_PIN          D2

In the setup() function, I set the modes to Input for those pins:

pinMode(BUTTON_OPEN_PIN, INPUT);
pinMode(BUTTON_CLOSE_PIN, INPUT);

And in the loop() function I added logic to react to button presses:

if (digitalRead(BUTTON_OPEN_PIN) == HIGH) {
    // Send a message to open the MQTT topic
    client.publish(USER_MQTT_CLIENT_NAME"/blindsCommand","OPEN");
}

if (digitalRead(BUTTON_CLOSE_PIN) == HIGH) {
    // Send a message to open the MQTT topic
    client.publish(USER_MQTT_CLIENT_NAME"/blindsCommand","CLOSE");
}
poggerb commented 4 years ago

I wish I had found this earlier.....

I didn't have the coding knowledge, so improvised, by setting up some Sonoff Basics as the triggers for each of the blinds. Automation in HA to monitor the State and then Action Call Service to open/close covers.

I'll have to get some switches and try your modifications. Would have saved me some time money.... haha.

binaryn3xus commented 3 years ago

@poggerb You bought Sonoff Basics for each blinds installation? Wow. You were determined my friend. haha.

OOIOIOO commented 2 years ago

Do not pull low, most pins on NodeMCU are already pulled high. as such u set them as input, and that pulls them high by itself, so u send ground to your button and connect button output to that pin. in your code you check if the pin is Low ..... and .... bob is your uncle. there are no resistors involved, no power being sent anywhere and no sending 5v to nodemcu which runs on 3.3v.

Dannzig commented 2 years ago

@virtualJonesie I too love automation, but have a wife and 2 daughters that get frustrated and need manual controls. Did your solution work? Do you have any video of the buttons in action?

rixmix123 commented 2 years ago

If you have zwave set up you could program a button from aqara for example to control them.

OOIOIOO commented 2 years ago

@virtualJonesie I too love automation, but have a wife and 2 daughters that get frustrated and need manual controls. Did your solution work? Do you have any video of the buttons in action?

bud I have wife and one daughter and I do a lot of this stuff :) My project went on many different tangents from this, due to very low torque of these motors I am using a different more expensive DC motor, that has no issues with any size of the blinds, as such I am using a dc controller with the same buck converter. I also upgraded the software a lot with a web server and such, if i have extra time ill post it one day, but that's going to be in future. As per buttons, as I previously described I'm setting pins D3 and D4 high in code, and connect ground directly to button(s) and output to D3 and D4, this way there are no resistors involved(I mean nodemcu's ones only). I am mounting the power supply and buttons in the bottom of the window, using ground allows me to bridge it directly to the buttons, and the network cable that runs to the blind only uses 2 wires for buttons and 3 for positive and 3 to ground. Its much simpler this way :)

Peterpc58 commented 1 year ago

I also upgraded the software a lot with a web server and such, if i have extra time ill post it one day, but that's going to be in future.

When do you have the time to post your upgraded software?

binaryn3xus commented 1 year ago

I also upgraded the software a lot with a web server and such, if i have extra time ill post it one day, but that's going to be in future.

When do you have the time to post your upgraded software?

My fork doesn't have physical button support but it has OTA built in. No Alexa support either. I just wanted to be able to update without taking down the blinds. So if that sounds okay to you here it is.... https://github.com/JoshuaGarrison27/Motorized_MQTT_Blinds