Shelly 2 as roller shutter with percentage

Hi All, I have a very special behaviour. My rollers do work in general. Though as soon as I reload HA for a config change (i.e.) All Shutters are grayed out and I need to save the MQTT config to make them ungrayed in the console again.

Do you have a similar experience? Any advise?

I am a bit stuck here…

Thanks!

Probably you have set retain to true, try with false, both on the Shelly side and on the HA side.
Try with these code when defining the mqtt cover

qos: 0
retain: false
optimistic: false

woody, perfect. It was the Retain flag in the Shelly configs. Now everything works like a charm! Thanks!

nope. false alarm. Error persists… I thought it be right but it was a self inflicted delusion.

Below my HA Config:

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

Also my config of my shelly below. Any advise? THANKS!

Remove the shellyswitch id from the last picture!!!

I also had this issue of having grayed out the shelly in HA.

What I did using Nodered, but you can do with an automation, is to add a mqtt publish announce with topic shellies/command after around 30secs HA has started.
Since I was having this issue also during the day, sometimes, I have created an input_boolean to do the announce manually when there is a need.

1 Like

Anyone using Shelly2 in roller mode may test my Shellies Discovery script?

Hi Woody, thanks I will give it a try. How do you check on reboot / start of HA with Node Red? I run Hass.io.
TX!

Ok, apparently I got it running :slight_smile: my working NodeRed:

Optimisations welcome! :slight_smile:

[{“id”:“a0634751.a39d38”,“type”:“tab”,“label”:“on start”,“disabled”:false,“info”:""},{“id”:“4a47c272.0b8bfc”,“type”:“inject”,“z”:“a0634751.a39d38”,“name”:“HASS Connected?”,“topic”:"",“payload”:“homeassistant.homeAssistant.isConnected”,“payloadType”:“global”,“repeat”:“1”,“crontab”:"",“once”:false,“onceDelay”:0.1,“x”:140,“y”:140,“wires”:[[“8610f5d3.71fae8”]]},{“id”:“8610f5d3.71fae8”,“type”:“rbe”,“z”:“a0634751.a39d38”,“name”:"",“func”:“rbei”,“gap”:"",“start”:"",“inout”:“out”,“property”:“payload”,“x”:310,“y”:140,“wires”:[[“7c974962.039a48”]]},{“id”:“7c974962.039a48”,“type”:“switch”,“z”:“a0634751.a39d38”,“name”:"",“property”:“payload”,“propertyType”:“msg”,“rules”:[{“t”:“true”},{“t”:“else”}],“checkall”:“false”,“repair”:false,“outputs”:2,“x”:470,“y”:120,“wires”:[[“580021ba.cb06c”],[]]},{“id”:“f0797b9b.b42e48”,“type”:“debug”,“z”:“a0634751.a39d38”,“name”:"",“active”:false,“tosidebar”:true,“console”:false,“tostatus”:false,“complete”:“payload”,“targetType”:“msg”,“x”:850,“y”:80,“wires”:[]},{“id”:“cc28527d.ff23a”,“type”:“mqtt out”,“z”:“a0634751.a39d38”,“name”:"",“topic”:“shellies/command”,“qos”:“0”,“retain”:"",“broker”:“ccf81c78.5d2a4”,“x”:870,“y”:160,“wires”:[]},{“id”:“580021ba.cb06c”,“type”:“change”,“z”:“a0634751.a39d38”,“name”:"",“rules”:[{“t”:“set”,“p”:“payload”,“pt”:“msg”,“to”:“announce”,“tot”:“str”}],“action”:"",“property”:"",“from”:"",“to”:"",“reg”:false,“x”:650,“y”:120,“wires”:[[“cc28527d.ff23a”,“f0797b9b.b42e48”]]},{“id”:“f1dc3533.092478”,“type”:“inject”,“z”:“a0634751.a39d38”,“name”:“Trigger Shelly announce”,“topic”:"",“payload”:“true”,“payloadType”:“bool”,“repeat”:"",“crontab”:"",“once”:false,“onceDelay”:0.1,“x”:140,“y”:40,“wires”:[[“7c974962.039a48”]]},{“id”:“ccf81c78.5d2a4”,“type”:“mqtt-broker”,“z”:"",“name”:“remote”,“broker”:“192.168.3.18”,“port”:“1883”,“clientid”:"",“usetls”:false,“compatmode”:true,“keepalive”:“60”,“cleansession”:true,“birthTopic”:"",“birthQos”:“0”,“birthPayload”:"",“closeTopic”:"",“closeQos”:“0”,“closePayload”:"",“willTopic”:"",“willQos”:“0”,“willPayload”:""}]

