You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There needs to be some sort of mechanism of changing the definition of a scene in response to various situations. For example, I may want a "cozy" scene that is different based on the time of day. Less switches on at night, and dimmer.
The only way of handling that right now is by defining several different scenes, and using a "get the correct scene for this" function. That doesn't fix scenes listed on dashboards, which would bypass this mechanism. It also creates wildly inconsistent code, since there are many ways of tackling this problem.
Instead, this logic should be handled by the room to provide a centralized / standard way of creating this logic.
The text was updated successfully, but these errors were encountered:
Maintain the separate scene definitions, but add a method of altering the call as part of the room
functionExample({ automation, context }: TServiceParams){returnautomation.room({
context,name: "room",scenes: {evening_high: {definition: {}},high: {definition: {},redirectTo(){if(!automation.solar.isBetween("dawn","dusk")){return"evening_high";}// anything not a scene name maps to "high"},},off: {definition: {}},},});}
The intent being that only high gets listed / used in code logic / dashboards, but evening_high is part of the actual room definition. Any time high is set:
room current scene sensor should track the redirect target (evening_high) as an attribute, but report the scene used (high)
redirectTo should take inspiration from managed switches (shouldBeOn):
function must be sync
must return scene name, or undefined (high)
can take in an array of things to also update in response to
This gets checked on initial scene set, and will actively work to keep the scene with the best definition. Bonuses:
keeps alternate scene definitions available for manual calling
There needs to be some sort of mechanism of changing the definition of a scene in response to various situations. For example, I may want a "cozy" scene that is different based on the time of day. Less switches on at night, and dimmer.
The only way of handling that right now is by defining several different scenes, and using a "get the correct scene for this" function. That doesn't fix scenes listed on dashboards, which would bypass this mechanism. It also creates wildly inconsistent code, since there are many ways of tackling this problem.
Instead, this logic should be handled by the room to provide a centralized / standard way of creating this logic.
The text was updated successfully, but these errors were encountered: