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
126 stars 41 forks source link

Momentary mode #46

Closed B1G1 closed 6 years ago

B1G1 commented 6 years ago

Hi Stefan, In my case I have momentary buttons, one opens and one closes the shutter. If I press the open button the shutter opens totally, If I want to open 50% I push open button and then push again when the shutter is 50% open to stop it. So I set pulsetime1 and pulsetime2 to 5, shutteropenduration 24 and shuttercloseduration 21, when I send shutterposition 50 command, relay 1 goes on and off correctly, but nothing else happens and the shutter opens totally.

Is it possible to make it work as needed for me?

stefanbode commented 6 years ago

Ok, it’s working anyway. Shutterposition will show 0 afterwards

B1G1 commented 6 years ago

uhm shutterposition 50 opened the shutter totally

13:32:44 CMD: SHUTTERSETCLOSE
13:32:44 SRC: WebConsole from 192.168.1.23
13:32:44 RSL: Group 0, Index 1, Command SHUTTERSETCLOSE, Data 
13:32:44 Shutter: Command Code: 'SHUTTERSETCLOSE', Payload: -99
13:32:44 MQT: stat/tapparellaStudio/RESULT = {"Command":"Error"}
13:33:18 MQT: tele/tapparellaStudio/STATE = {"Time":"2018-07-13T13:33:18","Uptime":"0T00:02:15","Vcc":3.440,"POWER1":"OFF","POWER2":"OFF", "Wifi":{"AP":1, "SSId":"FRITZ2.4", "RSSI":100, "APMac":"C8:0E:14:1E:C4:9C"}, "DeepSleep":0, "Heap":14648}
13:33:18 MQT: tele/tapparellaStudio/SENSOR = {"Time":"2018-07-13T13:33:18","Switch1":"OFF","Switch2":"OFF","SHUTTER":0}
13:34:18 MQT: tele/tapparellaStudio/STATE = {"Time":"2018-07-13T13:34:18","Uptime":"0T00:03:15","Vcc":3.440,"POWER1":"OFF","POWER2":"OFF", "Wifi":{"AP":1, "SSId":"FRITZ2.4", "RSSI":100, "APMac":"C8:0E:14:1E:C4:9C"}, "DeepSleep":0, "Heap":14648}
13:34:18 MQT: tele/tapparellaStudio/SENSOR = {"Time":"2018-07-13T13:34:18","Switch1":"OFF","Switch2":"OFF","SHUTTER":0}
13:34:25 CMD: shutterposition
13:34:25 SRC: WebConsole from 192.168.1.23
13:34:25 RSL: Group 0, Index 1, Command SHUTTERPOSITION, Data 
13:34:25 Shutter: Command Code: 'SHUTTERPOSITION', Payload: -99
13:34:25 MQT: stat/tapparellaStudio/RESULT = {"shutterposition":0}
13:34:43 CMD: shutterposition 50
13:34:43 SRC: WebConsole from 192.168.1.23
13:34:43 RSL: Group 0, Index 1, Command SHUTTERPOSITION, Data 50
13:34:43 Shutter: Command Code: 'SHUTTERPOSITION', Payload: 50
13:34:43 SRC: Shutter
13:34:43 MQT: stat/tapparellaStudio/RESULT = {"POWER1":"ON"}
13:34:43 MQT: stat/tapparellaStudio/POWER1 = ON
13:34:43 MQT: stat/tapparellaStudio/RESULT = {"shutterposition":50}
13:34:43 NEW Shutter: Stopped Position 100, relay: 0, pulsetimer: 5
13:34:43 SRC: Shutter
13:34:43 MQT: stat/tapparellaStudio/RESULT = {"POWER1":"ON"}
13:34:43 MQT: stat/tapparellaStudio/POWER1 = ON
13:34:44 SRC: PulseTimer
13:34:44 MQT: stat/tapparellaStudio/RESULT = {"POWER1":"OFF"}
13:34:44 MQT: stat/tapparellaStudio/POWER1 = OFF
13:35:18 MQT: tele/tapparellaStudio/STATE = {"Time":"2018-07-13T13:35:18","Uptime":"0T00:04:15","Vcc":3.441,"POWER1":"OFF","POWER2":"OFF", "Wifi":{"AP":1, "SSId":"FRITZ2.4", "RSSI":100, "APMac":"C8:0E:14:1E:C4:9C"}, "DeepSleep":0, "Heap":14480}
13:35:18 MQT: tele/tapparellaStudio/SENSOR = {"Time":"2018-07-13T13:35:18","Switch1":"OFF","Switch2":"OFF","SHUTTER":0}
stefanbode commented 6 years ago

What is your openduration and what your closeduration? Looks like it Zink immediately it is open

B1G1 commented 6 years ago
13:45:22 CMD: shuttercloseduration
13:45:22 SRC: WebConsole from 192.168.1.23
13:45:22 RSL: Group 0, Index 1, Command SHUTTERCLOSEDURATION, Data 
13:45:22 Shutter: Command Code: 'SHUTTERCLOSEDURATION', Payload: -99
13:45:22 MQT: stat/tapparellaStudio/RESULT = {"shuttercloseduration":21}
13:45:28 CMD: shutteropenduration
13:45:28 SRC: WebConsole from 192.168.1.23
13:45:28 RSL: Group 0, Index 1, Command SHUTTEROPENDURATION, Data 
13:45:28 Shutter: Command Code: 'SHUTTEROPENDURATION', Payload: -99
13:45:28 MQT: stat/tapparellaStudio/RESULT = {"shutteropenduration":24}
stefanbode commented 6 years ago

