Shelly 2 as roller shutter with percentage

Hello, everybody,
I currently have two Shelly 2.5 configured as roles in my home automation.
With normal use everything works fine.

When I restart hass.io the shutters open to the 100% position and the last state is overwritten. Although in shelly the Power on parameter is set to “stop”.

The same happens when I restart the shelly manually.

But as soon as I deactivate mqtt on the shelly it works as desired. So it must be related to the mqtt-broker.
Have you ever had a similar problem?

My configuration:

---
  platform: mqtt
  name: "livingroom_shellyswitch25-xxxxxx"
  command_topic: "shellies/shellyswitch25-xxxxxx/roller/0/command"
  state_topic: "shellies/shellyswitch25-xxxxxx/roller/0"
  position_topic: "shellies/shellyswitch25-xxxxxx/roller/0/pos"
  set_position_topic: "shellies/shellyswitch25-xxxxxx/roller/0/command/pos"
  availability_topic: "shellies/shellyswitch25-xxxxxx/online"
  qos: 0
  retain: false
  payload_open: "open"
  payload_close: "close"
  payload_stop: "stop"
  state_open: "open"
  state_closed: "closed"
  payload_available: 'true'
  payload_not_available: 'false'
  position_open: 100
  position_closed: 0
  optimistic: false

The main problem is when I make the same changes in my configuration and I have to restart hass.io… that could be a couple of times a day… and all roles switch on from different positions -> women’s acceptance factor drops sharply :slight_smile:

Looks like there are retained topics on the MQTT broker. The retain flag for the shelly is IMHO only for the topics the shelly is publishing, but there could still be retained command or command/pos topics that the shelly subscribes to.

Other question: why do you even use mqtt for this? Why do you bother? Why don’t you add the shellys automatically with the component ?
I don’t see any benefit of mqtt when you have the component for implementation, and everything works perfect with it.

@hspem:
Do you have any idea how I can best debug this I used the mosquitto mqqt broker

  1. why do you even use mqtt for this?
    Communication via mqtt ist much fast than http request.

  2. Why don’t you add the shellys automatically with the component ?
    As a component you mean “ShellyForHASS”?
    As far as I know, the control there works via http or can be realized via mqtt.

Try

mosquitto_sub -v -h <ip of mqtt broker> -t '#' | grep shellyswitch25

without operating the shelly.

Look for command topics for your shelly

shellies/shellyswitch25-xxxxxx/roller/0/command
shellies/shellyswitch25-xxxxxx/roller/0/command/pos

Then look at this thread how to remove retained messages.

I don’t know how fast your communication should be, but I can tell you that the communication of my devices is as fast as pressing the manual button on the wall. ShellyForHass uses COAP (wich is based on Rest). But the biggest benefit is, that you don’t have to care about the settings or anything of MQTT. It just adds your Shellies to home assistant like a build-in integration. For me that’s the biggest benefit: Wiring my Shelly and have them completely included in home assistant, as soon as they are connect to wifi.

Hi,
I’ve tried everything with my Shelly 2.5 to stop the below error within the home-assistant.log. As per previous posts, it mentions calibrating the shutter. I have a problem with this since my roller shutter has an issue where the motor does not disengage when it is in the up position and I expect that this is leaving the state = -1.

2019-12-22 14:39:18 WARNING (MainThread) [homeassistant.components.mqtt.cover] Payload is not integer within range: -1
2019-12-22 14:39:48 WARNING (MainThread) [homeassistant.components.mqtt.cover] Payload is not integer within range: -1

My covers.yaml looks like this:-

  - platform: mqtt
    name: "Lounge Roller Shutter"
    command_topic: "shellies/shellyswitch25-6883ED/roller/0/command"
    position_topic: "shellies/shellyswitch25-6883ED/roller/0/pos"
    set_position_topic: "shellies/shellyswitch25-6883ED/roller/0/command/pos"
    availability_topic: "shellies/shellyswitch25-6883ED/online"
    qos: 1
    retain: false
    payload_open: "open"
    payload_close: "close"
    payload_stop: "stop"
    payload_available: "true"
    payload_not_available: "false"
    position_open: 100
    position_closed: 0
    optimistic: false

Try to write true and false without double quotes…

I think I have a problem with the retain flag.

If I monitor the mqtt topic I can see how the commands are sent.

When I retrieve the topic again, there is a different value

monitoring shelly device:

mosquitto_sub -v -h 192.168.xxx.xxx -t '#' | grep shellyswitch25-xxxxxx/roller/

Command:

shellies/shellyswitch25-xxxxxx/roller/0/command close
shellies/shellyswitch25-xxxxxx/roller/0/pos 0

When I call up the topic again, I read the following:

shellies/shellyswitch25-xxxxxx/roller/0/command open
shellies/shellyswitch25-xxxxxx/roller/0/pos 100

How can that be?
I have posted my config above

I have looked at the topics with “MQTT Explorer” and found that the command topic has a retain flag set in the broker.
How this happens I can not explain!
I deleted the flag manually and it is not set anymore So I could solve my problem :slight_smile:

