Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use Sonoff Dual for Rolling Shutters ? #721

Closed
zibous opened this issue Aug 11, 2017 · 48 comments
Closed

How to use Sonoff Dual for Rolling Shutters ? #721

zibous opened this issue Aug 11, 2017 · 48 comments
Labels
stale Action - Issue left behind - Used by the BOT to call for attention

Comments

@zibous
Copy link

zibous commented Aug 11, 2017

First of all, thank you for the great firmware. I flashed my sonoff dual
and am very pleased with how everything works.

I try to set the SwitchMode (shutter1up/shutter1down, shutter2up/shutter2down)
but i do not work. It very importent that never bouth relais will
be switched on at same time.

12:48:44 CMND: SwitchMode=2
12:48:44 MQTT: stat/SD001/RESULT = {"Command":"Unknown"}

Also the Web Command to nothing ?
http://sonoff/cm?cmnd=Power%20On
http://sonoff/cm?cmnd=Power1%20On

Any advice for the GPIOs for the Dual to add a DHT22 Sensor ?

@PeggyFree
Copy link

You shloud look at this : #519

@zibous
Copy link
Author

zibous commented Aug 11, 2017

Thanks, but i can't find a working information. When i use the "Module":"Shutter" i can't control the Switch with MQTT or with web command:
14:14:45 MQTT: tele/SD001/INFO1 = {"Module":"Shutter", "Version":"5.5.2b", "FallbackTopic":"DVES_1E1995", "GroupTopic":"sonoffs"}
14:14:45 MQTT: tele/SD001/INFO2 = {"WebserverMode":"Admin", "Hostname":"SD001-6549", "IPaddress":"10.1.1.243"}
14:14:45 MQTT: tele/SD001/INFO3 = {"Started":"Software/System restart"}
14:14:53 MQTT: tele/SD001/STATE = {"Time":"2017-08-11T14:14:53", "Uptime":0, "Vcc":3.156, "Wifi":{"AP":1, "SSID":"McWille", "RSSI":92, "APMac":"C4:B3:01:DC:55:B6"}}
14:15:53 MQTT: tele/SD001/STATE = {"Time":"2017-08-11T14:15:53", "Uptime":0, "Vcc":3.106, "Wifi":{"AP":1, "SSID":"McWille", "RSSI":100, "APMac":"C4:B3:01:DC:55:B6"}}

@arendst
Copy link
Owner

arendst commented Aug 11, 2017

Module Shutter?

@zibous
Copy link
Author

zibous commented Aug 11, 2017

Hi,

I try this, but it do not work.

{ "Shutter", // Sonoff Dual as Shutter Switch (ESP8266)
0,
GPIO_TXD, // GPIO01 Relay control
0,
GPIO_RXD, // GPIO03 Relay control
GPIO_USER, // GPIO04 Optional sensor
0,
0, 0, 0, 0, 0, 0, // Flash connection
0,
GPIO_LED1_INV, // GPIO13 Blue Led (0 = On, 1 = Off)
0, 0, 0, 0
}
bildschirmfoto 2017-08-11 um 18 40 18

@pascalsaul
Copy link

I'm also looking for a shutter like function to replace my thermostat. Only I need 3 states: 1 idle (no relay), 2 heating (relay1), cooling (relay2). In idle state you can turn on relay1 or relay2. If relay1 is on, you can't turn on relay2. You always need to go in 'idle' state first or you should be able to switch between heating/cooling. My dual is on his way so I didn't play with it yet.

@ionciubotaru
Copy link

Try:

backlog power1 OFF;power2 ON

In this way you will never get both relays ON

@zibous
Copy link
Author

zibous commented Aug 12, 2017

Thanks for the Information from ionciubotaru,
works in Console and with homeassistant MQTT.

``

-----------------------------------------

homeassistant MQTT cover with SONOFF DUAL

-----------------------------------------

cover:

  • platform: mqtt
    state_topic: "tele/COK001"
    command_topic: "cmnd/COK001/Backlog"
    name: "Rollladen"
    qos: 0
    retain: true
    payload_open: " power1 OFF;power2 ON"
    payload_close: "power1 ON;power2 OFF"
    payload_stop: "power1 OFF;power2 OFF"
    state_open: "OFF"
    state_closed: "STATE"
    optimistic: false
    ``