This line is very strange 13:34:43 NEW Shutter: Stopped Position 100, relay: 0, pulsetimer: 5

The stop position must be much higher. Here is like the log should look like.

14:41:26 CFG: Saved to flash at 3F7, Count 1467, Bytes 3812
14:41:32 CMD: shutterposition
14:41:32 SRC: Serial
14:41:32 RSL: Received Topic /shutterposition, Data Size 0, Data
14:41:32 RSL: Group 0, Index 1, Command SHUTTERPOSITION, Data
14:41:32 Shutter: Command Code: 'SHUTTERPOSITION', Payload: -99
14:41:32 MQT: hm/status/sonoff/RESULT = {"shutterposition":0}
14:41:38 CMD: shutterposition 50
14:41:38 SRC: Serial
14:41:38 RSL: Received Topic /shutterposition, Data Size 2, Data 50
14:41:38 RSL: Group 0, Index 1, Command SHUTTERPOSITION, Data 50
14:41:38 Shutter: Command Code: 'SHUTTERPOSITION', Payload: 50

14:41:38 SRC: Shutter
14:41:38 MQT: hm/status/sonoff/RESULT = {"POWER1":"ON"}
14:41:38 MQT: hm/status/sonoff/POWER1 = ON (retained)
14:41:38 MQT: hm/status/sonoff/RESULT = {"shutterposition":50}
14:41:38 SRC: PulseTimer
14:41:38 MQT: hm/status/sonoff/RESULT = {"POWER1":"OFF"}
14:41:38 MQT: hm/status/sonoff/POWER1 = OFF (retained)
14:41:39 Shutter: Real Position 1900, Target 54000, source: PulseTimer
14:41:40 Shutter: Real Position 3900, Target 54000, source: PulseTimer
14:41:40 WIF: Checking connection...
14:41:40 WIF: Connected
14:41:41 Shutter: Real Position 5900, Target 54000, source: PulseTimer
14:41:42 Shutter: Real Position 7900, Target 54000, source: PulseTimer
14:41:43 Shutter: Real Position 9900, Target 54000, source: PulseTimer
14:41:44 Shutter: Real Position 11900, Target 54000, source: PulseTimer
14:41:45 Shutter: Real Position 13900, Target 54000, source: PulseTimer
14:41:46 Shutter: Real Position 15900, Target 54000, source: PulseTimer
14:41:47 Shutter: Real Position 17900, Target 54000, source: PulseTimer

14:46:53 Shutter: Real Position 50552, Target 54000, source: PulseTimer
14:46:54 Shutter: Real Position 52552, Target 54000, source: PulseTimer
14:46:55 NEW Shutter: Stopped Position 54052, relay: 0, pulsetimer: 5
14:46:55 SRC: Shutter
14:46:55 MQT: hm/status/sonoff/RESULT = {"POWER1":"ON"}
14:46:55 MQT: hm/status/sonoff/POWER1 = ON (retained)
14:46:56 SRC: PulseTimer
14:46:56 MQT: hm/status/sonoff/RESULT = {"POWER1":"OFF"}
14:46:56 MQT: hm/status/sonoff/POWER1 = OFF (retained)
14:46:56 CFG: Saved to flash at 3FB, Count 1471, Bytes 3812
stefanbode commented 6 years ago

In the beginning of the log there must be the init parameters of the shutter. changed to your parameters and still is working on my site. Here is how it should look like:


14:49:36 ShutterInit: Position 28800 [50 %], Open Velocity: 100 Close Velocity: 114 , MAx Way: 48000, Opentime 24 [s], Closetime 21 [s]
B1G1 commented 6 years ago

I never see on my logs lines like those...

I don't know what is happening, I sent shutteropen, then shutterclose, and shutterposition 50 opened totally again but shutterposition is still 0

