How to have a cover entity for a Shelly 2.5 (Roller shutter)?

My goal is to control a roller shutter with slider in Lovelace.

I spent a huge amount of time reading all the net have to offer , but still not able to.

For the specific, my hardware config is describe at the bottom.

Before integration, the 2.5 are all set from their own SSID; including roller mode, calibration, MQTT, and finally Home SSID with fixed IP.

HA latest version, 5 Shelly 2.5 (firmware 1.9.4, will upgrade), Shelly discovery work with all Shelly but the 2.5 (find them, but could not integrated them (Coap time out issue)), So I change and went for Shelly discovery script by Bieniu, I am using Mosquito add-on (work fine with Sonoff/Tasmota devices), MQTT using UPD that solve (HTTP COAP) flooding issue of the 2.5. (this make the firmware update difficult as I have to reset completely the 2.5 back to factory default (press button 5 x times at power on) and set all over again from a phone)

I can see now in dev tool the 2.5 entities, so they are integrated.






Well not really !!!

as per my initial goal, I want to have a slider in a Lovelace card. I found this useful post (Shelly 2 as roller shutter with percentage - #205 by MarcALE) explaining I need to install Slider-entity-row, which was done swiftly with HACS.

So I now I need cover entities for my 2.5 to move forward. And the nightmare start here, as autodiscovery don’t create cover entities for the 2.5

The HA Cover manual page, say all about cover but not how to get/create one !

The template cover page just add to the confusion

Looking at Bieniu python script (in /config/automations.yaml, not in /config/configuration.yaml, I can see some Template things, but don’t understand a anything relating to cover)

Do I need some yaml coding ? (So what the point to have auto discovery if if you have to do some yaml ?)

I feel so close and so far at the same time, spending unreasonable time on that issue with no hair left. I really could do with some help.

Does the fact I got Switches entities block the ability to have cover entities, nothing is clear?

Please a step by step would be welcome to finish those 2.5 rollers shutter installation.

Config: Raspi 4 with SSD, HA latest version, add-on aircast, file editor, mosquito, nodered, samba, terminal &ssh; HACS
A bunch of sonoff with Tasmota, bunch of Shellies 1, 1L, 1PM, 2.5, Dimmer, EM, Googlecast audio and TV, deshumidifier Midea

Really?

Step 1: update script configuration

- id: 'shellies_discovery'
  alias: 'Shellies Discovery'
  mode: queued
  max: 999
  trigger:
    platform: mqtt
    topic: shellies/announce
  action:
    service: python_script.shellies_discovery
    data:
      id: '{{ trigger.payload_json.id }}'
      mac: '{{ trigger.payload_json.mac }}'
      fw_ver: '{{ trigger.payload_json.fw_ver }}'
      model: '{{ trigger.payload_json.model }}'
      mode: '{{ trigger.payload_json.mode | default }}'
      shellyswitch25-<ID of your device>:                 <-------- !!!
        mode: "roller"                                    <-------- !!!

Step 2: restart HA and then restart your Shelly

Step 3: there are no more steps

Thank @Bieniu for your reply.

I did that all night without success.

script version is 0.39.3

but please clear up some doubts.
is it your script who should create the cover entities ? does the fact I got the switches entities for those devices could block the creation of the cover entities ? do I need to delete the switches entities first ? (step 0: delete all shelly entities)

here is my latest with the 5 shelly 2.5 added in the /config/automations.yaml and I reboot twice after each of them added one by one …

- id: '1608333741184'
  alias: Turn on Livingroom Light at sunset
  description: ''
  trigger:
  - platform: sun
    event: sunset
  condition: []
  action:
  - type: turn_on
    device_id: cfd5d4ed1c2e8e3ec61011bf9b262106
    entity_id: switch.livroomlamp
    domain: switch
  mode: single
- id: '1608334325647'
  alias: Turn off Livingroom light at Midnight
  description: ''
  trigger:
  - platform: time
    at: '23:59:59'
  condition: []
  action:
  - type: turn_off
    device_id: cfd5d4ed1c2e8e3ec61011bf9b262106
    entity_id: switch.livroomlamp
    domain: switch
  mode: single

# automations.yaml file
- id: shellies_announce
  alias: 'Shellies Announce'
  trigger:
    - platform: homeassistant
      event: start
    - platform: time_pattern
      hours: "/1"
  action:
    service: mqtt.publish
    data:
      topic: shellies/command
      payload: announce

- id: 'shellies_discovery'
  alias: 'Shellies Discovery'
  mode: queued
  max: 999
  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 }}'
      model: '{{ trigger.payload_json.model }}'
      
      shellyswitch25-C4D816:
        mode: "roller"
        roller-0-name: "MasterBedroom Roller"
        roller-0-class: "shutter"
        position_template: "{{ '{% if value | float < 30 %}0{% else %}{{ value }}{% endif %}' }}"
        set_position_template: "{{ '{%if position | float < 30 %}0{% else %}{{ position }}{% endif %}' }}"
        
      shellyswitch25-76C6A0:
        mode: "roller"
        roller-0-name: "Stephane WS Roller"
        roller-0-class: "shutter"
        position_template: "{{ '{% if value | float < 30 %}0{% else %}{{ value }}{% endif %}' }}"
        set_position_template: "{{ '{%if position | float < 30 %}0{% else %}{{ position }}{% endif %}' }}"
        
      shellyswitch25-C4BDA8:
        mode: "roller"
        roller-0-name: "Max Roller"
        roller-0-class: "shutter"
        position_template: "{{ '{% if value | float < 30 %}0{% else %}{{ value }}{% endif %}' }}"
        set_position_template: "{{ '{%if position | float < 30 %}0{% else %}{{ position }}{% endif %}' }}"
        
      shellyswitch25-C48163:
        mode: "roller"
        roller-0-name: "Julie Roller"
        roller-0-class: "shutter"
        position_template: "{{ '{% if value | float < 30 %}0{% else %}{{ value }}{% endif %}' }}"
        set_position_template: "{{ '{%if position | float < 30 %}0{% else %}{{ position }}{% endif %}' }}"
        
      shellyswitch25-C4D69C:
        mode: "roller"
        roller-0-name: "Margo WS Roller"
        roller-0-class: "shutter"
        position_template: "{{ '{% if value | float < 30 %}0{% else %}{{ value }}{% endif %}' }}"
        set_position_template: "{{ '{%if position | float < 30 %}0{% else %}{{ position }}{% endif %}' }}"
        
      shellyem-B9E21E:
        force_update_sensors: true
        
