stefanbode / Sonoff-Tasmota

Provide ESP8266 based itead Sonoff with Web, MQTT and OTA firmware using Arduino IDE, enhanced with I2C options
GNU General Public License v3.0
127 stars 41 forks source link

Blinds stops if while moving forward I move slider back #144

Closed snakuzzo closed 5 years ago

snakuzzo commented 5 years ago
14:27:35 Start shutter in right direction 1
14:27:35 MQT: stat/sonoff-cletto/RESULT = {"POWER1":"ON"}
14:27:35 MQT: stat/sonoff-cletto/POWER1 = ON (salvato)
14:27:35 MQT: stat/sonoff-cletto/RESULT = {"shutterposition1":50}
14:27:36 Shutter 0: Real Pos: 2300, Target 20000, source: Shutter, start-pos: 0 %, direction: 1, rtcshutter: 1.1  [s]
14:27:37 Shutter 0: Real Pos: 4300, Target 20000, source: Shutter, start-pos: 0 %, direction: 1, rtcshutter: 2.1  [s]
14:27:38 Shutter 0: Real Pos: 6300, Target 20000, source: Shutter, start-pos: 0 %, direction: 1, rtcshutter: 3.1  [s]
14:27:39 Shutter 0: Real Pos: 8300, Target 20000, source: Shutter, start-pos: 0 %, direction: 1, rtcshutter: 4.2  [s]
14:27:40 Shutter 0: Real Pos: 10300, Target 20000, source: Shutter, start-pos: 0 %, direction: 1, rtcshutter: 5.2  [s]
14:27:41 Shutter 0: Real Pos: 12300, Target 20000, source: Shutter, start-pos: 0 %, direction: 1, rtcshutter: 6.2  [s]

...but...if while opening I move slider back to (for example) 10% it stops. (I hear relay sound two times and it stops)

14:27:41 Start shutter in right direction -1
14:27:41 MQT: stat/sonoff-cletto/RESULT = {"POWER1":"OFF"}
14:27:41 MQT: stat/sonoff-cletto/POWER1 = OFF (salvato)
14:27:41 MQT: stat/sonoff-cletto/RESULT = {"POWER2":"ON"}
14:27:41 MQT: stat/sonoff-cletto/POWER2 = ON (salvato)
14:27:41 MQT: stat/sonoff-cletto/RESULT = {"shutterposition1":10}
14:27:41 MQT: stat/sonoff-cletto/SHUTTER1 = 28 (salvato)
14:27:41 MQT: stat/sonoff-cletto/RESULT = {"POWER2":"OFF"}
14:27:41 MQT: stat/sonoff-cletto/POWER2 = OFF (salvato)
14:27:41 MQT: tele/sonoff-cletto/RESULT = {"SHUTTER-1":{"position":28, "direction":0}}
14:27:43 MQT: stat/sonoff-cletto/RESULT = {"shutterposition1":28}

I think last stat/sonoff-cletto/RESULT = {"POWER2":"OFF"} is wrong. I don't know if I can fix this by some configuration parameter or if it's a bug

Without using slider but just buttons, it works fine...

14:35:14 MQT: stat/sonoff-cletto/RESULT = {"POWER1":"ON"}
14:35:14 MQT: stat/sonoff-cletto/POWER1 = ON (salvato)
14:35:14 Shutter 0: Real Pos: 200, Target 40000, source: Shutter, start-pos: 0 %, direction: 1, rtcshutter: 0.1  [s]
14:35:15 Shutter 0: Real Pos: 2200, Target 40000, source: Shutter, start-pos: 0 %, direction: 1, rtcshutter: 1.1  [s]
14:35:16 Shutter 0: Real Pos: 4200, Target 40000, source: Shutter, start-pos: 0 %, direction: 1, rtcshutter: 2.1  [s]
14:35:17 Shutter 0: Real Pos: 6200, Target 40000, source: Shutter, start-pos: 0 %, direction: 1, rtcshutter: 3.1  [s]
14:35:18 Shutter 0: Real Pos: 8200, Target 40000, source: Shutter, start-pos: 0 %, direction: 1, rtcshutter: 4.1  [s]
14:35:19 Shutter 0: Real Pos: 10200, Target 40000, source: Shutter, start-pos: 0 %, direction: 1, rtcshutter: 5.1  [s]
14:35:20 MQT: stat/sonoff-cletto/RESULT = {"POWER1":"OFF"}
14:35:20 MQT: stat/sonoff-cletto/POWER1 = OFF (salvato)
14:35:21 MQT: stat/sonoff-cletto/RESULT = {"POWER2":"ON"}
14:35:21 MQT: stat/sonoff-cletto/POWER2 = ON (salvato)
14:35:21 Shutter 0: Real Pos: 11600, Target 0, source: Shutter, start-pos: 0 %, direction: -1, rtcshutter: 0.2  [s]
14:35:22 Shutter 0: Real Pos: 9600, Target 0, source: Shutter, start-pos: 0 %, direction: -1, rtcshutter: 1.1  [s]

I made 2 videos about this

SLIDER KO https://www.youtube.com/watch?v=QinVLlk7qmg

BUTTONS OK https://www.youtube.com/watch?v=VxIdwPuKM2s

stefanbode commented 5 years ago