13:48:15 CMD: shutteropen
13:48:15 SRC: WebConsole from 192.168.1.23
13:48:15 RSL: Group 0, Index 1, Command SHUTTEROPEN, Data 
13:48:15 Shutter: Command Code: 'SHUTTEROPEN', Payload: -99
13:48:15 SRC: Shutter
13:48:15 MQT: stat/tapparellaStudio/RESULT = {"POWER1":"ON"}
13:48:15 MQT: stat/tapparellaStudio/POWER1 = ON
13:48:15 MQT: stat/tapparellaStudio/RESULT = {"shutteropen":1}
13:48:15 SRC: PulseTimer
13:48:15 MQT: stat/tapparellaStudio/RESULT = {"POWER1":"OFF"}
13:48:15 MQT: stat/tapparellaStudio/POWER1 = OFF
13:48:15 Shutter: Real Position 1100, Target 48000, source: PulseTimer
13:48:16 Shutter: Real Position 3100, Target 48000, source: PulseTimer
13:48:17 Shutter: Real Position 5100, Target 48000, source: PulseTimer
13:48:18 MQT: tele/tapparellaStudio/STATE = {"Time":"2018-07-13T13:48:18","Uptime":"0T00:17:15","Vcc":3.441,"POWER1":"OFF","POWER2":"OFF", "Wifi":{"AP":1, "SSId":"FRITZ2.4", "RSSI":94, "APMac":"C8:0E:14:1E:C4:9C"}, "DeepSleep":0, "Heap":14480}
13:48:18 MQT: tele/tapparellaStudio/SENSOR = {"Time":"2018-07-13T13:48:18","Switch1":"OFF","Switch2":"OFF","SHUTTER":2}
13:48:18 Shutter: Real Position 7100, Target 48000, source: PulseTimer
13:48:19 Shutter: Real Position 9100, Target 48000, source: PulseTimer
13:48:20 Shutter: Real Position 11100, Target 48000, source: PulseTimer
13:48:21 Shutter: Real Position 13100, Target 48000, source: PulseTimer
13:48:22 Shutter: Real Position 15100, Target 48000, source: PulseTimer
13:48:23 Shutter: Real Position 17100, Target 48000, source: PulseTimer
13:48:24 Shutter: Real Position 19100, Target 48000, source: PulseTimer
13:48:25 Shutter: Real Position 21100, Target 48000, source: PulseTimer
13:48:26 Shutter: Real Position 23100, Target 48000, source: PulseTimer
13:48:27 Shutter: Real Position 25100, Target 48000, source: PulseTimer
13:48:28 Shutter: Real Position 27100, Target 48000, source: PulseTimer
13:48:29 Shutter: Real Position 29100, Target 48000, source: PulseTimer
13:48:30 Shutter: Real Position 31100, Target 48000, source: PulseTimer
13:48:31 Shutter: Real Position 33100, Target 48000, source: PulseTimer
13:48:32 Shutter: Real Position 35100, Target 48000, source: PulseTimer
13:48:33 Shutter: Real Position 37100, Target 48000, source: PulseTimer
13:48:34 Shutter: Real Position 39100, Target 48000, source: PulseTimer
13:48:35 Shutter: Real Position 41100, Target 48000, source: PulseTimer
13:48:36 Shutter: Real Position 43100, Target 48000, source: PulseTimer
13:48:37 Shutter: Real Position 45100, Target 48000, source: PulseTimer
13:48:38 Shutter: Real Position 47100, Target 48000, source: PulseTimer
13:48:39 NEW Shutter: Stopped Position 48000, relay: 0, pulsetimer: 5
13:48:39 SRC: Shutter
13:48:39 MQT: stat/tapparellaStudio/RESULT = {"POWER1":"ON"}
13:48:39 MQT: stat/tapparellaStudio/POWER1 = ON
13:48:39 CFG: Saved to flash at F7, Count 183, Bytes 3812
13:48:39 SRC: PulseTimer
13:48:39 MQT: stat/tapparellaStudio/RESULT = {"POWER1":"OFF"}
13:48:39 MQT: stat/tapparellaStudio/POWER1 = OFF
13:48:58 CMD: shutterposition
13:48:58 SRC: WebConsole from 192.168.1.23
13:48:58 RSL: Group 0, Index 1, Command SHUTTERPOSITION, Data 
13:48:58 Shutter: Command Code: 'SHUTTERPOSITION', Payload: -99
13:48:58 MQT: stat/tapparellaStudio/RESULT = {"shutterposition":100}
13:49:03 CMD: shutterclose
13:49:03 SRC: WebConsole from 192.168.1.23
13:49:03 RSL: Group 0, Index 1, Command SHUTTERCLOSE, Data 
13:49:03 Shutter: Command Code: 'SHUTTERCLOSE', Payload: -99
13:49:03 SRC: Shutter
13:49:03 MQT: stat/tapparellaStudio/RESULT = {"POWER2":"ON"}
13:49:03 MQT: stat/tapparellaStudio/POWER2 = ON
13:49:03 MQT: stat/tapparellaStudio/RESULT = {"shutterclose":1}
13:49:03 Shutter: Real Position 47430, Target 0, source: Shutter
13:49:04 SRC: PulseTimer
13:49:04 MQT: stat/tapparellaStudio/RESULT = {"POWER2":"OFF"}
13:49:04 MQT: stat/tapparellaStudio/POWER2 = OFF
13:49:04 Shutter: Real Position 45150, Target 0, source: PulseTimer
13:49:05 Shutter: Real Position 42870, Target 0, source: PulseTimer
13:49:06 Shutter: Real Position 40590, Target 0, source: PulseTimer
13:49:07 Shutter: Real Position 38310, Target 0, source: PulseTimer
13:49:08 Shutter: Real Position 36030, Target 0, source: PulseTimer
13:49:09 Shutter: Real Position 33750, Target 0, source: PulseTimer
13:49:10 Shutter: Real Position 31470, Target 0, source: PulseTimer
13:49:11 Shutter: Real Position 29190, Target 0, source: PulseTimer
13:49:12 Shutter: Real Position 26910, Target 0, source: PulseTimer
13:49:13 Shutter: Real Position 24630, Target 0, source: PulseTimer
13:49:14 Shutter: Real Position 22350, Target 0, source: PulseTimer
13:49:15 Shutter: Real Position 20070, Target 0, source: PulseTimer
13:49:16 Shutter: Real Position 17790, Target 0, source: PulseTimer
13:49:17 Shutter: Real Position 15510, Target 0, source: PulseTimer
13:49:18 MQT: tele/tapparellaStudio/STATE = {"Time":"2018-07-13T13:49:18","Uptime":"0T00:18:15","Vcc":3.440,"POWER1":"OFF","POWER2":"OFF", "Wifi":{"AP":1, "SSId":"FRITZ2.4", "RSSI":100, "APMac":"C8:0E:14:1E:C4:9C"}, "DeepSleep":0, "Heap":14480}
13:49:18 MQT: tele/tapparellaStudio/SENSOR = {"Time":"2018-07-13T13:49:18","Switch1":"OFF","Switch2":"OFF","SHUTTER":4}
13:49:18 Shutter: Real Position 13230, Target 0, source: PulseTimer
13:49:19 Shutter: Real Position 10950, Target 0, source: PulseTimer
13:49:20 Shutter: Real Position 8670, Target 0, source: PulseTimer
13:49:21 Shutter: Real Position 6390, Target 0, source: PulseTimer
13:49:22 Shutter: Real Position 4110, Target 0, source: PulseTimer
13:49:23 Shutter: Real Position 1830, Target 0, source: PulseTimer
13:49:24 NEW Shutter: Stopped Position 6, relay: 1, pulsetimer: 5
13:49:24 SRC: Shutter
13:49:24 MQT: stat/tapparellaStudio/RESULT = {"POWER2":"ON"}
13:49:24 MQT: stat/tapparellaStudio/POWER2 = ON
13:49:25 SRC: PulseTimer
13:49:25 MQT: stat/tapparellaStudio/RESULT = {"POWER2":"OFF"}
13:49:25 MQT: stat/tapparellaStudio/POWER2 = OFF
13:49:25 CFG: Saved to flash at F6, Count 184, Bytes 3812
13:49:30 CMD: shutterposition
13:49:30 SRC: WebConsole from 192.168.1.23
13:49:30 RSL: Group 0, Index 1, Command SHUTTERPOSITION, Data 
13:49:30 Shutter: Command Code: 'SHUTTERPOSITION', Payload: -99
13:49:30 MQT: stat/tapparellaStudio/RESULT = {"shutterposition":0}
13:49:36 CMD: shutterposition 50
13:49:36 SRC: WebConsole from 192.168.1.23
13:49:36 RSL: Group 0, Index 1, Command SHUTTERPOSITION, Data 50
13:49:36 Shutter: Command Code: 'SHUTTERPOSITION', Payload: 50
13:49:36 SRC: Shutter
13:49:36 MQT: stat/tapparellaStudio/RESULT = {"POWER1":"ON"}
13:49:36 MQT: stat/tapparellaStudio/POWER1 = ON
13:49:36 MQT: stat/tapparellaStudio/RESULT = {"shutterposition":50}
13:49:36 NEW Shutter: Stopped Position 106, relay: 0, pulsetimer: 5
13:49:36 SRC: Shutter
13:49:36 MQT: stat/tapparellaStudio/RESULT = {"POWER1":"ON"}
13:49:36 MQT: stat/tapparellaStudio/POWER1 = ON
13:49:37 SRC: PulseTimer
13:49:37 MQT: stat/tapparellaStudio/RESULT = {"POWER1":"OFF"}
13:49:37 MQT: stat/tapparellaStudio/POWER1 = OFF
13:50:18 MQT: tele/tapparellaStudio/STATE = {"Time":"2018-07-13T13:50:18","Uptime":"0T00:19:15","Vcc":3.442,"POWER1":"OFF","POWER2":"OFF", "Wifi":{"AP":1, "SSId":"FRITZ2.4", "RSSI":100, "APMac":"C8:0E:14:1E:C4:9C"}, "DeepSleep":0, "Heap":14480}
13:50:18 MQT: tele/tapparellaStudio/SENSOR = {"Time":"2018-07-13T13:50:18","Switch1":"OFF","Switch2":"OFF","SHUTTER":0}
stefanbode commented 6 years ago

