I’m looking for some help. I have a window blind that I’ve automated using a servo and automation within Home assistant but I’ll looking to upgrade to include a physical button and my mind is drawing a blank.
basically I have a rocker switch, if I press “up” I’d like the blind to open to a set location, if I long press “up” I’d like it to open until I release the button.
If I press “down” I’d like it to close the blind fully and if I long press “down” I’d like it to close until I release the button.
I can’t work out how to have the button control the servo. .
on_press and on_release should be able to handle the set location, while on_click , on_multi_click or on_double_click could be used for fully open or fully closed.
I would seriously aboid using a rocker switch for this use. You could do it, i just dont think its a very user-friendly method for other people. I guess it depends on whether or not its a "“locking” switch or a “momentary” switch. If you push it one direction, does it lock in that position? If it does, i highly recommend you dont utry using that as a “push and hold”. You need a momentary switch for this, 100%
After that its like the other person said, binary_sensor.
This isn’t exactly what you need but, this should give you a good idea with yours.
I used buttons which you could use as well for a HA front-end control Up/Down. Just a thought…
For binary sensor you’d just use the button automation the same way. You’d also have to use automatons like this. This way your not locked into a min/max time limit. Push and hold as much or little as you want.
Thank you Falling Away and Shadow Fist. Sorry for the Delay in replying I’ve been away from home due to work so projects like this can take me months.
I’m still struggling though… perhaps I’m not understanding what you have kindly shared or perhaps I am not explaining what I am looking for properly. I’m going to assume it’s me…
What I am looking to achieve is to have a physical, momentary rocker switch attached to the GPIO pins of a D1 Mini, to control a servo, Idealy, I’m looking to limit the opening to -12 (total movement range is -100 to 100) but close to the max 100.
I’ve tried and looked into the example you have shared but I see no way to link that to a GPIO lin location for the trigger, I already have buttons in HA that I can use to control the servo from there and via automation but I’m trying to upgrade it to include a physical button (i.e. make it wife friendly).
This is my D1mini with all connected wires, for some reason i dont have anything connected to D2 or D3 and now im not sure why.
I followed a tutorial on youtube to get the servo (attached to a blind) to work. Everything works through HA and my automations work, i just cant get a physical button added for some reason.
I’m trying to find the tutorial I followed but it was a while ago…
Ok. It’s still not clear to me what the servo should do when you push your momentary switch. Move to defined position, or move until you release the button?
Short press up, the blind will open to a fixed position (say -12).
Long press up, the blind will keep opening untill either it hits -100 or i release the switch, whichever happens first.
Short press down, the blind will close all the way.
Long press down, the blind will close all the way or untill i release the switch, whichever happens first.
If that is not possible, then im looking to at a minimum achieve the short press functions if possible.
It’s beefy servo, how is your power supply for it?
Try this code, at the moment there is no “manual adjustment” just open and close.
But we can easily add it in multiple ways.
I have no idea what your home assistant service code does.
Thank you that works!! one small bug with it (but I can easily live with it) when it’s open, if I press “open” again, it closes and on occasion when I press “open” after about 30 seconds or so it closes. Like I said though I can easily live with this my guess is that I need to check the wiring.
if I remember correctly the service code is to allow home assistant to see it and let me create automation.