Sonoff Tasmota extension for covers

They are Niessen N2244.1BL cover switches.

Hi Steve

I want to use this exact physical button:

It has three positions (UP/DOWN/OPEN), so the open position, I imagine, would toggle any open or close command, and stop it (I need to figure out the MQTT topic)

I´ve already ordered a Sonoff Dual, but it will arrive in mid June. If it works, I´ll order at least other 5 and automatize my whole house!

Thanks for this amazing piece of software.

Hi kabongsteve,
The issues with the T1 is that the buttons do behave as only one button is there.
That most likely is a side effect of what you added for the “dual” one button operation.
I looked into the sources, but have to find my way around there first. And was busy in the job, no time to even think about a private project.

Two T1 are installed now, but do not show up in Homeassistant. Perhaps you are right about MQTT and that device. As soon as I find the time I will analyze further.

Dieter :slight_smile:

@kabongsteve, I just received my dual, I´ll be playing with it all the weekend and update functionality as soon as possible.

Cheers

@morfellu, by serial in/out you mean Tx and Rx on the serial interface?. I also need those two switches to make this thing work in my place. Thks.

@titomontes yes, those two guys in the middle, Right now I have my dual connected on those two with the original Tasmota firmware working correctly. Let me know if you make it working with @kabongsteve 's firmware please.
txrx

@morfellu, I understand that you have those connected to GND, right?, also, could you include the part of your configuration.yaml son I can figure out the MQTT settings?

Thks!

Yes, I have them connected to GND. This is my configuration.yaml:

cover:

  • platform: template
    covers:
    persiana_dormitorio:
    friendly_name: “Persiana del dormitorio”
    open_cover:
    service: mqtt.publish
    data:
    topic: ‘cmnd/persiana_dormitorio/power1’
    payload: ‘ON’
    close_cover:
    service: mqtt.publish
    data:
    topic: ‘cmnd/persiana_dormitorio/power2’
    payload: ‘ON’
    stop_cover:
    - service: mqtt.publish
    data:
    topic: ‘cmnd/persiana_dormitorio/power1’
    payload: ‘OFF’
    - service: mqtt.publish
    data:
    topic: ‘cmnd/persiana_dormitorio/power2’
    payload: ‘OFF’
    set_cover_position:
    service: mqtt.publish
    data_template:
    topic: >
    {% if position == 0 %}
    cmnd/persiana_dormitorio/power2
    {% else %}
    cmnd/persiana_dormitorio/power1
    {% endif %}
    payload: ‘ON’
    position_template: >
    {% if is_state(‘sensor.persiana_dormitorio_subir’, ‘ON’) %}
    100
    {% elif is_state(‘sensor.persiana_dormitorio_bajar’, ‘ON’) %}
    0
    {% else %}
    100
    {% endif %}

hi, I don’t understand why you use sensor.persiana_dormitorio_subir and bajar.
how did you declare them?

tnx

It sounds like you maybe using the relays as the simply button presses.
Thus, you would need a version of this that would pulse the relay on/off initially, then pulse it again at the end of the pulsetime, assuming it was wanted less than fully open or closed.

it could be done

Hi @kabongsteve can you help me doing this modification?

Hi guys,

I’ve done an update to my Github Repository.

This change takes over any configured Switches (if not used for MQTT) and sends Cover commands instead of Switch Commands.
The switches should be
Switch1 Cover1 Close
Switch2 Cover1 Open
Switch3 Cover2 Close
Switch4 Cover2 Open

I configured, so if you hit any cover button while its moving, the moving will stop.
(So if you hit Open then Close, that will simply stop the open. Close would have to be pressed twice to start the close.

I’ve been unable to test myself (I only have Dual and not Dual R2), so please let me know if its works as expected.

@kabongsteve this update allows to use wall buttons? Or What?

Hi @morfellu, is this working in normal Tasmota with the physical buttons?

I´m trying to make mine work, but with @kabongsteve´s firmware, so far no luck. I´ll be posting my config soon.

Yes, this is to allow multiple wall buttons to operate cover.
Each physical buttons needs to be connected to a GPIO, and then each GPIO configured to be a SWITCH using the standard Tasmota config.
I’d also assume the wall switches are momentary action.

Do you have a model number or other details about this switch.

You seem to imply its a 3 button switch. I’ll need to know how those buttons work to be able to set it up.

They don’t sell those in Aus.

@kabongsteve i’m trying to figure out how to modify your ExecuteCoverCommand function to let me use it on my roller shutters, but i don’t know how SetDevicePower works, so if I wanted to use a backlog command like this
Backlog power1 TOGGLE; delay X; power1 TOGGLE;
where X is the time calculated based on the position parameter, how could i do it?

Hello:

You can check it out here, page 22, last. It´s a 3 position switch: when up is pressed, it stays in up position and the blind motor stops by itself, the same for down position. If you set in the middle position (intermediate click between up and down), it disconnects power so the motor stops. Pretty simple and effective. It has three terminals: UP, DOWN and common.

I haven´t had the time to try new settings, but il will tomorrow.

Thanks again

@B1G
The SetDevicePower call is the one that turns on/off the relays.
So for your situation, where you want to turn the relay on/off at start, then on/off at end, you would replace most of the calls to SetDevicePower to 2 calls, with the second reverting the power to before the first one.
Eg at lines 1690/91 you’d replace
power |= mask;
SetDevicePower(power);
with something like
SetDevicePower(power | mask);
delay(100); // 100ms relay on to make sure its seen
SetDevicePower(power);
do the same at 1761/2 and that should about do it.
If you want to do it more shareable, look everywhere cover_mode exists and you could change the spare23 flag to be a second settings (setOption23) to change the cover operation between TOGGLE mode and PULSE mode.
PS using delay is not recommended for long pauses, so try to set it to the shortest possible to make it work
Let me know how you go

cool, so the question will be which transition the switch mode uses to signal a switch usage. If its only the on, then pressing up or down will start, but switching back to centred will do nothing.
If its both on and off, then it’ll work as expected and stop the movement when centred.
Potentially the SwitchMode settings from the tasmoto can configure this.
Let me know how it goes.

Hi @kabongsteve thanks for the work! Everything is fine with switches. If i keep pressed up it goes up and same with down.
But this morning when my wife tried to push the up the blind went up but after 2-3 seconds she release the Button, blinds come back to close position. I had to open using homeassistant ui.

Sounds like they’re not working as I’d expect.
I’d expect the momentary press of up would start the open, and if wanted a second momentary press would stop the movement, otherwise would continue to fully open.
Try turning console logging to debug and watch what is going on when you press and or release the buttons