Ok most is fine . What is the value of shutterset50percent. Should be 60 or something

B1G1 commented 6 years ago
13:58:30 CMD: SHUTTER50PERCENT
13:58:30 SRC: WebConsole from 192.168.1.23
13:58:30 RSL: Group 0, Index 1, Command SHUTTER50PERCENT, Data 
13:58:30 Shutter: Command Code: 'SHUTTER50PERCENT', Payload: -99
13:58:30 MQT: stat/tapparellaStudio/RESULT = {"shutter50percent":63}
B1G1 commented 6 years ago

after a new restart shutterposition 50 it seems to work, but I found other strange behaviors

1- shutterposition 5 is very close to shutterposition 10 and not with only holes open 2- shutterposition 50 from 50 closes the shutter, though the position is still 50 or 49 in this case, and another shutterposition 50 opens totally

14:32:11 MQT: tele/tapparellaStudio/SENSOR = {"Time":"2018-07-13T14:32:11","Switch1":"OFF","Switch2":"OFF","SHUTTER":50}
14:32:39 CMD: shutterposition 50
14:32:39 SRC: WebConsole from 192.168.1.23
14:32:39 RSL: Group 0, Index 1, Command SHUTTERPOSITION, Data 50
14:32:39 Shutter: Command Code: 'SHUTTERPOSITION', Payload: 50
14:32:39 SRC: Shutter
14:32:39 MQT: stat/tapparellaStudio/RESULT = {"POWER2":"ON"}
14:32:39 MQT: stat/tapparellaStudio/POWER2 = ON
14:32:39 MQT: stat/tapparellaStudio/RESULT = {"shutterposition":50}
14:32:39 NEW Shutter: Stopped Position 30160, relay: 1, pulsetimer: 5
14:32:39 SRC: Shutter
14:32:39 MQT: stat/tapparellaStudio/RESULT = {"POWER2":"ON"}
14:32:39 MQT: stat/tapparellaStudio/POWER2 = ON
14:32:40 SRC: PulseTimer
14:32:40 MQT: stat/tapparellaStudio/RESULT = {"POWER2":"OFF"}
14:32:40 MQT: stat/tapparellaStudio/POWER2 = OFF
14:32:40 CFG: Saved to flash at F5, Count 201, Bytes 3812
14:33:11 MQT: tele/tapparellaStudio/STATE = {"Time":"2018-07-13T14:33:11","Uptime":"0T00:08:16","Vcc":3.440,"POWER1":"OFF","POWER2":"OFF", "Wifi":{"AP":1, "SSId":"FRITZ2.4", "RSSI":100, "APMac":"C8:0E:14:1E:C4:9C"}, "DeepSleep":0, "Heap":14592}
14:33:11 MQT: tele/tapparellaStudio/SENSOR = {"Time":"2018-07-13T14:33:11","Switch1":"OFF","Switch2":"OFF","SHUTTER":49}
4:39:11 MQT: tele/tapparellaStudio/SENSOR = {"Time":"2018-07-13T14:39:11","Switch1":"OFF","Switch2":"OFF","SHUTTER":49}
14:39:46 CMD: shutterposition 50
14:39:46 SRC: WebConsole from 192.168.1.23
14:39:46 RSL: Group 0, Index 1, Command SHUTTERPOSITION, Data 50
14:39:46 Shutter: Command Code: 'SHUTTERPOSITION', Payload: 50
14:39:46 SRC: Shutter
14:39:46 MQT: stat/tapparellaStudio/RESULT = {"POWER1":"ON"}
14:39:46 MQT: stat/tapparellaStudio/POWER1 = ON
14:39:46 MQT: stat/tapparellaStudio/RESULT = {"shutterposition":50}
14:39:46 NEW Shutter: Stopped Position 30260, relay: 0, pulsetimer: 5
14:39:46 SRC: Shutter
14:39:46 MQT: stat/tapparellaStudio/RESULT = {"POWER1":"ON"}
14:39:46 MQT: stat/tapparellaStudio/POWER1 = ON
14:39:46 CFG: Saved to flash at F4, Count 202, Bytes 3812
14:39:47 SRC: PulseTimer
14:39:47 MQT: stat/tapparellaStudio/RESULT = {"POWER1":"OFF"}
14:39:47 MQT: stat/tapparellaStudio/POWER1 = OFF
14:40:11 MQT: tele/tapparellaStudio/STATE = {"Time":"2018-07-13T14:40:11","Uptime":"0T00:15:16","Vcc":3.440,"POWER1":"OFF","POWER2":"OFF", "Wifi":{"AP":1, "SSId":"FRITZ2.4", "RSSI":100, "APMac":"C8:0E:14:1E:C4:9C"}, "DeepSleep":0, "Heap":14592}
14:40:11 MQT: tele/tapparellaStudio/SENSOR = {"Time":"2018-07-13T14:40:11","Switch1":"OFF","Switch2":"OFF","SHUTTER":50}
B1G1 commented 6 years ago

