Blind motor has auto cut off, is there an app that can track its position?


(Dan Shepherd) #1

Guys,

I have a blind on a motor which has a physical switch on, when it flicks the switch it powers itself off, the next time you provide it with power it’ll reverse direction (eg open or close).

Obviously these means you have to turn the power off to it and then back on again to trigger the opposite motion. I have this working by employing an app which turns my switch off after 14 seconds after the blind has finished its job, then the next time you turn it on it’ll work the opposite way.

The problem with this is none of my scenes etc have any idea if the blind is open or closed, so they’ll just turn it on regardless, which might do the opposite of what you want (especially at night)

So is there a smartapp out there where I can tell it if the blind is open or closed from the start and from then on, it’d be able to track its position by always knowing it just moved the opposite. It would also need to do power shut off after 14 seconds as well I guess, but ideally the Smartapp could report it as open and closed to ST so that if a command to close it was sent and it was already closed, it obviously wouldn’t open it.


(William S.) #2

I can’t say for sure but have you taken a look at Rule Machine?

You may be able to get away with making rules and triggers to power on the switch for the time and utilize a open close sensor with the magnet attached to the blinds somewhere.


(Dan Shepherd) #3

Yeah I thought about using the open/close sensor but it seemed like overkill when really just telling an app what state the blind starts in (open or closed) should be enough to track it - Logitech Harmony is able to do this with infrared equipment and it has the same caveat that it’ll only get confused if you go and change it with a different remote.

Also the blind tends to move how much it opens and closes so I cant reliably say the open/close sensor would ever be reliable enough - also it would be ideal for integrating into Homekit if it was possible to report this as a switch (even if it were a virtual switch) where off closed and on it open.


(William S.) #4

Actually, since you mentioned it, would it work if you added in a virtual switch to represent the open close state of the blinds?

Because rule machine can toggle states, you can have it switch on/off the motor and also toggle the virtual switch at the same time.


(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #5

Do you have the Brand and Model of the blind? It’s sometimes worth researching if there are any further specifications for the control.

Adding a sensor of some sort is really the best way to track the state…

Regardless … keeping track of the state of the Blind inside SmartThings can perhaps best be done via a Custom Device Type … SmartApps can maintain State, but it is more logical, in many cases, to keep the information as close to the “device” as possible. In other words, I would recommend cloning the basic Switch device type you are using (ZigBee?) and overwriting the code to refuse to accept multiple “on()” or “off()” commands … i.e., only allow alternate commands to affect the State. Ummm… well, it’s a lot easier to describe in context of a particular SmartApp that will use this new Custom Device Type.

Let me know some example SmartApps that you would be running and for each, whether it should lower or raise the blind.


(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #6

Sorta what I was hinting at. In fact, you could perhaps use a Virtual Device of Capability “Door” … since “Door” has both open / closed, as well as “opening / closing” …

But, I’d still like to see if all the logic can be put in the Device Type itself, that way it can work with any SmartApp, not just Rules Machine!


(Dan Shepherd) #7

Ah no, the blind is a standard blind, with a very simple motor that I bought from eBay which connects to the pully cord and opens and closes it. It came with a remote, but it also has various other options. It changes directions by a simple limit on the motor which turns a switch when it reaches the limit (up or down) and turns the motor off.

Its only controlled with a SmartThings socket. As soon as you give it juice again it starts the motion the opposite way. As I pointed out though, the socket has to be turned off first, then turned back on again for this to work. So i currently just send an on command, which turns the swtich on for 14 seconds at which time the blind has finished and it then it only needs another one command to send it the other way.

The idea behind having a hacky virtual switch which set open/closed based on on/off would be so I could add it to homekit via homebridge (which only supports on/off switches from SmartThings anyway) and that way I can set a scene to turn the blind “off” when I want it closed - and just like another other switches if it is already “off” (closed) then it wont do anything…at the moment with this solution it toggles the current state, which obviously means sometimes “good night” ends up opening the blind if you’ve done it already!


(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #8

Yup… So to avoid having to create a special SmartApp that manages the state of this “Virtual Switch” and tries to keep everything in sync; I recommend hacking an actual copy of the SmartThings ZigBee outlet code to directly add logic to it’s “on()” and “off()” Commands. i.e., the “on()” Command will just exit if the blind is already considered to be “on”, and similar with “off”.

Let me know if this make any sense… I can paste a code snip or even a GitHub link with a test Device Type Handler, but it’s best we get on the same page with the concept first; and that way you probably can edit, debug, and tune the Device Type Handler on your end as well.

Feel free to Private Message also, and/or we can find a time to Skype.


(Dan Shepherd) #9

Thats awesome, really appreciate it.

Definitely understand what you mean by modifying the device type and I agree thats the way to go - not sure how i’ll be able to do the on/off modifications yet, but i’ll get the socket up in device types first and have a little play to see first then let you know.


(Dan Shepherd) #10

Went sleep last night as it was late UK time, but thinking about the device setting, not sure if this is possible but realised the easiest way to do what I want would be this.

On = closed
Off = open.

Have the blind open, and program so that on, on the device, provides 14 seconds of power and then switches off, the switch remains as ON in ST.

Switch it off would provide 14 seconds of power again and leave the switch as reading off.

This way up and down are always in sync (off is up, on is down) and it can be triggered from Homekit easily enough too (though you’d have to say “blind on” if you wanted to control it directly so setting up a Homekit scene would be the best way around that)

Is that possible with the device type @tgauchat?


(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #11

Very likely possible, but a couple catches before attempting to program:

  1. Consider that “on” typically indicates that a light is on, so it may be better to use on = open, off = closed. Then a SmartApp that is designed to turn “on” lights in the morning would result in “opening” the shade.

  2. SmartThings has difficulty with precise timing (heck, anything less than 60 seconds in some scenarios?) “14 seconds” may be difficult to reliably achieve. I have a projector screen for which leaving the power “on” indefinitely does not cause a problem … the motor automatically shuts off when the screen is fully up or fully down and no longer uses any power. Could the “14 seconds” be ignored and the power continuously applied?

Item #1 is arbitrary and easy to switch from one term to the other.

Item #2 requires some debugging of the quirks related to SmartThings action scheduling. A “delay between” command execution is supposed to be consistently possible. This will be a good time to find out what the fuss is all about.


(Dan Shepherd) #12

Re One. Yep that makes sense. Lets get it set up right for ST as Homekit will always see it as on/off regardless.

Two. Sure, exactly like your projector it shuts itself off once its open or closed and uses no power - its just to trigger it again you’d have to actually turn the power and back on again (so like an off/on) but of course that could be programmed too I guess, so instead of the 14 seconds things it would be just be off/on for every off or on again (that makes a lot more sense when its not written in words!)


(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #13

I think we’re all set to give it a try then!

If you want to start (or I can post code…) I suggest copying the ZigBee Switch Handler and renaming the existing on()/off() methods, then adding your own. That way your own can have the extra state check and off+on, etc., but it calls the originals to do the actual work…


(Dan Shepherd) #14

Yep you’ll have to give me a pointer here, best to do it over Skype then come back here and post the working code for anyone in a similar situation? (I guess this would for any motor which is triggered by an on/off switch, like blinds or a projector)


#15

Hi. I have the same motor on the way. Were you able to develop something? Thanks.