following scenario: I have a smart bulb linked with a shelly relay inside the wall switch that controlls the bulb. so when I switch the switch on light goes on, off->off. But not the other way around, ie when the bulb is switched directly or via an automation then the switch does not change mode. Am I overlooking something or is this a bug?
As solution I simply made an automation that makes the bulb toggle whenever the switch changes on/off. That works, but I would really like to know if I misunderstand something about the linked entities.
#linked but not really entirely linked?
1 messages · Page 1 of 1 (latest)
HA does not "link" entities so not a bug. Only "linking" is trough automations.
Is that switch killing the power to the bulb? As that's just a complex scenario.
well, yes, I linked them via the "linked entities" automation. There is no physical connection between bulb and switch. The logic is simply that via the automation their states should be in sync. But it only works from switch to bulb. Not the other way round. If I change the state of the bulb then the state of the switch remains unchanged.
There is no "linked entities" automation. Do you mean you used a blueprint? If so, you need to exactly specify which. As anybody can make and share a blueprint. And not al are great. But certainly, don't confuse it with a building block of HA itself. It is not.
But next, if the switch isn't physically connected you don't need that state to be in sync. You just want to toggle the light on every state change of the switch. Then you don't care if that's on=>off or off=>on. You just want the light to toggle. The state of the switch has no real meaning.
See it as the up or down position of a (non-smart) two-way switch. Switch can be up or down for the light to turn on. It depends on what the other side did. It's the same now only now the other side is virtual/digital/smart.
Ok, to clarify, yes I used the "linked entities" blueprint. And I am starting to assume that it is buggy.
So I moved to exactly what you propose: when the switch is turned on or off it toggles the bulb. However now the bulb is also toggled when the switch goes on or off from any other state (eg unavailable). So I actually DO care about the previous state. Can I get rid of that other than writing two separate automations (1 for when switch goes from on to off only and another for off to on)?
I mean, the UI does not seem to offer it. Can I put it in yaml?
description: ""
triggers:
- type: changed_states
device_id: bf2ed646aa9768d641439f793bda9057
entity_id: e82deb0d4fdd16c7c6e19f5a84d56913
domain: switch
trigger: device
conditions: []
actions:
- type: toggle
device_id: 681efb87dd3116cf9350d5932f818be5
entity_id: 96ff1a4593c6026b8c990383e2e8987c
domain: light
mode: single
HA does have support for it, only weirdly still not in the UI... But you can do:
trigger: state
entity_id:
- switch.foobar
to:
- "on"
- "off"
not_from:
- unknown
- unavailable
To format your text as code, enter three backticks on the first line, press Enter for a new line, paste your code, press Enter again for another new line, and lastly three more backticks.
```yaml
example: here
```
Don't forget you can edit your post rather than repeatedly posting the same thing.
sorry about that...