Shelly Plus 2PM

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: