Shelly 2 as roller shutter with percentage

Hi all

I just received a Shelly 2 that I would like to use to control a roller shutter.

The Shelly 2 uses MQTT and these are the commands:

  • shellies/shellyswitch-<deviceid>/roller/0 reports the current state: open , close while in motion, stop when not moving.

  • shellies/shellyswitch-<deviceid>/roller/0/command accepts rc (performs roller calibration), open , close and stop .

  • shellies/shellyswitch-<deviceid>/roller/0/pos reports the current position in percent

  • shellies/shellyswitch-<deviceid>/roller/0/command/pos accepts a number between 0 and 100, which is target position in percent.

I have defined a cover like this:

 - platform: mqtt
    name: "Tenda sala"
    state_topic: "shellies/shellyswitch-xxxxxx/roller/0"    # Returns open,close while in motion, stop when not moving
    command_topic: "shellies/shellyswitch-xxxxxx/roller/0/command"  # Accepts open, close, stop
    payload_open: "open"
    payload_close: "close"
    payload_stop: "stop"
    state_open: "open"
    state_closed: "close"
    retain: false
    optimistic: false
    qos: 2

But how can I create a slider to control the percentage when opening and closing?
Do I need two different sliders, one for open and one for close?

Thanks

The correct definition is

- platform: mqtt
  name: bedroom_cover
  command_topic: "shellies/shellyswitch-xxxxxx/roller/0/command"
  position_topic: "shellies/shellyswitch-xxxxxx/roller/0/pos"
  set_position_topic: "shellies/shellyswitch-xxxxxx/roller/0/command/pos"
  availability_topic: "shellies/shellyswitch-xxxxxx/online"
  payload_available: "true"
  payload_not_available: "false"
  qos: 1
  retain: false
  payload_open: "open"
  payload_close: "close"
  payload_stop: "stop"
  position_open: 100
  position_closed: 0
  optimistic: false

You can then click the card in the web interface and adjust the slider.

2 Likes

Thanks @Florian

I’ve modified the cover.yaml file as per your suggestion.

I have clicked the entity, defined in the ui-lovelace.yaml, but I don’t see the slider.

18

This is my config

  - type: entities
    show_header_toggle: false
    title: Prese e Shelly
    entities:

      - entity: cover.tenda_sala
        name: Tenda sala

Do I need to define something else?

I did not alter any UI configuration and both Lovelace and the old UI are displaying the slider.
Did you remember to restart Home Assistant after updating the mqtt cover configuration?

Yes, more the one time because also of other changes, and I’ve also cleared cache in the browser.

You’ve replaced the entire cover configuration with my example code (beside nameof course)?
Did you try the old UI if the slider appears there? Since I did not alter the Lovelace config I can’t validate your config.

Does “Sconosciuto” mean “Unknown”? Did you enable Shelly’s MQTT functionality at all?

@Florian
same stuff with standard UI

“Sconosciuto” means “Unknown”, yes, but MQTT is defined and Open and Close buttons work fine.
Consider that I’m testing the Shelly 2, so it’s not attached to anything, except to the main input 220v.

This is now the config in cover.yaml

  - platform: mqtt
    name: "Tenda sala"
    command_topic: "shellies/shellyswitch-xxxxxx/roller/0/command"
    position_topic: "shellies/shellyswitch-xxxxxx/roller/0/pos"
    set_position_topic: "shellies/shellyswitch-xxxxxx/roller/0/command/pos"
    qos: 1
    retain: false
    payload_open: "open"
    payload_close: "close"
    payload_stop: "stop"
    position_open: 100
    position_closed: 0
    optimistic: false

And this is the result in standard UI

48

Really don’t understand where is the issue… :open_mouth:

1 Like

Did you install the latest Shelly firmware (20181217-130502/v1.4.2@cc724b51 as of writing) and did the calibration process run successfully? Please check if the slider is available in the Shelly interface itself.

How does you shelly respond if you send update to shellies/announce with an MQTT tool like MQTT.fx?

It should respond with posting to the following three topics:

shellies/shellyswitch-xxxxxx/roller/0
shellies/shellyswitch-xxxxxx/roller/0/pos
shellies/shellyswitch-xxxxxx/relay/power

Can it be that since I have not attached to anything on the output side, I’m just testing it, I can’t see the slider?
I can’t do the calibration because it’s not attached to a roller shutter and since calibration is done measuring power consumed it does not work.

But it seems strange to me that the slider does not appear if not calibrated. I don’t see the relation between them.

If I send a command like shellies/shellyswitch-5B28E2/roller/0/command/pos or shellies/shellyswitch-5B28E2/roller/0/command i can hear the relay switching.

Thanks

You need it attached to a motor with start and endpoint. And you need to run calibration in oder to get any position.

1 Like

Thanks.

I will try when I will connect to the motor.

Ciao Woody, stavo valutando lo Sherry 2 per le persiane e volevo capire se eri riuscito a far funzionare la percentuale. So che c’è un dispositivo simile che lo fa ma funziona non in wi-fi ma con il protocollo z-wave.

Grazie in anticipo.

Ciao @destroyer76

I haven’t tried yet on the roller shutter, I’m not an electrician so don’t want to create disaster, even if it should be simple.

I will let you know as soon as I will let it work…

Ciao @woody4165 thanks for your quick repons.

P.S. why do you repons me in English ? :open_mouth:

It can be very confusing if in the same topic (opened using english) people from all over the world replies in different languages.

3 Likes

Ah ok !! It’s correct !

@Florian Thanks a lot! This is really helpful. Could you please also share any resources on how to wire it to motor and actually what motors are known to be supported (or at least supposed to work)? I’m considering to replace rm-mini (ir) controlled Forest Shuttle M drapery motor (https://www.forestgroup.com/products/Shuttle.html) with shelly2 to have actual state. My research got nothing real so far.

I’m not much of a help in regard to choosing the best motor. It was mentioned that the motor must turn itself of when reaching the open/close states to enable the shelly calibration. That might change in the future since the shelly devs are always optimizing the product.

Otherwise I think the “dumber” the motor, the easier the shelly integration. I the motor itself has some kind of “smartness” in it (and the linked motor sound like that, e.g. “Full automatic setting of the limits.”) it might be harder to integrate since both shelly and the motor itself try to calibrate from time to time…

Were you able to connect the motor? Can you please share the connection?

Does the slider works?

Tks!

Nope, I still haven’t tried.
I’m waiting for the others Shelly 2 to arrive, hope soon, and I will install them all.