Hi, i’m using the sonoff dual (tasmota firmware | interlock mode on) to control my roller shutter .
I can set down, stop and up, but i couldn’t realize how to make an script that allows me to open and close x% of the roller shutter.
Could anyone help me?
This is how i do the up/down/stop thing.
rule "Persiana"
when
Item PComedor_Action received command UP
then
Pcomedor1.sendCommand(ON)
end
rule "Persiana"
when
Item PComedor_Action received command STOP
then
Pcomedor1.sendCommand(OFF)
Pcomedor2.sendCommand(OFF)
end
rule "Persiana"
when
Item PComedor_Action received command DOWN
then
Pcomedor2.sendCommand(ON)
end
You are going to struggle with that.
You would need to time exactly how long it takes to open the blind and then use a timer
Same for closing.
But in the long run it will go out of sync because you don’t have a sensor telling you when it’s opened fully or closed fully.
It’s best to use a dedicated blind controller. I am not the only one giving this advice. You will run into countless problems trying to do it this way.
But recently I found a fork from tasmota which does the calculation within tasmota! https://github.com/stefanbode/Sonoff-Tasmota I have not tested this yet, but it sounds promising
My point exactly. As long as you don’t have a sensor to confirm fully opened or closed, your system will eventually get out of sync.
It’s a good rule, though. I like it and I may try something like this for shutters in the shed. (I don’t want to spend more than a sonoff dual for that purpose)
Thanks a lot. It´s exactly that i´m looking for. I´m very happy!!!
Now i´m trying to make it work but…
2018-07-29 18:36:18.210 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'Sonnoff6 2': Could not cast NULL to java.lang.Number; line 38, column 66, length 23
According to what I saw. The item is not initialized. How do I have to do?
Ah, yes, forgot to mention this… I have persisted the item (plus restoreOnStartup) and in an old version of the rule there was a part which took care of that…
Please add a line like this:
if (!(Sonoff6.state instanceof Number)) Sonoff6.postUpdate(0)
Thanks a lot, i maked it work with that line, but i couldn’t use the open all, close all function. When i check the log, it’s says:
`2018-08-02 00:34:07.082 [WARN ] [.core.transform.TransformationHelper] - Cannot get service reference for transformation service of type REGEX
2018-08-02 00:34:07.085 [WARN ] [b.core.events.EventPublisherDelegate] - given new state is NULL, couldn't post update for 'mqttSonoff6_2'
2018-08-02 00:34:07.081 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'Sonoff6': The name 'Sonoff6Dur' cannot be resolved to an item or type; line 17, column 9, length 10
2018-08-02 00:34:07.143 [WARN ] [.core.transform.TransformationHelper] - Cannot get service reference for transformation service of type REGEX
2018-08-02 00:34:07.147 [WARN ] [b.core.events.EventPublisherDelegate] - given new state is NULL, couldn't post update for 'mqttSonoff6_2'`
this part is not necessary to make the rules work, it was only to give additional information when creating the rules.
In question of the REGEX warning, I don’t use REGEX at all in this rules, so this issue can’t be mine
Same for the given new state is NULL, couldn't post update for 'mqttSonoff6_2', as I only used mqttSonoff6_2.sendCommand(ON|OFF), there is nothing which could send a NULL to mqttSonoff6_2 in my rules.
I don’t do this I simply send the shutter to up (or down) position. (e.g. morning and evening)
The Sonoff will switch off after maximum runtime, and after that the upper or lower position should be reached. As the maximum runtime is used, the counter should go to 100% or 0%.
I used your code with a shelly 2.5 and the tasmota firmware. Everything works perfectly, moreover the buttons connected to the shelly also allows me to have feedback in case of using the buttons near the window. The only problem is that if you press up and down together from OH the motor is powered in both directions, risking damage. How can I fix this? I’m not very good with the rules
thanks for the reply, I solved. Specific only, to help those who read the post, with the latest version of Tasmota (6.5.0.9) the Option14 command has been replaced by “interlock” 0 (off) or 1 (on)
There is a technique to overcome this situation. (I used to see it used in connection with stepper-motor controlled valves, with no sensing.)
It relies on your mechanism being capable of being safely driven to a mechanical end stop, plus a bit more.
If it is going to bend or break something in that situation, Sod’s Law says that will happen anyway one day - so I’d imagine rollers would be safe for this “abuse”?!
Anyway, the point is;
Say you know your roller takes at most 15 secs for full travel.
If you drive it this way or that for 17 secs, you know (barring faults) that it must have got to the fully open/closed stop, regardless of where it started.
In my stepper-motor example, at system start it would always (over) drive the valve fully closed and zero the software step position counter.
In openHAB, you’d want to intercept any fully-open or fully-closed commands so that you could apply that overdrive, and then reset your calculated position.
You could invent a special calibration routine of course, but I’d imagine among your ordinary controlling rules there will be requirements for fully open/closed that can exploited for this purpose. Periodic self-calibration.
You don’t even need the “full 17 seconds” or whatever if you are reasonably confident the calibration doesn’t get too far adrift - just add a second or two to calculated travel time from “here” to “end”.
I studied the rule, with my basic notions, to be able to integrate google home. If I understand, by logDebug the rule assigns the percentage to the item Sonoff6 and calculates the activation time. While the second rule acts on the three cases UP DOWN and STOP.
I also can’t understand the meaning of 6-2 in
logDebug ("sonoff", "6-2: received command: {}", receivedCommand)
To integrate GH I had thought of creating two more items (without sitemaps) one for OPEN and one for CLOSE, this to tag them with [“Switchable”] and insert a third rule that set the item Sonoff6 equal to zero (opening) or to 100 (closure)
I made some attempts but with negative results, is it possible to get help?
thank you
David