and from that state, I had to send 2 shutterclose commands to close totally with the resulting position of 12098464

14:41:36 CMD: shutterposition
14:41:36 SRC: WebConsole from 192.168.1.23
14:41:36 RSL: Group 0, Index 1, Command SHUTTERPOSITION, Data 
14:41:36 Shutter: Command Code: 'SHUTTERPOSITION', Payload: -99
14:41:36 MQT: stat/tapparellaStudio/RESULT = {"shutterposition":50}
14:41:41 CMD: shutterclose
14:41:41 SRC: WebConsole from 192.168.1.23
14:41:41 RSL: Group 0, Index 1, Command SHUTTERCLOSE, Data 
14:41:41 Shutter: Command Code: 'SHUTTERCLOSE', Payload: -99
14:41:41 SRC: Shutter
14:41:41 MQT: stat/tapparellaStudio/RESULT = {"POWER2":"ON"}
14:41:41 MQT: stat/tapparellaStudio/POWER2 = ON
14:41:41 MQT: stat/tapparellaStudio/RESULT = {"shutterclose":1}
14:41:42 SRC: PulseTimer
14:41:42 MQT: stat/tapparellaStudio/RESULT = {"POWER2":"OFF"}
14:41:42 MQT: stat/tapparellaStudio/POWER2 = OFF
14:41:42 Shutter: Real Position 29120, Target 0, source: PulseTimer
14:41:43 Shutter: Real Position 26840, Target 0, source: PulseTimer
14:41:44 Shutter: Real Position 24560, Target 0, source: PulseTimer
14:41:45 Shutter: Real Position 22280, Target 0, source: PulseTimer
14:41:46 Shutter: Real Position 20000, Target 0, source: PulseTimer
14:41:47 Shutter: Real Position 17720, Target 0, source: PulseTimer
14:41:48 Shutter: Real Position 15440, Target 0, source: PulseTimer
14:41:49 Shutter: Real Position 13160, Target 0, source: PulseTimer
14:41:50 Shutter: Real Position 10880, Target 0, source: PulseTimer
14:41:51 Shutter: Real Position 8600, Target 0, source: PulseTimer
14:41:52 Shutter: Real Position 6320, Target 0, source: PulseTimer
14:41:53 Shutter: Real Position 4040, Target 0, source: PulseTimer
14:41:54 Shutter: Real Position 1760, Target 0, source: PulseTimer
14:41:55 NEW Shutter: Stopped Position 50, relay: 1, pulsetimer: 5
14:41:55 SRC: Shutter
14:41:55 MQT: stat/tapparellaStudio/RESULT = {"POWER2":"ON"}
14:41:55 MQT: stat/tapparellaStudio/POWER2 = ON
14:41:55 SRC: PulseTimer
14:41:55 MQT: stat/tapparellaStudio/RESULT = {"POWER2":"OFF"}
14:41:55 MQT: stat/tapparellaStudio/POWER2 = OFF
14:41:55 CFG: Saved to flash at FB, Count 203, Bytes 3812
14:42:02 CMD: shutterclose
14:42:02 SRC: WebConsole from 192.168.1.23
14:42:02 RSL: Group 0, Index 1, Command SHUTTERCLOSE, Data 
14:42:02 Shutter: Command Code: 'SHUTTERCLOSE', Payload: -99
14:42:02 SRC: Shutter
14:42:02 MQT: stat/tapparellaStudio/RESULT = {"POWER2":"ON"}
14:42:02 MQT: stat/tapparellaStudio/POWER2 = ON
14:42:02 MQT: stat/tapparellaStudio/RESULT = {"shutterclose":1}
14:42:02 Shutter: Real Position 50, Target 0, source: Shutter
14:42:02 NEW Shutter: Stopped Position -64, relay: 1, pulsetimer: 5
14:42:02 SRC: Shutter
14:42:02 MQT: stat/tapparellaStudio/RESULT = {"POWER2":"ON"}
14:42:02 MQT: stat/tapparellaStudio/POWER2 = ON
14:42:02 CFG: Saved to flash at FA, Count 204, Bytes 3812
14:42:02 SRC: PulseTimer
14:42:02 MQT: stat/tapparellaStudio/RESULT = {"POWER2":"OFF"}
14:42:02 MQT: stat/tapparellaStudio/POWER2 = OFF
14:42:11 MQT: tele/tapparellaStudio/STATE = {"Time":"2018-07-13T14:42:11","Uptime":"0T00:17:16","Vcc":3.438,"POWER1":"OFF","POWER2":"OFF", "Wifi":{"AP":1, "SSId":"FRITZ2.4", "RSSI":100, "APMac":"C8:0E:14:1E:C4:9C"}, "DeepSleep":0, "Heap":14592}
14:42:11 MQT: tele/tapparellaStudio/SENSOR = {"Time":"2018-07-13T14:42:11","Switch1":"OFF","Switch2":"OFF","SHUTTER":12098464}
stefanbode commented 6 years ago