Totally agree to your finding and thanks for the log files. I assume you are use the standard mode this is most likely from the logs. I have same configuration here, therefore easy to reproduce. If it behaves like that this is for sure a bug..

stefanbode commented 5 years ago

The second power2 off is the mistake. The position is correct with 28 but it should not stop until 10. should be easy fixable

stefanbode commented 5 years ago

There were some changes in the webinterface and the INTERLOCK behavior. Therefore the detection, if someone hits a button or play on the slider in the webinterface was not working anymore. Please feel free o check and give feedback

snakuzzo commented 5 years ago

Thanks! Now it works.

18:28:18 MQT: stat/sonoff-cletto/RESULT = {"POWER1":"ON"}
18:28:18 MQT: stat/sonoff-cletto/POWER1 = ON (salvato)
18:28:18 MQT: stat/sonoff-cletto/RESULT = {"shutterposition1":56}
18:28:18 Shutter 0: Real Pos: 1100, Target 22400, source: Shutter, start-pos: 0 %, direction: 1, rtcshutter: 0.6  [s]
18:28:19 Shutter 0: Real Pos: 3100, Target 22400, source: Shutter, start-pos: 0 %, direction: 1, rtcshutter: 1.6  [s]
18:28:20 Shutter 0: Real Pos: 5100, Target 22400, source: Shutter, start-pos: 0 %, direction: 1, rtcshutter: 2.5  [s]
18:28:21 Shutter 0: Real Pos: 7100, Target 22400, source: Shutter, start-pos: 0 %, direction: 1, rtcshutter: 3.5  [s]
18:28:22 Shutter 0: Real Pos: 9100, Target 22400, source: Shutter, start-pos: 0 %, direction: 1, rtcshutter: 4.5  [s]
18:28:23 Shutter 0: Real Pos: 11100, Target 22400, source: Shutter, start-pos: 0 %, direction: 1, rtcshutter: 5.5  [s]
18:28:24 Start shutter in direction -1
18:28:24 MQT: stat/sonoff-cletto/RESULT = {"POWER1":"OFF"}
18:28:24 MQT: stat/sonoff-cletto/POWER1 = OFF (salvato)
18:28:24 MQT: stat/sonoff-cletto/RESULT = {"POWER2":"ON"}
18:28:24 MQT: stat/sonoff-cletto/POWER2 = ON (salvato)
18:28:24 MQT: stat/sonoff-cletto/RESULT = {"shutterposition1":9}
18:28:25 Shutter 0: Real Pos: 10500, Target 3600, source: Shutter, start-pos: 0 %, direction: -1, rtcshutter: 1.0  [s]
18:28:26 Shutter 0: Real Pos: 8500, Target 3600, source: Shutter, start-pos: 0 %, direction: -1, rtcshutter: 2.0  [s]
18:28:27 Shutter 0: Real Pos: 6500, Target 3600, source: Shutter, start-pos: 0 %, direction: -1, rtcshutter: 3.0  [s]
18:28:28 Shutter 0: Real Pos: 4500, Target 3600, source: Shutter, start-pos: 0 %, direction: -1, rtcshutter: 4.0  [s]
18:28:28 MQT: stat/sonoff-cletto/SHUTTER1 = 9 (salvato)
18:28:28 MQT: stat/sonoff-cletto/RESULT = {"POWER2":"OFF"}
18:28:28 MQT: stat/sonoff-cletto/POWER2 = OFF (salvato)
18:28:28 MQT: tele/sonoff-cletto/RESULT = {"SHUTTER-1":{"position":9, "direction":0}}
18:28:28 MQT: stat/sonoff-cletto/RESULT = {"shutterposition1":9}

Just a question... Do you think is correct to add a little delay (maybe about 0.3s) between POWERx OFF and POWERy ON on switch direction using slider ? To understand why I made two videos...

Switch with buttons (native) https://www.youtube.com/watch?v=plhQcKpSMXk

Switch with slider (after your fix) https://www.youtube.com/watch?v=npMF2gMbI4Y

stefanbode commented 5 years ago

This is more tricky than you might expect. There is already a delay implemented with 0.5sec default value. You will find the variable under: MOTOR_STOP_TIME

This will not work if you hit the relay button directly in the webinterface. In this case, the INTERLOCK is switching OFF the first relay and it is very hard to get a SLEEP after this. Maybe I can have a look tomorrow afternoon, but I do not expect an easy change. With the slider, I control the relays. This makes things much easier. The INTERLOCK must be defined but as long as you use the slider or SHUTTERPOSITION the rescue mechanism from INTERLOCK should have no reason to dig in.

snakuzzo commented 5 years ago

Thank you for your time Stefan. But in the "switch buttons" video I used buttons on web interface...and that delay is ok. My question about delay was related to the slider

snakuzzo commented 5 years ago

Hi Stefan, any news about that delay ?

stefanbode commented 5 years ago

Not yet. The slider should work anyway because I’m this situation I control the relay. Will investigate tomorrow afternoon

snakuzzo commented 5 years ago

Than you ;)

stefanbode commented 5 years ago

New vesion is now aware of a fine motor_stop in any situation. Default time is 0.5 sec. Can be changed in code. Search for: MOTOR_STOP_TIME

snakuzzo commented 5 years ago

Thank you Stefan! I'll try later :)

snakuzzo commented 5 years ago

It works great!

https://youtu.be/glJyaC_wOpg