Works Cover UP/DOWN/STOP works with MQTT

Problems:
How to get the State ?
Can'nt use the Shutter Motor Switch (Button 0, Button 1) on SONOFF DUAL.
How can i add the temperature and humidity sensor DHT22 ??

Used:
Program version 5.5.2b
Build Date & Time 2017-08-11T15:12:49
Core/SDK version 2_3_0/1.5.3(aec24ac9)
Sonoff Dual Module
bildschirmfoto 2017-08-12 um 11 50 41

@mkh595
Copy link

mkh595 commented Aug 13, 2017

Try: backlog power1 OFF;power2 ON In this way you will never get both relays ON

Only as long as you don't press button on device or in Web gui or don't send MQTT command for one relay.

@zibous
Copy link
Author

zibous commented Aug 13, 2017

Hi,
Thanks,

"backlog power1 OFF;power2 ON In this way you will never get both relays ON" works perfect.

command_topic: "cmnd/COK001/Backlog" payload_open: " power1 OFF;power2 ON" payload_close: "power1 ON;power2 OFF" payload_stop: "power1 OFF;power2 OFF"
Only the hardware based switch i can't use (see Switch Shutter Motor).
Also i can't find the GIPO Pin to connect the DHT Sensor.

@ionciubotaru
Copy link

In the web interface select CONFIGURATION then CONFIGURE MODULE
Select DHT sensor on the DESIRED GPIO pin
If the pin is not listed you must configure it in sonoff_template.h

@zibous
Copy link
Author

zibous commented Aug 13, 2017

@ionciubotaru

Thanks for this information, but i can't find the DESIRED GPIO pin on the print layout
of the Sonoff DUAL.

I would be glad if I could get the information, where I can connect the DHT sensor to the SONOFF Dual. Only then can I adjust the sonoff_template.h to get the sensor values.

@ionciubotaru
Copy link

Read https://github.com/arendst/Sonoff-Tasmota/wiki/Sonoff-Dual

Use RX pin for DHT
Disable serial log before

@arendst
Copy link
Owner

arendst commented Aug 13, 2017

Forget using Rx or Tx on a Sonoff Dual!

Serial interface is being used by relay control. That's also a good reason not to use a Dual for interlocked motor control as you'll someday loose communication between the esp8266 and the relay controller and both relays will be on.

I suggest to use something different for interlocked motor control.

@zibous
Copy link
Author

zibous commented Aug 13, 2017

@arendst,

Many thanks for the information, but does this mean that I CAN NOT USE the SONOFF DUAL for a roller shutter?

**Or just no DHT sensor ??? **

I also suspect the Sonoff T1: 1-3 Gang WiFi & RF 86 Type UK Smart Wall Touch Light Switch is not suitable for this? I would like a solution better than SONOFF DUAL. But also this product has in no interlocked mode.

bildschirmfoto 2017-08-13 um 17 28 50

@arendst
Copy link
Owner

arendst commented Aug 18, 2017

I will release global interlock starting with version 5.5.2k

