Context
The automation.managed_switch workflow is very useful, being able to take a callback and list of entities to react to, then turning that into service calls.
automation.managed_switch({
context,
entity_id: "switch.dragonfly_lights",
onUpdate: [officePlants, meetingMode, isHome],
shouldBeOn() {
if (!isHome.is_on) {
return false;
}
if (meetingMode.is_on) {
return true;
}
return !automation.time.isBetween("AM1:30", "PM4");
},
});
Synapse builds on the pattern with SettableConfiguration, which is set on specific properties across the library.
synapse.switch({
context,
is_on: {
current() {
return !binary_sensor.is_on;
},
onUpdate: [binary_sensor],
},
name: "Example switch",
});
For hass internal domains, this type of functionality should be available directly on the entity proxy.
hass.refBy.id("switch.example").manage({
current() {
return true | "on"
},
onUpdate: [],
schedule: ...
})
This will require some manual mapping of domains to specific service calls in order to work correctly
Context
The
automation.managed_switchworkflow is very useful, being able to take a callback and list of entities to react to, then turning that into service calls.Synapse builds on the pattern with
SettableConfiguration, which is set on specific properties across the library.For hass internal domains, this type of functionality should be available directly on the entity proxy.
This will require some manual mapping of domains to specific service calls in order to work correctly