A good hint gave me this video:

MQTT Explorer

Hi

My Shelly 2 worked like a charm until 104.2 (latest) Hass.io. Now they are Unavailable!

Tried to set reatain to false in both configuration.yaml and in Shelly GUI.

Tried to take away the " " in configuration.yaml.

SO my code:

- platform: mqtt
    name: 'Rullgardin dörr'
    command_topic: "shellies/shellyswitch-55BD61/roller/0/command"
    position_topic: "shellies/shellyswitch-55BD61/roller/0/pos"
    set_position_topic: "shellies/shellyswitch-55BD61/roller/0/command/pos"
    availability_topic: "shellies/shellyswitch-55BD61/online"
    payload_available: true
    payload_not_available: false
    qos: 0
    retain: false
    payload_open: "open"
    payload_close: "close"
    payload_stop: "stop"
    position_open: 100
    position_closed: 0
    optimistic: false

And I have automations lite this.

- alias: Shelly Status Info at Start
  initial_state: true
  trigger:
  - platform: homeassistant
    event: start
  action:
  - service: mqtt.publish
    data:
      topic: shellies/command
      payload: update
- alias: Shelly sync at HA start
  initial_state: true
  trigger:
  - platform: homeassistant
    event: start
  action:
  - delay: 00:00:20
  - service: mqtt.publish
    data:
      topic: shellies/command
      payload: announce
  id: 291fccda42614c799e02288d56e07224
- alias: 'Shellies Discovery'
  trigger:
    - platform: mqtt
      topic: shellies/announce
  action:
    service: python_script.shellies_discovery
    data_template:
      id: '{{ trigger.payload_json.id }}'
      mac: '{{ trigger.payload_json.mac }}'
      fw_ver: '{{ trigger.payload_json.fw_ver }}'

I have tried all night yesterday to fix this but no luck,

Can someone help understand a couple of things.

When I run mosquitto add on I use my regular user. I only have one. It works almost great except the problem with shelly 2 above.

Are there any problems with using it this way? My user is administrator.

This *ucking reain flag?

I have 3 shelly 2 as roller shutter
I have 2 Shelly 1 has garage door cover
I have 5 shelly 1 as light
I have 2 shelly plug S as engergy and binary_template for dishwasher and laundry machine

All are configured in configuration . yaml.

All except the roller shutters have the retain set to true

What are the correct way here?

Mqtt was the most stable part of my system until 104.2 version it seems, would like to configure this right.

I don’t know if that has been solved yet. My Shelly 2.5 never sent something to the availability topic like the shelly1 switches do. Therefore shellies/shellyswitch-XXX/online" won’t be sent and Homeassistant will mark it as offline. I commented out the availability topic and both related payloads and the Shelly 2.5 works fine

I was looking to use my shelly 2.5 as roller shutter with percentage (just as this topic) and managed to find a more straightforward way to do so:

1- Configure my shelly 2.5 as roller shutter in the Shelly app
2- Use the Shelly integration of Home Assistant
3- With the developper tool (States) find the entities associated with my Shelly 2.5:

  •   sensor.xxx indicates current consumption
    
  •   switch.xxx for controling the relays to open and close the shutter
    
  •   cover.xxx --> this is the one we want for rolling shutter or garage door
    

4- In Lovelace-ui I use the HACS custom component slider-entity-row :slight_smile:

entity: cover.shelly_shsw_25_xxxxxxxxxxxxxxx 
icon: 'mdi:blinds'
name: Volet cuisine
type: 'custom:slider-entity-row'

xxxxxxxxxxxxxxx = YourShellyDeviceID

And that’s pretty much all there is to do !


EDIT :wink:
I complete this post with additional features that may help to go further:

2 Likes

@MarcALE is it working for you in the latest version 0.117.5 of HA ?

I don’t see any slider in front of Roller :frowning: ?

Any idea why ?

I installed it via HACS and that’s all

Thank you

Edit: I got it. It’s my bad sorry … I forgot on the shelly to setup the calibration mode :slight_smile:

It is still working fine.
I am glad you found the solution.

Just in case someone else is looking for the same subject, here is my config:

can somebody confirm connection issues like @Michael_Roxin mentioned … ?

i was just about to order a dozen shellys… but seems that HA is not ready yet ?

  • Sliders not out of the box
  • connectivity issues / complete loss after HA update
  • interface options from shelly not yet in HA available?

would you guys still recommend shellys anyway - in use with HA?

thx

Does somebody made a blueprint for this topic yet ?

I can answer on points 2 and 3 with confidence: I have no any connection issues (but heard there are some - recently Shelly is working hard on debugging the rootcause). And since I have all my shellies connected via mqtt (without even autodiscover) I have full control over all shelly features being able to work with them as I want (not as in-the-middle-layer force me to).

As of point 1, cannot say for sure since I have only one motorized window (powered by Shelly 2.5) so no enough exoerience to know all possible use-cases

1 Like