arendst / Tasmota

Alternative firmware for ESP8266 and ESP32 based devices with easy configuration using webUI, OTA updates, automation using timers or rules, expandability and entirely local control over MQTT, HTTP, Serial or KNX. Full documentation at
https://tasmota.github.io/docs
GNU General Public License v3.0
22k stars 4.77k forks source link

Rollershutter switches on two relays instead of one #6871

Closed Gu213 closed 4 years ago

Gu213 commented 4 years ago

BUG DESCRIPTION

When ShutterClose command is issued Sonoff is switching on a pair of relays instead of one relay. This would drive roller shutter motor in two directions at one time. When PulseTime and Interlock configured for InterlockMode 1, the module does not drive relays at ShutterOpen command.

CASE 1 - right after configuring the shutter mode in the following way: 18:56:15 CMD: Backlog SetOption80 on; ShutterRelay1 1 18:56:16 MQT: stat/sonoff/RESULT = {"SetOption80":"ON"} 18:56:16 SHT: Relay 1 is 1 18:56:16 SHT: Accuracy digits: 0 18:56:16 SHT: RESET/INIT CALIBRATION MATRIX DIV 0 18:56:16 SHT: Shutter 0 (Relay:1): Init. Pos: 0 [0 %], Open Vel.: 100 Close Vel.: 100 , Max Way: 20000, Opentime 10.0 [s], Closetime 10.0 [s], CoedffCalc: c0: 300, c1 500, c2: 700, c3: 900, c4: 1000, binmask 3, is inverted 0, shuttermode 1 18:56:16 MQT: stat/sonoff/RESULT = {"ShutterRelay1":1}

At close command two relays are energised (1 and 2): 18:57:20 CMD: shutterclose1 18:57:20 MQT: stat/sonoff/RESULT = {"POWER1":"OFF"} 18:57:20 MQT: stat/sonoff/POWER1 = OFF 18:57:20 SHT: Wait for Motorstop 500 18:57:20 MQT: stat/sonoff/RESULT = {"POWER2":"ON"} 18:57:20 MQT: stat/sonoff/POWER2 = ON 18:57:20 MQT: stat/sonoff/RESULT = {"POWER1":"ON"} 18:57:20 MQT: stat/sonoff/POWER1 = ON 18:57:20 MQT: stat/sonoff/RESULT = {"ShutterClose1":0} 18:57:20 SHT: Shutter 0: Real Pos: 18400, Target 0, source: Shutter, start-pos: 100 %, direction: -1, rtcshutter: 0.8 [s] 18:57:21 SHT: Shutter 0: Real Pos: 16400, Target 0, source: Shutter, start-pos: 100 %, direction: -1, rtcshutter: 1.8 [s] 18:57:22 SHT: Shutter 0: Real Pos: 14400, Target 0, source: Shutter, start-pos: 100 %, direction: -1, rtcshutter: 2.8 [s] 18:57:23 SHT: Shutter 0: Real Pos: 12400, Target 0, source: Shutter, start-pos: 100 %, direction: -1, rtcshutter: 3.8 [s] 18:57:24 SHT: Shutter 0: Real Pos: 10400, Target 0, source: Shutter, start-pos: 100 %, direction: -1, rtcshutter: 4.8 [s] 18:57:25 SHT: Shutter 0: Real Pos: 8400, Target 0, source: Shutter, start-pos: 100 %, direction: -1, rtcshutter: 5.8 [s] 18:57:26 SHT: Shutter 0: Real Pos: 6400, Target 0, source: Shutter, start-pos: 100 %, direction: -1, rtcshutter: 6.8 [s] 18:57:27 SHT: Shutter 0: Real Pos: 4400, Target 0, source: Shutter, start-pos: 100 %, direction: -1, rtcshutter: 7.8 [s] 18:57:28 SHT: Shutter 0: Real Pos: 2400, Target 0, source: Shutter, start-pos: 100 %, direction: -1, rtcshutter: 8.8 [s] 18:57:29 SHT: Shutter 0: Real Pos: 400, Target 0, source: Shutter, start-pos: 100 %, direction: -1, rtcshutter: 9.8 [s] 18:57:30 MQT: stat/sonoff/SHUTTER1 = 0 18:57:30 MQT: stat/sonoff/RESULT = {"POWER1":"OFF"} 18:57:30 MQT: stat/sonoff/POWER1 = OFF 18:57:30 MQT: tele/sonoff/RESULT = {"Shutter1":{"Position":0,"direction":0}}

Note: Relay 2 stays energised after the command completes.

CASE 2 - after configuring pulse time and interlock mode as per manual: 19:07:00 CMD: Backlog PulseTime1 0; PulseTime2 0 19:07:00 SRC: WebConsole from 192.168.0.139 19:07:00 CMD: Group 0, Index 1, Command "BACKLOG", Data "PulseTime1 0; PulseTime2 0" 19:07:01 SRC: Backlog 19:07:01 CMD: Group 0, Index 1, Command "PULSETIME", Data "0" 19:07:01 MQT: stat/sonoff/RESULT = {"PulseTime1":{"Set":0,"Remaining":0}} 19:07:01 SRC: Backlog 19:07:01 CMD: Group 0, Index 2, Command "PULSETIME", Data "0" 19:07:01 MQT: stat/sonoff/RESULT = {"PulseTime2":{"Set":0,"Remaining":0}} 19:07:16 WIF: Checking connection... 19:07:16 WIF: Connected 19:07:19 CMD: Backlog Interlock 1,2; Interlock ON 19:07:19 SRC: WebConsole from 192.168.0.139 19:07:19 CMD: Group 0, Index 1, Command "BACKLOG", Data "Interlock 1,2; Interlock ON" 19:07:20 SRC: Backlog 19:07:20 CMD: Group 0, Index 1, Command "INTERLOCK", Data "1,2" 19:07:20 MQT: stat/sonoff/RESULT = {"Interlock":"OFF","Groups":"1,2"} 19:07:20 SRC: Backlog 19:07:20 CMD: Group 0, Index 1, Command "INTERLOCK", Data "ON" 19:07:20 SHT: Switched relay: 0 by I 19:07:20 MQT: stat/sonoff/RESULT = {"Interlock":"ON","Groups":"1,2"} 19:07:20 CFG: Saved to flash at F5, Count 21, Bytes 4096

