Using a 'read only' device in an automation

Hello awesome folks

I have a SONOFF POWR3 installed and linked via the eWeLink integration. However this device shows up as ‘read only’ - which I understands means you can’t update it’s state via the interface. (aka I can’t use the visual automation builder and switch.toggle to … well, toggle the switch.

So I’m trying to do this in YAML

alias: Lounge remote toggle the hot water cylinder
description: >-
  Double clicking the 4th button on the remote will toggle the hot water
  cylinder
trigger:
  - device_id: xxx111xxx
    domain: zha
    platform: device
    type: remote_button_double_press
    subtype: button_4
condition: []
action:
  - service: switch.toggle
    target:
      entity_id: switch.SonoffDevice_ID
  - service: input_boolean.toggle
    data: {}
    target:
      entity_id: input_boolean.isthehotwatercylinderon
  - service: notify.mobile_app_iphone
    data:
      message: Hot Water Cylinder {{ states("input_boolean.isthehotwatercylinderon") }}
      title: The Hot Water Cylinder has been triggered
mode: single

The automation runs and every step triggers, except the switch.toggle for the switch.SonoffDevice_ID

What am I missing here to get this to work?
Any help/thoughts much appreciated … or should I just invest more time in learning NodeRed - and can I update a ‘read only’ device via NodeRed (I seem to have hit and miss success with NR :frowning: )

The device being read-only means you cannot change its state. The visual editor doesn’t let you configure it because it wouldn’t work. In yaml, you can configure it (as you can basically configure anything), but that doesn’t mean it’ll suddenly work. The same goes for Node Red. What you need to do is get to the source and fix the problem of it being a read-only device in HA.

1 Like

Hmm interesting.
So the message I see on the Read Only part is this

does not have a unique ID, therefore its settings cannot be managed from the UI. See the documentation for more detail.

And the documentation (if I read it right) would imply that I need the eWeLink integration folks to update/change/fix their integration? Feels like (again I’m new to this so I am probably wrong) nothing I can do myself to resolve this?

Go to your devices under settings (on HA) and click on the device there. Do you see the switch there and does it work?

Yes and it works as expected :slight_smile:

If your switch then works on the device page, there’s no reason you can’t switch or toggle it in a script or automation, or interacting with it from your own button on the UI.