yes, there is still side effect with this F*** momentary switches. If there are additional commands inside the PULSETIME you're in trouble. If you set 50 and then 49 this will not work with momentary switches. I can make a stop for 50 50 to avoid starting the move, but it will not solve the general problem, that you make changes during PULSETIME is still running. Also, there is a minimum timeframe of 0.1 seconds that you need to respect for any action.

stefanbode commented 6 years ago

With these TWO pulses the firmware is you out of sync and does have a wrong assumption about the motor is running yes or no. Please check with larger movements, if there is bug. I can promise the small movements can only be covered by totally avoid them. Thats also the reason why PULSETIME needs to be something with 5. I had the same problem already when changing direction with the momentary motors. You must calculate some time to do different actions. you cannot do them all the same

B1G1 commented 6 years ago

after that I send SHUTTERSETCLOSE again, and shutterposition 50 opened totally again

stefanbode commented 6 years ago

Here you see that the inital ON impulse had no chance to go OFF before the next ON came in. The firmware wants to stop, but the pulsetime still did not release the relay. This causes the motor to run till end

14:42:02 MQT: stat/tapparellaStudio/RESULT = {"POWER2":"ON"}
14:42:02 MQT: stat/tapparellaStudio/POWER2 = ON
14:42:02 MQT: stat/tapparellaStudio/RESULT = {"shutterclose":1}
14:42:02 Shutter: Real Position 50, Target 0, source: Shutter
14:42:02 NEW Shutter: Stopped Position -64, relay: 1, pulsetimer: 5
14:42:02 SRC: Shutter
14:42:02 MQT: stat/tapparellaStudio/RESULT = {"POWER2":"ON"}
14:42:02 MQT: stat/tapparellaStudio/POWER2 = ON
14:42:02 CFG: Saved to flash at FA, Count 204, Bytes 3812
14:42:02 SRC: PulseTimer
14:42:02 MQT: stat/tapparellaStudio/RESULT = {"POWER2":"OFF"}
14:42:02 MQT: stat/tapparellaStudio/POWER2 = OFF
14:42:11 MQT: tele/tapparellaStudio/STATE = {"Time":"2018-07-13T14:42:11","Uptime":"0T00:17:16","Vcc":3.438,"POWER1":"OFF","POWER2":"OFF", "Wifi":{"AP":1, "SSId":"FRITZ2.4", "RSSI":100, "APMac":"C8:0E:14:1E:C4:9C"}, "DeepSleep":0, "Heap":14592}
14:42:11 MQT: tele/tapparellaStudio/SENSOR = {"Time":"2018-07-13T14:42:11","Switch1":"OFF","Switch2":"OFF","SHUTTER":12098464}
B1G1 commented 6 years ago

ok, I thought a pulsetime 5 was enough to avoid this...

stefanbode commented 6 years ago

I comitted a new version that prevent any movement start, if runtime is less than 1 second. This should hopefully avoid the problem. In your case setposition 49 will have no effect. It just stay at 50 and nothing will happen.

stefanbode commented 6 years ago

Regarding the question: 1- shutterposition 5 is very close to shutterposition 10 and not with only holes open

with 20sec runtime a change of 5 in shutterposition is 1 sek runtime. therefore is is correct, that 5 and 10 is really close together. make sense.

stefanbode commented 6 years ago

ok, now I killed the code..... investigation

B1G1 commented 6 years ago

Please don't kill me too :-D from shutterposition 1 shutterclose not closes the shutter, some holes still open... and now I can't send another shutterclose

