Shelly Plus 2PM

Hello all,

does someone know if it’s possible to report the position of the blinds (or in my case it’s a roof hatch) with a Shelly Plus 2PM and ESPHome?

I’d like to avoid repeating the mistake I did with the blinds, I used a z-wave switch from Technisat which is not reporting the position. Hence, every time someone uses the switch manually, Home Assistant has no idea what the actual position of the blinds are and changing the position using Home Assistant will require to first open all the way or close of the way and then set to the new desired position…

Yes, Shelly 2pm reports position natively.

1 Like

Nice, thanks, I assume it’s possible with ESPHome as well? I couldn’t see a sensor for the position when looking at the documentation.

Why do you need esphome?

You don’t need esphome, position is a state attribute.

Yes it does. Cover position.

1 Like

Hey there,
does not have something to do with ESPhome, but my shelly plus 2 PM does not have entities called “cover position”.
Where could i find them?

Do i have to activate something in settings in the shelly app?

1 Like

Hi there, same problem on my side, the Shelly Plus 2PM doesn’t have an entity for cover position that is supposed to be natively integrated.

Even stranger, a script that will set position works, there is just no position reported.

device_id: xxx
domain: cover
entity_id: xxx
type: set_position
metadata:
  secondary: false
position: 40

Did anyone solve this issue?
Thanks!

I figured it out, took me a while, you need a template:

{{ state_attr('cover.mycover', 'current_position') }}

I got it while reading more about state objects, so I’ll share for next ones wondering

  • the “global” status is the state of cover.<device_name>
  • the position is a state attribute of this object, it is in cover.<device_name>.current_position
    You can see all of this in Developper tools > State.

To be able to manipulate easier the position, we’d like to make a distinct sensor object where the entity would be sensor.<device_name>_position and the value would be the position.

For the sake of the experiment, I’ve been setting the following template in configuration.yaml file.

sensor:
  - platform: template
    sensors:
      <device_name>_position:
        value_template: "{{ state_attr('cover.<device_name>', 'current_position') }}"
        unit_of_measurement: percent

This well creates a state with the right value, but doesn’t attach it to the device.
I don’t think that’s possible to attach a custom entity to a device, but if someone could confirm so I can stop searching about it that would be pretty nice :slight_smile:

Edit: it seems that it’s somehow possible using this custom HACS integration but seems to act at quite low level and might break some core config, I’d love a native way to do it.
The topic of attaching custom objects to a device seems heated in the community. :slight_smile:

Another thing I noticed is, in an automation, it’s possible to set a condition using the position of the cover/shutter, in the GUI.

The resulting yaml looks like this:

  - condition: device
    device_id: 54a94e9c05bc11ca708bd986d241bfc1
    domain: cover
    entity_id: cover.left_shutter
    type: is_position
    below: 35