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

Normal shutter switch. How to connect and properly configure? #130

Closed titomontes closed 5 years ago

titomontes commented 5 years ago

Hello again:

I want to use a normal shutter switch, which has three positions: Up, Down and a central Stop (or off).

I´m not sure on how the connections should be made (already pasted on another thread, with no responses). Any help will be much appreciated.

calcipher49 commented 5 years ago

Hi, This shutter switch is indeed 2 bistable switchs, central position set both off. Use as follows:

titomontes commented 5 years ago

Thanks a lot.

I understand that GPIO0 can be used as long as I disable serial logging, right?

stefanbode commented 5 years ago

You connect L with the 5v of your esp and up and down with two GPIO. Do not connect the switch to 220v. This will create a hell fire.

titomontes commented 5 years ago

You connect L with the 5v of your esp and up and down with two GPIO. Do not connect the switch to 220v. This will create a hell fire.

LOL. Off course, I did know that @stefanbode . I´ve already implemented several sonoff basic around the house using GPIO14 as a normal switch, and already have this switch properly working... and I have to admit that connecting the switch was very easy and intuitive.

BUT

For the life of me, I haven't been able to properly configure MQTT in HA.

This is my current config:

  - platform: mqtt
    name: "Persiana Salon"
    availability_topic: "salon/persiana1/tele/LWT"
    payload_available: "Online"
    payload_not_available: "Offline"
    position_topic: stat/salon/persiana1/SHUTTER1
    position_open: 100
    position_closed: 0
    set_position_topic: "salon/persiana1/cmnd/shutterposition"
    command_topic: "salon/persiana1/cmnd/backlog"
    payload_open: "SHUTTEROPEN"
    payload_close: "SHUTTERCLOSE"
    payload_stop: "SHUTTERSTOP"
    retain: false
    optimistic: false
    qos: 1

And tried publishing through another client on my broker with salon/persiana1/cmnd/backlog and it accepts SHUTTEROPEN and SHUTTERCLOSE and works properly, but I don´t know how to make the shutter available on HA (shows it as unavailable, but the topic salon/persiana1/LWT shows it as Online in the external client)

Could it be that there is another retained flag that is causing it to not show on HA? (unlikely, just changed the topic and full topic to salon/persianaa and it doesn't work either)

I´m at a complete loss here...

Also, in case it helps, this is from the console:

00:20:31 MQT: salon/persiana1/SHUTTER1 = 100 (retained)
00:20:31 MQT: salon/persiana1/RESULT = {"POWER1":"OFF"}
00:20:31 MQT: salon/persiana1/POWER1 = OFF (retained)
00:20:31 MQT: salon/persiana1/RESULT = {"SHUTTER-1":{"position":100, "direction":0}}
00:21:21 MQT: salon/persiana1/STATE = {"Time":"2019-02-27T00:21:21","Uptime":"0T08:30:39","Vcc":3.444,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"POWER1":"OFF","POWER2":"OFF","Wifi":{"AP":1,"SSId":"Montes01","BSSId":"34:97:F6:61:67:C0","Channel":8,"RSSI":52},"DeepSleep":0,"Heap":22768}
00:21:21 MQT: salon/persiana1/SENSOR = {"Time":"2019-02-27T00:21:21","Switch1":"ON","Switch2":"ON","SHUTTER-1":{"position":100, "direction":0}}

Cheers

titomontes commented 5 years ago

FINALLY!

I can confirm the shutters working fully wit this config:

  - platform: mqtt
    name: "Persiana Salon"
    availability_topic: "salon/persianaA/LWT"
    payload_available: "Online"
    payload_not_available: "Offline"
    position_topic: salon/persianaA/SHUTTER1
    position_open: 100
    position_closed: 0
    set_position_topic: "salon/persianaA/cmnd/shutterposition"
    command_topic: "salon/persianaA/cmnd/backlog"
    payload_open: "SHUTTEROPEN"
    payload_close: "SHUTTERCLOSE"
    payload_stop: "SHUTTERSTOP"
    retain: false
    optimistic: false
    qos: 1

where salon/persianaA is the full topic (in reality, if you go to the information page in Tasmota, the full topic will be salon/persianaA/cmnd).

I´m gonna modify the Wiki so this sticks.

Cheers

stefanbode commented 5 years ago

Thanks for updating the wiki!

titomontes commented 5 years ago

Oh crap. Turns out your initial config was completely right. I didn´t realize that I had changed my default MQTT Full topic, so all the MQTT spelling changed. I´ve returned to standard and initial config works perfectly. I´m fixing you wiki (back)

SOO sorry.