B1G1 commented 6 years ago

the problem that shutterposition 50 opens totally after a shuttersetclose, remains

stefanbode commented 6 years ago

Ok, sometimes you need to break it before you fix it. Now you 50 problem should be fixed. Regarding the from shutterposition 1 to 0 this is not allowed anymore because the duration is <0.2 seconds and therefore this will collide with the stop command.

B1G1 commented 6 years ago

ok, but in that situation I'm not able to leave opened only the holes

B1G1 commented 6 years ago

It would be very cool to have a new command that sets the exact position of all holes open but shutter that touches the ground and then, a command that calls that position.

stefanbode commented 6 years ago

I am optimizing the behavior. Please, can you check if PULSETIME 2 works with your hardware?

B1G1 commented 6 years ago

yes pulsetime1 and pulsetime2 at 2 still work with wall buttons

stefanbode commented 6 years ago

ok pulsetime 1 will not work with the firmware, but 2 does. I uploaded an optimized build that should accept any movement possible. Therefore with pulsetime 2 and your 20second operation time it accepts 1% change in shutterposition. pulses are sometimes very short. Please try shutterposition 100 and then shutterposition 0 during still operates. if luck it stops and still reverts. otherwise it only stops

B1G1 commented 6 years ago

it's ok, it stops and reverts.

B1G1 commented 6 years ago

However, shutterclose after shutterposition 1 doesn't fully close the shutter

stefanbode commented 6 years ago

It can be that there is a delay for motorstart. This young can test with starting at pos 10. mark clearly then go 20,30,....100 and in one step back to 10. ideally you end where you start. If not there is a delay with each motorstart that may cause your shutterposition 1 problem

B1G1 commented 6 years ago

you're right when the shutter turn back to 10 it's 5 cm more open. can I fix this with a longer shuttcloseduration?

stefanbode commented 6 years ago

I‘m just testing the same with my shutter. Yes increasing the time by 1 second should make it. I can’t see in my device a mototstartup time. 10 x 5 is the same as 1 x 50

B1G1 commented 6 years ago

yes now with 1 more second it's ok. Stefan you did an amazing work... thank you very very much. I think your version should be merged with the arendst one.

B1G1 commented 6 years ago

Hi Stefan, I'm upgrading all my shutters... I have 2 smaller that have shuttercloseduration 17 and shutteropenduration 16, for them shutterposition when fully open is 1

stefanbode commented 6 years ago

Hi Bigi, these are good news. Please can you send in a log file again that shows the error. changed my testdevice to the parameters without any issue.

B1G1 commented 6 years ago

Hi Stefan, it was a misconfiguration, I was trying to set shutter50percent and I didn't reset it to 50 before, and since it was 255 the shutterposition could not ever be 100.

however I have another problem. I thought that the open command after a restart was sent by mqtt but it's not the case, I stopped the mqtt broker and after restart the shutter opens always totally.

00:00:00 Shutter Pos Calculation graph: m1: 147, b1 17300, m2: 3607
00:00:00 ShutterInit: Position 0 [0 %], Open Velocity: 100 Close Velocity: 94 , MAx Way: 32000, Opentime 16 [s], Closetime 17 [s]
00:00:00 Project sonoff tapparellaBagnoSU (Topic tapparellaBagno, Fallback DVES_9EA221, GroupTopic sonoffs) Version 6.1.0a-2_4_0
00:00:00 RSL: stat/tapparellaBagno/RESULT = {"POWER1":"ON"}
00:00:00 RSL: stat/tapparellaBagno/POWER1 = ON
00:00:00 RSL: stat/tapparellaBagno/RESULT = {"POWER1":"OFF"}
00:00:00 RSL: stat/tapparellaBagno/POWER1 = OFF
00:00:00 WIF: Connecting to AP1 FRITZ2.4 in mode 11N as tapparellaBagno-0545...
00:00:01 Shutter: Real Position 1800, Target 32000, source: PulseTimer
00:00:02 Shutter: Real Position 3800, Target 32000, source: PulseTimer
00:00:03 Shutter: Real Position 5800, Target 32000, source: PulseTimer
00:00:04 Shutter: Real Position 7800, Target 32000, source: PulseTimer
00:00:05 Shutter: Real Position 9800, Target 32000, source: PulseTimer
00:00:06 Shutter: Real Position 11800, Target 32000, source: PulseTimer
00:00:06 WIF: Connected
00:00:06 DNS: Initialized
00:00:06 HTP: Web server active on tapparellaBagno-0545.local with IP address 192.168.1.56
00:00:06 MQT: Attempting connection...
08:48:54 MQT: Connected
08:48:54 MQT: tele/tapparellaBagno/LWT = Online (retained)
08:48:54 MQT: cmnd/tapparellaBagno/POWER = 
08:48:54 MQT: tele/tapparellaBagno/INFO1 = {"Module":"Sonoff Dual R2","Version":"6.1.0a","FallbackTopic":"DVES_9EA221","GroupTopic":"sonoffs"}
08:48:54 MQT: tele/tapparellaBagno/INFO2 = {"WebServerMode":"Admin","Hostname":"tapparellaBagno-0545","IPAddress":"192.168.1.56"}
08:48:54 MQT: tele/tapparellaBagno/INFO3 = {"RestartReason":"Software/System restart"}
08:48:54 Shutter: Real Position 13800, Target 32000, source: PulseTimer
08:48:55 MQT: stat/tapparellaBagno/RESULT = {"POWER1":"OFF"}
08:48:55 MQT: stat/tapparellaBagno/POWER1 = OFF
08:48:55 MQT: stat/tapparellaBagno/RESULT = {"POWER2":"OFF"}
08:48:55 MQT: stat/tapparellaBagno/POWER2 = OFF
08:48:55 Shutter: Real Position 15800, Target 32000, source: PulseTimer
08:48:56 Shutter: Real Position 17800, Target 32000, source: PulseTimer
08:48:57 Shutter: Real Position 19800, Target 32000, source: PulseTimer
08:48:58 Shutter: Real Position 21800, Target 32000, source: PulseTimer
08:48:59 Shutter: Real Position 23800, Target 32000, source: PulseTimer
08:49:00 Shutter: Real Position 25800, Target 32000, source: PulseTimer
08:49:01 Shutter: Real Position 27800, Target 32000, source: PulseTimer
08:49:02 MQT: tele/tapparellaBagno/STATE = {"Time":"2018-07-15T08:49:02","Uptime":"0T00:00:15","Vcc":3.504,"POWER1":"OFF","POWER2":"OFF", "Wifi":{"AP":1, "SSId":"FRITZ2.4", "RSSI":68, "APMac":"C8:0E:14:1E:C4:9C"}, "DeepSleep":-1, "Heap":14760}
08:49:02 MQT: tele/tapparellaBagno/SENSOR = {"Time":"2018-07-15T08:49:02","Switch1":"OFF","Switch2":"OFF","SHUTTER":85}
08:49:02 Shutter: Real Position 29800, Target 32000, source: PulseTimer
08:49:03 Shutter: Real Position 31800, Target 32000, source: PulseTimer
08:49:03 MQT: stat/tapparellaBagno/RESULT = {"POWER1":"ON"}
08:49:03 MQT: stat/tapparellaBagno/POWER1 = ON
08:49:03 MQT: stat/tapparellaBagno/RESULT = {"POWER1":"OFF"}
08:49:03 MQT: stat/tapparellaBagno/POWER1 = OFF
08:50:02 MQT: tele/tapparellaBagno/STATE = {"Time":"2018-07-15T08:50:02","Uptime":"0T00:01:15","Vcc":3.502,"POWER1":"OFF","POWER2":"OFF", "Wifi":{"AP":1, "SSId":"FRITZ2.4", "RSSI":72, "APMac":"C8:0E:14:1E:C4:9C"}, "DeepSleep":-1, "Heap":14760}
08:50:02 MQT: tele/tapparellaBagno/SENSOR = {"Time":"2018-07-15T08:50:02","Switch1":"OFF","Switch2":"OFF","SHUTTER":100}
B1G1 commented 6 years ago

