So where is the demand to the motor object coming from? I.e the signals asking it to open/close/stop?
So where is the demand to the motor object coming from? I.e the signals asking it to open/close/stop?
I was purely intending for now to use this Motor Control object (which I've chosen the roller blind icon for in plan view) for local control. Ie, the Motor control object shows up in the Mobile UI as a Blind, which has the "Open", "Close" and "Stop" controls. Later I was going to likely connect this to the 2nd button on an SLD that controls the room lights too for non mobile-phone control (single press for "Open", double-press for "Close" or something I guess). ... I'd likely have some form of schedule for closing the blind overnight / opening in the morning, and maybe in this room, 1/2 closing when a brightness level is exceeded too.
Motor relay output connections and a 'Busy' connection have been added to the motor control object. The former depend on the state of the control relays so different relay configurations will give different behaviours, and the Busy output could be inverted to create a positive stop signal. You can find these changes in the latest development update.
Thanks Karam - appreciate the update
With this, I seem to be pretty much "there".
I've setup a Motor Control object which I've assigned the roller-blind icon to in Plan View, and set the "Motor running period" values to be 1 second more than it actually seems to take the blind to open or close. The blind itself has stop limits, so to achieve "Fully open" or "Fully closed", firing a single API's open or close command will do the job. With this, I've set the "Type of motor control" as "Pulse Relay 1 to close, Pulse Relay 2 to open" and setup connections such that the "Relay 1" trigger output triggers the "Open" API .. and "Relay 2" trigger output triggers the "Close" API.
This all works fine so far as the "Normal" use-case where the blind is simply opened in the morning and closed at night (I'm going to attach this to the outside "Dark" state shortly I think).
The final step was to allow for the odd occasion where someone might want to have the blind "Partly open / closed" .. following your suggestion, I've connected the "Busy (Output)" of the Motor control object to a General Logic gate that is an "OR" Function that Triggers its' Output based on "To False" ... the output connections here don't allow direct connection to the Web API Client .. so I've had to link it to start a Macro object that has a single step of Triggering the Web API Client to send the "Stop" REST API.
This seems to work "Okay", but there's one foible I can't fathom yet (albeit I can probably live with it) .. I see the following happen;
1. With the blind fully Open, I hit "Close" in the Motor Control - the blind starts closing
2. At any point part way closed, I hit "Stop". This seems to trigger the "Stop" command via the logic gate / macro and the blind stops
3. but then after this, the blind reverses direction for a short burst (1 or 2 seconds), then "Stops" again ..
Not sure if this is Cortex issuing the extra commands, or whether there's something in the downstream API layer causing this ... need to do a bit more digging
that problem sounds a bit like one that caused us a while ago to abandon the specific buttons we'd added to Cortex Mobile via a Menu object plus associated General Logic & virtual Relays ... we tried lots of workarounds, but eventually gave up ... it seemed to be somehow specific to iPhone ...
I believe this is because of the expected behaviour of a typical blind motor which uses pulsed inputs. For example if the motor is moving in one direction then to stop it it expects a pulse in the opposite direction. In other words the action of 'stop' depends on the current running state of the motor. So I'd suggest you try the 2nd option in the motor configuration list (polarity reversal method) this will simply turn one or other relay on to move the motor and no relay turned on equals stop. I think the API client should be ok with signals not being pulses but you could generate pulses if needed using a monostable gate for example. In terms of direct connectivity to logic gates try it from the API Client connections side - sometimes it's not symmetrical