It should be ok.

In any case if you have the node node-red-contrib-home-assistant-websocket you can use also the new event_type, home_assistant_client, that will tell you exactly at what stage is HA when started first time or after restart.

Probably I’ll change with this so that I will trigger when it’s connected and also when service_loaded

this should be marked as solution. Only this config snip is working fine!
please keep it highlighted somewhere

How are you configuring alerts with the Shelly so that you know it’s been opened or closed?

I can’t decided whether to use the position, monitor the watts or just use Open and Closed.

hi there. can someone please post a tutorial on how to implement slider ? thanks

After some fiddling with various options I came down on the side of position:

sensor:
- platform: mqtt
  name: "Awning Position"
  state_topic: "shellies/shellyswitch-559C7E/roller/0/pos"
  unit_of_measurement: "%"
  icon: mdi:percent

automation:
- alias: Announce awning has opened
  hide_entity: false
  initial_state: 'on'
  trigger:
    - platform: numeric_state
      entity_id: sensor.awning_position
      above: 0
  action:
    - service: notify.mobile_app_ash_x
      data:
        message: "The awning is open to {{ states.sensor.awning_position.state }}%"

- alias: Announce awning has closed
  hide_entity: false
  initial_state: 'on'
  trigger:
    - platform: numeric_state
      entity_id: sensor.awning_position
      below: 1
  action:
    - service: notify.mobile_app_ash_x
      data:
        message: "The awning has closed"

When a cover is configured and then added to the front end it looks like this:

Screen2019-04-21_07-53-37_pm

Two very convenient up/open and down/close arrows with a stop in the middle.

This is so much better than trying to use boolean ‘switches’ in the front end.

I’d like to retain this, however, I also have a need to prevent the awning opening when the wind speed is too high.

I have an anemometer with upper and lower limits that gives me MQTT messages to set and unset an input_boolean with, but how do I use that to prevent the operation of the cover controls when the input_boolean is set?

I could do it with scripts/automations but then I’d lose the arrows and stop button functionality.

Any ideas?

Assuming you mean a slider for a cover device that you already have configured and working, here’s what I have.

First, you’ll need an ‘input_number’:

awning_position:
  name: Awning Position
  icon: mdi:map-marker-distance
  initial: 0
  min: 0
  max: 100
  step: 10

Then, you’ll need to add it to your front end. I use Lovelace so here’s how it looks:

Then you’ll need the automation itself:

- alias: 'Set awning position'
  initial_state: 'on'
  trigger:
    - platform: state
      entity_id: input_number.awning_position
  action:
    # - delay: '00:00:3'
    - service: mqtt.publish
      data_template:
        topic: 'shellies/shellyswitch-££££££/roller/0/command/pos'
        retain: true
        payload: "{{ states('input_number.awning_position') | int }}"

And that should be that.

Good luck!

Hello
first of all thank you for the support
i have the following error:
Configuração inválidaVERIFICAR A CONFIGURAÇÃO

Component not found: awning_position

OK. You need to have input_number configured as a component in your conifguration.yaml file.

Do you have everything in your configration.yaml file or have you split into separate files?

If you have it all in one file then you need:

input_number:
  awning_position:
    name: Awning Position
    icon: mdi:map-marker-distance
    initial: 0
    min: 0
    max: 100
    step: 10

hi there
i have the following in configutarion.yaml

input_number:
awning_position:
name: Awning Position
icon: mdi:map-marker-distance
initial: 0
min: 0
max: 100
step: 10

#Estore slider
awning_position:
name: Awning Position
icon: mdi:map-marker-distance
initial: 0
min: 0
max: 100
step: 10

then i have the automation on automation.yaml

Is that exactly how you have it or is it indented like mine?

You have them both with the same name.

awning_position is the name I gave it. You can name yours anything you like but they must be different from each other.

input_number:
  awning_position:
    name: Awning Position
    icon: mdi:map-marker-distance
    initial: 0
    min: 0
    max: 100
    step: 10

#Estore slider
  awning_position_1:
    name: Awning Position 1
    icon: mdi:map-marker-distance
    initial: 0
    min: 0
    max: 100
    step: 10