Command to close triggering relay 2 twice, position is not being counted, relay 1 stays on endlessly: 19:07:55 CMD: shutterclose1 19:07:55 SRC: WebConsole from 192.168.0.139 19:07:55 CMD: Group 0, Index 1, Command "SHUTTERCLOSE", Data "" 19:07:55 SHT: Position in: payload 0, index 1, source 7 19:07:55 SHT: lastsource 7:, realpos 20000, target 0, payload 0 19:07:55 SRC: Shutter 19:07:55 SHT: Switched relay: 0 by Shutter 19:07:55 MQT: stat/sonoff/RESULT = {"POWER1":"OFF"} 19:07:55 MQT: stat/sonoff/POWER1 = OFF 19:07:55 SHT: Wait for Motorstop 500 19:07:55 SRC: Shutter 19:07:55 SHT: Switched relay: 2 by Shutter 19:07:55 MQT: stat/sonoff/RESULT = {"POWER2":"ON"} 19:07:55 MQT: stat/sonoff/POWER2 = ON 19:07:55 SHT: Switched relay: 2 by I 19:07:55 MQT: stat/sonoff/RESULT = {"POWER2":"OFF"} 19:07:55 MQT: stat/sonoff/POWER2 = OFF 19:07:55 SRC: Shutter 19:07:55 SHT: Switched relay: 1 by Shutter 19:07:55 MQT: stat/sonoff/RESULT = {"POWER1":"ON"} 19:07:55 MQT: stat/sonoff/POWER1 = ON 19:07:55 MQT: stat/sonoff/RESULT = {"ShutterClose1":0} 19:07:55 CFG: Saved to flash at FA, Count 24, Bytes 4096



### TO REPRODUCE
as above

### EXPECTED BEHAVIOUR
Relays 1 and 2  should interlock themselves. After the duration time both relays should switch off.

### ADDITIONAL CONTEXT

When I noted the strange behaviour, made few attempts to reset, refresh, reconfigure. Finally for this demonstration it was reset 5, minimal flash, target flash, configured.
When inverted shutter logic, same behaviour.
When Mqqt broker alive - same behaviour

**(Please, remember to close the issue when the problem has been addressed)**
Gu213 commented 4 years ago

I went through the logs one more time and found that my heading description is wrong when saying that at ShutterOpen the module does not energise. As per pasted logs - it should be described that ShutterClose command does not initiate the count down timer.

stefanbode commented 4 years ago

You have. Or defined an interlock. Therefore the shutter assumes you have a fail save configuration where relay is power and relay 2 is up/down. The behavior is intended. You can add a rule to set relay 2 to off if Relay1 goes off. If interlock is set relay 1 is down and relay2 is up. In this case there is never power on both relays

stefanbode commented 4 years ago

Interlock 1,2 Should solve your problem

Gu213 commented 4 years ago

Thank you Stefan for responding to my problem. It seems that setting shutter mode to 0 has fixed the behaviour. You had a good feeling when you wrote "relay 2 is up/down". This led me to check the shutter mode again. It was 1. I will attach the motors and hope they work. Anywhere thank you so much for wonderful job on the roller shutter control :)

ascillato2 commented 4 years ago

Great to know that now it is working for you.

Closing.

stefanbode commented 4 years ago

Take a look at the video in the wiki. Calibration is awesome if you do it right. Take a little time but is fun to see how accurate it can be

Gu213 commented 4 years ago

Thanks Stefan, my shutters have mechanical limit switches so I do not care so much about calibration of the controls. I give ca. 2 seconds of overhead to each way drive time to be sure that irrespective of changing torsion they will arrive to the end position. I have flashed all my sonoffs to the rollershuter software. They work well with OpenHab2. I'm a beginner in IOT programming. Don't know yet how to program roller shutter item with mqqt topic without using of rules. Item gives command UP, DOWN and STOP. However Sonoff expects command ShutterOpen1 etc. I convert the commands from UP to ShutterOpen1 within rules but there is probably a simpler and more elegant way. What is bothering me now is how to flash the Sonoff RF and allow controls from the remote. Will keep reading your wiki on that new topic :)

stefanbode commented 4 years ago

Hi, regarding the UP/DOWN/STOP I have an idea to bundle this into the shutterposition command. Let me do a try. Even if you have end-stops it is a good idea to have a proper calibration. Otherwise, you will have problems if you move to a designated position e.g. 40% you will get different results if coming from open or from close. As long as you only fully open and close I agree. No need for calibration. I have sunblinds in the garden that moves with the sun :-)

stefanbode commented 4 years ago

I have added this functionality and created a pull request against the master project. You can use shutterposition and then UP/DOWN/STOP to control

Gu213 commented 4 years ago

Thanks Stefan. Will keep an eye on this function in the GitHub and compile when it is available. I bet OpenHab community will like it :)