Shelly 2 as roller shutter with percentage

Hi @destroyer76.

I modified your code and it works fine! Thank you for your fast and good work :+1:t3:

Thanks a lot @woody4165 !!!
It was a very simple thing! But I had not really noticed it! I’m embarassed :smile:

You look very experienced. I’m a programmer but sometimes I went crazy for the simplest things. The documentation of Homa Assistant sometimes is not complete, and I found only in the forums some syntax.
Is there any guide, possibly in Italian, that I can use to study the syntax?

Hi @ClaRod
it was a pleasure. I’m happy to help you :wink:

1 Like

Finally i was able to made shelly works fine in roller mode with position in percent.

But i can’t find a way to get roller power consumption .

This is my code after searching in shelly’s API docs:

cover:
  - platform: mqtt
    name: persiana_estudio
    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"
    payload_open: "open"
    payload_close: "close"
    payload_stop: "stop"
    retain: false
    optimistic: false
    qos: 1
    position_open: 100
    position_closed: 0
sensor:
  - platform: mqtt
    name: "Potencia"
    state_topic: "shellies/shellyswitch-XXXX/roller/power"
    unit_of_measurement: "W"

Has anybody a clue of what i’m doing wrong?

I’m now experiencing this same issue with it randomly opening.

Could you please post the config your using that cured it?

This is my code and it’s working fine

  - platform: mqtt
    name: "Tapparella Finestra 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"
    availability_topic: 'shellies/shellyswitch-xxxxxx/online'
    unique_id: 'Shelly Tapparella finestra sala'
    qos: 0
    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
2 Likes

Thanks a lot. Apart from Unique ID, that’s what I have.

What settings do you have on the Shelly 2 with regard to Clean and Retain?

It’s driving me nuts that I get these random openings. If I remove the MQTT settings on the Shelly it’s fine so it’s being ‘told’ to open from somewhere.

Clean is flagged and Retain is not flagged and QOS is 0

If it’s random opening most probably is the retain

That’s the opposite of what I have but my garage door is set with Retain flagged and Clean not and I don’t have a problem with that.

I also have Power On Parameters set to STOP, though I don’t think it’s a power on issue.

The hunt continues!

If you have retain and you have a message sent when there is a connection failure, the message will be executed when the connection will come back.
And this can happen any time.

What is the QOS value you have?

Maybe the garage has a better wifi signal than the other shelly.

Thanks.

QOS is set to 0.

So, with Clean, it will alway wait for a new command, even on Power UP, is that correct?

Although, now that I think about it, I’ve now sent it any commands and it’s still randomly opened. I suspect that it’s something to do with the Position Slider as it doesn’t open fully.

I’ll set it to Clean and see what happens.

You can take a look at this article, at the end there is a table that describes all the possibilities between retain, QOS and clean session…

Thanks for that. A really informative article.

I’m monitoring publications to the two command topics. It seems ‘80’ is being published to the position topic but so far I’ve no idea where from.

Hi guys,

with the following configuration everything works fine.
But in my log i found the following statement
cover:

  • platform: mqtt
    name: “Jalousie Kueche”
    state_topic: “shellies/shellyswitch-x/roller/0”
    command_topic: “shellies/shellyswitch-x/roller/0/command”
    position_topic: “shellies/shellyswitch-x/roller/0/pos”
    set_position_topic: “shellies/shellyswitch-x/roller/0/command/pos”
    payload_open: “open”
    payload_close: “close”
    payload_stop: “stop”
    retain: false
    optimistic: false
    qos: 1
    position_open: 100
    position_closed: 0
    value_template: ‘{{ value.x }}’
    I got also the position and every time the status of the Shelly.
    But i found something strange in my log.
    Can anyone help me what is here the problem?

Payload is not integer within range: -1
13:43 components/mqtt/cover.py (WARNING)

Maybe it’s because it assumes a value outside the range 0-100.
Try to do again a calibration.

Before, you can try to comment the line value_template: and see if there is the warning and everything works fine.

Thanks, that was the issue.
I calibrate the stuff again and the error is now solved.
Thanks @woody4165

Home%20Assistant%202019-03-09%2019-51-58

Hi everybody,
I’m quite new with home-assistant. I was wondering if anybody could sum-up the configuration to get the shelly2 roller shutter with slider, I had a hard time following the conversation.
Thanks!

My working configuration is here, but you can find a lot in this thread.

I get again the following issue from my log files.
My shutter is successfully calibrated.
Can anyone help me what is here the problem?

Payload is not integer within range: ‘’
08:24 components/mqtt/cover.py (WARNING)

wrong post , see below