arendst added a commit that referenced this issue Aug 18, 2017
5.6.0 20170818
* Fix Sonoff Pow intermittent exception 0
* Change Sonoff Pow sending Domoticz telemetry data only
* Add Ai-Thinker RGBW led (AiLight) (experimental)
* Add NeoPixelBus library to Sonoff Led for Hue support
* Add user configurable GPIO4 and GPIO5 to module Sonoff Bridge
* Add Sonoff B1 RGBCW led support with command Color RRGGBBCCWW (#676)
* Add command CT 152..500 to Sonoff Led and Sonoff B1 to control Color
Temperature
* Add Cold-Warm slider to web page for Sonoff Led and Sonoff B1
* Add CT parameter to Hue
* Add Sonoff T1 support (#582)
* Add AnalogInput0 if configured as Analog Input to webpage (#697, #746)
* Add command SetOption14 0|1 to enable interlock mode (#719, #721)
* Fix Mitsubishi HVAC IR power controll (#740)
@zibous
Copy link
Author

zibous commented Aug 18, 2017

@arendst

Thanks, is working perfect.
Could I use it also for the Sonoff T1: 1-3 ?

arendst added a commit that referenced this issue Aug 18, 2017
5.6.1 20170818
* Change module list order in webpage
* Fix Sonoff T1 1CH and 2CH configuration (#751)
*
* 5.6.0 20170818
* Fix Sonoff Pow intermittent exception 0
* Change Sonoff Pow sending Domoticz telemetry data only
* Add Ai-Thinker RGBW led (AiLight) (experimental)
* Add NeoPixelBus library to Sonoff Led for Hue support
* Add user configurable GPIO4 and GPIO5 to module Sonoff Bridge
* Add Sonoff B1 RGBCW led support with command Color RRGGBBCCWW (#676)
* Add command CT 152..500 to Sonoff Led and Sonoff B1 to control Color
Temperature
* Add Cold-Warm slider to web page for Sonoff Led and Sonoff B1
* Add CT parameter to Hue
* Add Sonoff T1 support (#582)
* Add AnalogInput0 if configured as Analog Input to webpage (#697, #746)
* Add command SetOption14 0|1 to enable interlock mode (#719, #721)
* Fix Mitsubishi HVAC IR power controll (#740)
@arendst
Copy link
Owner

arendst commented Aug 18, 2017

Yep.

@zibous
Copy link
Author

zibous commented Aug 18, 2017

Perfect, so i can order this...

my Configuration for HA is:

cover:
  - platform: mqtt
    state_topic: "tele/COK001/STATE"
    command_topic: "cmnd/COK001/Backlog"
    name: "Rollladen"
    qos: 0
    retain: true
    payload_open: "power1 ON"
    payload_close: "power2 ON"
    payload_stop: "power1 OFF;power2 OFF"
    state_open: "ON"
    state_closed: "OFF"
    optimistic: false
    value_template: >-
      {% if value_json.POWER1 == 'OFF' and value_json.POWER2 == 'OFF' %} 50 
      {% elif value_json.POWER1 == 'OFF' %} 100 
      {% elif value_json.POWER2 == 'ON' %} 0 
      {% endif %}

Only the state is not working ??
If I change the status (up / down), then this is not immediately reported back - only at next MQTT request.

@giig982
Copy link

giig982 commented Aug 20, 2017

Hi, I'm trying interlock mode with v5.6.1 and I can set Option14 via web interface.
My problem is that I did not found any configuration option to mantain this setting after a reboot, so I have to set again Option14 every time I switch the Sonoff (Dual in my case) off/on.

@arendst is there any future release that will integrate this option in the configuration, in memory?

@ionciubotaru
Copy link

After change Option14 send a saveData command, or set SaveData 1 for autosave changes

@giig982
Copy link

giig982 commented Aug 21, 2017

Thank you for your reply. I'll try it!

EDIT:

I tried to send saveData 1 to Sonoff Dual:

MQTT: sonoff_tapp1/stat/RESULT = {"SetOption14":"ON"}
MQTT: sonoff_tapp1/stat/RESULT = {"SaveData":"ON"}

Correctly when i switch Power2 On, Power1 goes OFF

MQTT: sonoff_tapp1/stat/RESULT = {"SetOption14":"ON"}
MQTT: sonoff_tapp1/stat/RESULT = {"POWER1":"ON"}
MQTT: sonoff_tapp1/stat/POWER1 = ON
MQTT: sonoff_tapp1/stat/RESULT = {"POWER1":"OFF"}
MQTT: sonoff_tapp1/stat/POWER1 = OFF
MQTT: sonoff_tapp1/stat/RESULT = {"POWER2":"ON"}
MQTT: sonoff_tapp1/stat/POWER2 = ON
MQTT: sonoff_tapp1/stat/RESULT = {"POWER2":"OFF"}
MQTT: sonoff_tapp1/stat/POWER2 = OFF
MQTT: sonoff_tapp1/stat/RESULT = {"POWER1":"ON"}
MQTT: sonoff_tapp1/stat/POWER1 = ON

But when i restart Sonoff, settings are lost (I tried in sequence both switch):

00:00:06 MQTT: sonoff_tapp1/tele/INFO1 = {"Module":"Sonoff Dual", "Version":"5.6.1", "FallbackTopic":"sonoff_tapp1", "GroupTopic":"sonoffs"}
00:00:06 MQTT: sonoff_tapp1/tele/INFO2 = {"WebserverMode":"Admin", "Hostname":"sonoff_tapp1-0826", "IPaddress":"192.168.5.134"}
00:00:06 MQTT: sonoff_tapp1/tele/INFO3 = {"Started":"Power on"}
... Omissis ...
21:43:29 MQTT: sonoff_tapp1/stat/RESULT = {"POWER1":"ON"}
21:43:29 MQTT: sonoff_tapp1/stat/POWER1 = ON
21:43:30 MQTT: sonoff_tapp1/stat/RESULT = {"POWER2":"ON"}
21:43:30 MQTT: sonoff_tapp1/stat/POWER2 = ON
21:43:31 MQTT: sonoff_tapp1/stat/RESULT = {"POWER2":"OFF"}
21:43:31 MQTT: sonoff_tapp1/stat/POWER2 = OFF
21:43:32 MQTT: sonoff_tapp1/stat/RESULT = {"POWER1":"OFF"}
21:43:32 MQTT: sonoff_tapp1/stat/POWER1 = OFF

@electrontube
Copy link

@arendst

interlock works great, thanks for the new release.
What we need in addition now is some kind of calibration/position data for use with shutters.

Assume It takes 60secs for the shutter to run from fully open (100%) to fully closed (0%)
If one could enter this "max_runtime" and there was an additional topic i.e. "Position" the shutter could be send directly to a position (n%) by switching the required relay (up/down dependent on the current position of the shutter) "on" for the required period of time to reach that position.

I know, this method is not 100% precise, as "down" will most likely run a bit faster than "up", due to different load, but it should be much better than triggering relays from an external source as there are random latencies in the communication path.
In addition, only the Sonoff Module itself would "know" the current Position at an acceptable accuracy as it controls the relays.

Auto re-calibration is simple:
when a relay is switched on for more than the calculated required time to reach the end position in the direction, the "current position" memory is set to 0 or 100 according the shutter position.

What do you think about it?

@giig982
Copy link

giig982 commented Aug 21, 2017

Fyi, neither pulsetime time will be retained after shutdown and restart

@davidelang
Copy link
Collaborator

davidelang commented Aug 22, 2017 via email

@giig982
Copy link

giig982 commented Aug 22, 2017

I know it @davidelang , but if I set a pulse time or interlock mode I'd like to retain those settings even after Sonoff restart, without the need to set them again. As I said, I tried to send 'savedata' or also 'savedata 1' to save settings on memory, without any results.

@davidelang
Copy link
Collaborator

davidelang commented Aug 23, 2017 via email

@giig982
Copy link

giig982 commented Aug 23, 2017

I never asked a different way to do the same thing. I just added some informations to this issue that can be correlated.

Anyway, I opened bug issue #776, then I closed it. Shame on me: i uploaded minimal firmware and i forgot to upload then the normal version.

@Fragmike
Copy link

Hi All,
finally flashed my Sonoff T1 R2 Uk Touch :-)
I´m on 5.12Sonoff-Tasmota 5.12.0b

Sending the comand

backlog power1 OFF;power2 ON

in Console does not enable intelock mode
Can someone help me?

@renne
Copy link
Contributor

renne commented Mar 11, 2018

@electrontube
@arendst

Shutters change their radius while winding which leads to a exponential time-distance correlation. I suggest the following procedure:

  1. Wind up shutter completely
  2. Measure the time for closing the shutter completely
  3. Measure the time for opening the shutter completely
  4. Measure the time for closing the shutter halfway through

Step 4 can be used to approximate variables for a exponential function.

@opendore
Copy link

I need some clarification, I installed the latest version of Tasmota 5.12.0 and I would like to command my shutters with a dual sonoff R2.

The first question I ask is:

Can I control the dual R2 sonoff with two external buttons?

I have configured the sonoff as Motor C / AC Module but I see that in the settings I can not assign anything to the buttons 1 and 2 .... Is it correct?

if I send the following command from console to test and see if relay 1 automatically deactivates relay 2 when it does not work:

22:33:06 CMD: power2 on
22:33:06 RSL: stat / sonoff / RESULT = {"Command": "Unknown"}

only the power1 on command is working.

Sorry for the stupid questions but they are at the beginning ....

Thank you all for the support!

@KristerBC
Copy link

Hi everyone,
In addition to opendore's question, I would like to know if the new firmware also affects the physical buttons on the switch ?

Ex.
If relay1 is on and I touch relay2 manually... with my fingers on the wall switch, will it then automatically turn relay1 of and relay2 on?

Just want to make sure, before flashing my precious Sonoff T1 :)

@KristerBC
Copy link

To respond to my own question,

The firmware also work when you physically push the buttons. I just flashed my T1 and I know have an interlocking mode which make it impossible to have both buttons "on" in the same time.

@rflx18
Copy link

rflx18 commented May 1, 2018

sorry guys, i dont follow the interlock mode, i cant find it anywhere, and can someone please past the HA configuration so only one button is pressed at one time.
thanks in advance

@localhost61
Copy link
Contributor

@rflx18
For interlock mode look at Option14. The other useful command here is Pulsetime.

@KristerBC
Copy link

Yeah, to be more precise, you can use the following command in the console:
SetOption14 1
It will activate the interlock mode

Make sure the that the device does not reset this option on reboot. Shutter motors don't like to have both directions activated at the same time.

Page for commands: https://github.com/arendst/Sonoff-Tasmota/wiki/Commands

@opendore
Copy link

opendore commented May 3, 2018 via email

@KristerBC
Copy link

Great that this thread could help you out.

In general, I think it should save the option automatically even after a restart and even a firmware upgrade via the web interface. For me, all my 5 T1s have kept the option on, despite manual firmware updates and without power during multiple hours(mine's are integrated in the walls).

I just wanted to point it out, because during the flash of the first device, I had it powered using my programmer through USB and it did loose the setting sometimes.
I guess it was as a result the lower voltage, but it would be great if somebody with more knowledge than me could give an opinion about this?

@opendore
Copy link

opendore commented May 7, 2018

How can I proceed now that I have managed to make the sonoff fuse switches work and manage via ip from my phone using the web interface.
Do I have to install a MQTT server like Mosquitto on my raspberry?
There are applications on IOS to manage more Sonoff with Tasmota that go to connect the MQTT server of the Raspberry? Has anyone done something like this?
Can you give me some suggestions to manage the shutters from the phone?
Thank you all for your help.

@GeeBee93
Copy link

@KristerBC Are you using the T1 to control your shutters? I am currently planning to change my shutter controls at home to sonoff switches, and the price difference between the "normal" dual (http://sonoff.itead.cc/en/products/sonoff/sonoff-dual) Version and the Touch Dual Version (http://sonoff.itead.cc/en/products/residential/sonoff-t1-eu) is not that much. This would add the nice capability to control the shutters through web interface or a "manual" switch. Thanks!

@KristerBC
Copy link

@GeeBee93 Yes! I am using the T1 dual touch switches to control my shutters and they work perfectly with the interlock option(Option14) activated.
I did think about using the T1 triple touch and using the middle button as a "stop"-button, but I decided, that it would be too complicated for the user.

My thought was exactly the same. I did not want the shutters to be unusable, if my Google Home or router stopped working. Also, if you have guests, they should not have difficulties knowing how to open/close the shutters.

@titomontes
Copy link

Hello everyone. I just found this very useful post.
Has anyone used the Sonoff Dual for blinds? How would the wiring go? Can an external wall switch be used?
Also, how is the T1 wired anyway?

You´ve taken my hopes up again with this great firmware!

Thanks a lot!

@opendore: take a look at Home Assistant, you cam implement it in a RPi 3, and control all of your domotics from there.

@stale
Copy link

stale bot commented Jul 3, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale Action - Issue left behind - Used by the BOT to call for attention label Jul 3, 2018
@stale
Copy link

stale bot commented Jul 18, 2018

This issue will be auto-closed because there hasn't been any activity for a few months. Feel free to open a new one if you still experience this problem.

@stale stale bot closed this as completed Jul 18, 2018
curzon01 pushed a commit to curzon01/Tasmota that referenced this issue Sep 6, 2018
5.6.0 20170818
* Fix Sonoff Pow intermittent exception 0
* Change Sonoff Pow sending Domoticz telemetry data only
* Add Ai-Thinker RGBW led (AiLight) (experimental)
* Add NeoPixelBus library to Sonoff Led for Hue support
* Add user configurable GPIO4 and GPIO5 to module Sonoff Bridge
* Add Sonoff B1 RGBCW led support with command Color RRGGBBCCWW (arendst#676)
* Add command CT 152..500 to Sonoff Led and Sonoff B1 to control Color
Temperature
* Add Cold-Warm slider to web page for Sonoff Led and Sonoff B1
* Add CT parameter to Hue
* Add Sonoff T1 support (arendst#582)
* Add AnalogInput0 if configured as Analog Input to webpage (arendst#697, arendst#746)
* Add command SetOption14 0|1 to enable interlock mode (arendst#719, arendst#721)
* Fix Mitsubishi HVAC IR power controll (arendst#740)
curzon01 pushed a commit to curzon01/Tasmota that referenced this issue Sep 6, 2018
5.6.1 20170818
* Change module list order in webpage
* Fix Sonoff T1 1CH and 2CH configuration (arendst#751)
*
* 5.6.0 20170818
* Fix Sonoff Pow intermittent exception 0
* Change Sonoff Pow sending Domoticz telemetry data only
* Add Ai-Thinker RGBW led (AiLight) (experimental)
* Add NeoPixelBus library to Sonoff Led for Hue support
* Add user configurable GPIO4 and GPIO5 to module Sonoff Bridge
* Add Sonoff B1 RGBCW led support with command Color RRGGBBCCWW (arendst#676)
* Add command CT 152..500 to Sonoff Led and Sonoff B1 to control Color
Temperature
* Add Cold-Warm slider to web page for Sonoff Led and Sonoff B1
* Add CT parameter to Hue
* Add Sonoff T1 support (arendst#582)
* Add AnalogInput0 if configured as Analog Input to webpage (arendst#697, arendst#746)
* Add command SetOption14 0|1 to enable interlock mode (arendst#719, arendst#721)
* Fix Mitsubishi HVAC IR power controll (arendst#740)
@BargMR
Copy link

BargMR commented Jan 27, 2019

Hi folks, does anyone use Shelly2 for shutter/blinds control?
I thought of using just one Button (UP/STOP/DOWN/STOP) to control the both relays...
... and never ever both relays ON on the same time ;-)
Need help to realise it with rules ...

SwitchMode1 5 1  //just wire SW1 or disable SW2 completely

--- rule1 -------- delay in 1/10 sec
rule1
mem1=stop   // state for next direction to use on push button
mem2=200  // time in 1/10 sec for complete up/down

on switch1#state=1 and mem1=up 
	do backlog power2 0; power1 1; delay %mem2%; power1 0; mem1=down
on switch1#state=1 and mem1=down 
	do backlog power1 0; power2 1; delay %mem2%; power2 0; mem1=up

@arendst THX for the fabulous work here! Would be nice to integrate shutter/blinds für Shelly2 basically, cause it seems the whole world are buying them :-)

@opendore
Copy link

opendore commented Jan 27, 2019 via email

@wowtah
Copy link

wowtah commented Aug 13, 2019

Great stuff! Can somebody post their config (also maybe the Homeassistant automations) so I can create my own? Many thanks!

@Swabeats
Copy link

Any updates on this one? Available in Homekit?

@ascillato
Copy link
Contributor

ascillato commented Jan 28, 2020

@Swabeats This issue is very old. Please, check the docs (http://tasmota.com) because now Tasmota supports rolling shutters. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Action - Issue left behind - Used by the BOT to call for attention
Projects
None yet
Development

No branches or pull requests