# Comfee Midea Deshumidifier
- alias: input_select.dehumidifier_fan_mode change
  trigger:
    entity_id: input_select.dehumidifier_fan_mode
    platform: state
  action:
    service: midea_dehumidifier.set_fan_speed
    data_template:
      entity_id: humidifier.midea_dehumidifier_18691697838805
      fan_speed: '{{ states.input_select.dehumidifier_fan_mode.state }}'
###
- alias: MideaDehumidifier fan speed change
  trigger:
    entity_id: humidifier.midea_dehumidifier_18691697838805
    platform: state
  action:
    service: input_select.select_option
    data_template:
      entity_id: input_select.dehumidifier_fan_mode
      option: '{{ states.humidifier.midea_dehumidifier_18691697838805.attributes.fan_speed_mode }}'
###
- alias: Set input_select.dehumidifier_fan_mode options to 'High' when state of device change to Dryer
  trigger:
    platform: template
    value_template: "{% if is_state('input_select.dehumidifier_modes', 'Dryer') %}true{% endif %}"
  action:
    service: input_select.set_options
    data_template:
      entity_id: input_select.dehumidifier_fan_mode
      options: 
        - 'High'
- alias: Revert back input_select.dehumidifier_fan_mode options when state of device change to not Dryer
  trigger:
    platform: template
    value_template: "{% if not is_state('input_select.dehumidifier_modes', 'Dryer') %}true{% endif %}"
  action:
    service: input_select.set_options
    data_template:
      entity_id: input_select.dehumidifier_fan_mode
      options:
        - 'Silent'
        - 'medium'
        - 'High'
######
- alias: input_select.dehumidifier_modes change
  trigger:
    entity_id: input_select.dehumidifier_modes
    platform: state
  action:
    service: midea_dehumidifier.set_mode
    data_template:
      entity_id: humidifier.midea_dehumidifier_18691697838805
      mode: '{{ states.input_select.dehumidifier_modes.state }}'
###
- alias: MideaDehumidifier mode change
  trigger:
    entity_id: humidifier.midea_dehumidifier_18691697838805
    platform: state
  action:
    service: input_select.select_option
    data_template:
      entity_id: input_select.dehumidifier_modes
      option: '{{ states.humidifier.midea_dehumidifier_18691697838805.attributes.mode }}'

I see in step 2 : restart your Shelly, that could be that,
I will power down the whole house (HA server is on UPS) when computers backup is finished in a hour or so

I said there are only two steps, why are you trying to make simple things difficult?

Why are you using position_template and set_position_template? Do you really know what you are doing? Those arguments are for advanced users.

One more thing, your shellies_discovery is not up to date. mode: '{{ trigger.payload_json.mode | default }}' is missing.

If this will not help please open issue here with python_script debug log.

When I post it was not working, I don’t try to make things difficult, I try very hard to understand, same if I have to break things many time and to the basic elements until i have got an functional answer. (It’s nothing wrong playing the dumb guy if it’s for a good cause helping other after), I am at loss here of over 50 hours … for those damn shelly 2.5 ! (COAP flooding the network at first), Trust nothing is straight forward with partial and outdated info out there, especially when they are well spread.

it would be helpful if you reply direct questions, not guessing the answers is reducing a lot the investigation time. I am correct to say your Script should create the cover entities ?

again quiet happy to keep it basic if it work, what the point to re-invent the wheel. position_template and set_position_template should have come somewhere in the time line from a copy/paste of one of the many attempts, and no I am not an advance user, more like a “suffering” user.

according github 0.39.3 is the latest, I updated from hacs. will investigate for missing '{{ trigger.payload_json.mode | default }}'

Sorry, I meant shellies_discovery automation.

Yes

So please remove position_template and set_position_template from your configuration.

I need more information (logs) to ease your suffering.

Amazon delivery deliver my ATX Psu, I was able to start again after replacement ;-))

So today I update all, Shelly 2.5 to FW 1.10.3, Shelly discovery script to 0.39.4, clean up position_template and set_position_template and add ‘{{ trigger.payload_json.mode | default }}’
restart HA, and with Bieniu’s magic powder, everything work .
BIG THANK YOU !

recap:
if Shelly auto discovery (Shelly add-on) see your Shelly 2.5 device, but failed during integration (poor/slow dns response), quit http/Coap for UDP by using MQTT.
to Integrated your 2.5, Bieniu script is fantastic, it will also integrate the cover entities for you.
So install HACS for bieniu script and “slider-entity-row”.
You must pay attention to Shelly firmware version match Bieniu’s script version, and don’t forget to restart your server. this is important if you, like me, has a slow progress and don’t do all the same day.

1 Like