not happens restarting a sonoff with tasmota 5.1.14

B1G1 commented 6 years ago

uhm I tried to reset the configuration with command reset 1 and then started to reconfigure all. Only when in configure module section I setted GPIO0 and GPIO9, the sonoff has restarted and the relay1 immediately powered on. I can't find which option I have to configure to prevent this...

B1G1 commented 6 years ago

Good news!

After some search I found this https://github.com/arendst/Sonoff-Tasmota/issues/1798

So in sonoff_template.h, in section Sonoff Dual R2, I replaced the line GPIO_KEY1, // GPIO10 Button on casing with 0, // GPIO10 Button on casing, then in configure module section now I'm able to select button 1 for GPIO0 (before was not available), and button 2 for GPIO9.

Now all is working and restarting the sonoff not opens the shutter any more.

stefanbode commented 6 years ago

Ok, this is quite interesting and need to be added to my wiki because the Dual R2 is quite common I think to let it work with shutters. Great!!

B1G1 commented 6 years ago

One question before flashing my sonoff 4ch... You said that I can use your firmware with it which I use to control two shutters but... how do I use SHUTTERRELAY command? I have relay1-2 for the first shutter, and relay3-4 for the second shutter.

stefanbode commented 6 years ago

As you can see in the wiki there is no support for more than one shutter and to be honest i’m Quite sure it will never work with momentary motors because currently I use a global variable Relay Source to decide witch process tapped to the relay last. Impossible with more than one shutter.

B1G1 commented 6 years ago

never mind.

i will buy other 2 sonoff dual r2 👍

stefanbode commented 6 years ago

I had an idea how to make it with more shutters. Incredible binary comparison and XOR. Anyhow it works for the normal shutter. Maybe also for your momentary ones?

stefanbode commented 6 years ago

Try out the new code and please follow the wiki how to enable it. A bit tricky.

B1G1 commented 6 years ago

uhm in this moment I've lost 2 sonoff, and the 4ch too after firmware update with minimal firmware... they don't connect to wifi

B1G1 commented 6 years ago

Fortunately, disconnect and reconnect the power woke up all the sonoffs.

Now I have configured the first shutter on the sonoff 4ch, but I didn't understand how to configure the second one. If I send the command SHUTTERRELAY2 3 or 2 in the web interface I see always 4 sliders.

B1G1 commented 6 years ago

Ok, when i enable the second shutter, I have to disable at least the third, to have only 2 shutters working.

And YES it's working with 2 momentary shutters!!!

Stefan your are a genius! 👍

B1G1 commented 6 years ago

Good morning Stefan, I found that if i send the command shutterclose, to a shutter already closed then the position goes to this value 12098464.

And i can’t get correct position value in home assistant from the sonoff 4ch. I set 2 sensors like this

stefanbode commented 6 years ago

Oh, yes, this is definitely on the uint32_t variable an overflow and should not happen. I assume the same will happen if you click the down switch. I will verify this too.