My question was actually answered and i willl set this back to “resolved”, but i first have another additional question and issue.
Unless this should be put in a different post, then i will
So i got this working with method nr2 of your link.
I do have another question tho.
Could you explain what the postupdate is for please, i dont get it?
Scene_Wakeup.postUpdate(OFF)
Then for my issue: thing is i can set my scene to on without any problems but not to off.
The google device says its turning it off when i ask but nothing happends.
Same thing with the switch i created in my Sitemap, same bahavior.
Am i doing something wrong?
rule "Etenstijd"
when
Item Scene_Eten received command ON
then
logInfo("Scene Etenstijd gestart", "bjorn en lili licht aan bij starten van de scene")
Officebjornlicht.sendCommand(ON)
Officelililicht.sendCommand(ON)
end
Both, officebjornlight and officelililight also have the tag [ “Lighting” ] if this matters.
Any idea please?
Need to add Scene_Eten.postUpdate(OFF) to your rule like below.
rule "Etenstijd"
when
Item Scene_Eten received command ON
then
logInfo("Scene Etenstijd gestart", "bjorn en lili licht aan bij starten van de scene")
Officebjornlicht.sendCommand(ON)
Officelililicht.sendCommand(ON)
Scene_Eten.postUpdate(OFF)
end
thx for ur reply!
i tried changing “switchable” to “scene” but then it doesnt work at all.
But either way i think i am doing something wrong and the above is not the issue.
let aside the google home, i am having this issue even when using my Basic UI button, it is the same issue.
I can turn my both lights on when i switch my switch.
But when i turn the switch back off, nothing happends.
this is what i see in my logs:
2018-11-25 17:46:50.236 [INFO ] [model.script.Scene Etenstijd gestart] - bjorn en lili licht aan bij starten van de scene
2018-11-25 17:46:50.252 [ome.event.ItemCommandEvent] - Item 'Officebjornlicht' received command ON
2018-11-25 17:46:50.268 [ome.event.ItemCommandEvent] - Item 'Officelililicht' received command ON
2018-11-25 17:46:50.278 [vent.ItemStateChangedEvent] - Officebjornlicht changed from OFF to ON
2018-11-25 17:46:50.287 [vent.ItemStateChangedEvent] - Officelililicht changed from OFF to ON
2018-11-25 17:46:53.877 [ome.event.ItemCommandEvent] - Item 'Scene_Eten' received command OFF
2018-11-25 17:46:53.893 [vent.ItemStateChangedEvent] - Scene_Eten changed from ON to OFF
My idea was because it is a switch it would be able to do the reverse.
i get why the “postupdate” has to be there now
How would you handle my issue?
Would you create a off rule or do u never use a Scene like “on” “off”?
Suppose i can make the same rule again but with the name “stop scene dinner”, but is this how you would advise?
I’m new to writing rules this way but you can test this to see if it works.
rule "Etenstijd"
when
Item Scene_Eten received command ON
then
logInfo("Scene Etenstijd gestart", "bjorn en lili licht aan bij starten van de scene")
Officebjornlicht.sendCommand(if(Officebjornlicht.state == ON) ON else OFF)
Officelililicht.sendCommand(if(Officelililicht.state == ON) ON else OFF)
Scene_Eten.postUpdate(OFF)
end
The rule should change the light to it’s opposite state every time Scene_Eten receives command ON.
EDIT: Now the rule has been tested and works, credit goes to @rlkoshak for showing me how to use edge cases. Thanks Rich
ok, ok, getting there.
had to change the code a little bit:
rule "Etenstijd"
when
Item Scene_Eten received command ON
then
logInfo("Scene Etenstijd gestart", "bjorn en lili licht aan bij starten van de scene")
//Officebjornlicht.sendCommand(ON)
//Officelililicht.sendCommand(ON)
Officebjornlicht.sendCommand(if(Officebjornlicht.state == OFF) ON else OFF)
Officelililicht.sendCommand(if(Officelililicht.state == OFF) ON else OFF)
Scene_Eten.postUpdate(OFF)
end
but the button indeed works.
obviously i trigger 2x a “on” position, so with the postupdate back to “off” this works rly well in the basicUI.
Small thing when now trasferring this to my google… is that i have to say “dinner time ON” for turning it on and turning it off.
But this is minor… seems i can just say “dinner time” without on or off and it will choose the “on” option by default.
When google replies it obviously says “dinner time turned on”
that actually works !
then i got my perfect example to start creating more rules
Thx!
maybe a stupid question,
i use a custom png icon, this disappears when using the button, any idea?
my guess it that this reprents a off state as icon, not on, not sure tho
And i only have this issue with my 1-in-use custom icon
Let me clear something up about the use of the Scene rules from my post that was linked above, specifically for method #2.
Each Scene rule is for a different set of light states, colors, etc… that you want to set when that “Scene” is selected (either via a BasicUI switch or via Google). The switch that selects the scene has nothing to do with the actual light states - think of it as a momentary pushbutton (you press the button, the lights go to their predefined states, you release the pushbutton). If you want a different set of states (a different “scene”), you need another “pushbutton” (i.e. another scene/rule).
All the postUpdate(OFF) does is set the Scene pushbutton OFF after you’ve pressed it ON (handling the “momentary” functionality of it).
As you’ve found out, keep the “Switchable” tag on these Scene switches - I haven’t played around with the “Scene” tag in Google Assistant yet, so I don’t know how it differs from a “Switchable” or how it affects my Scene rules in the referenced post.
what an honor to have you reply to my post
Thx for you reply.
All very clear of what you say.
And yes, another movie also said to only use 3 items and not the [“scene”] , switchable, lightening, something with temp, but was a good try
Now as i have been testing.
H102 asked me to:
This seems to be working as well.
What are your thoughts?
EDIT: actually now i come to think of it, this part matters aswell for this to work:
Officebjornlicht.sendCommand(if(Officebjornlicht.state == OFF) ON else OFF)
Officelililicht.sendCommand(if(Officelililicht.state == OFF) ON else OFF)
I dont think i get what u mean.
i have in my sitemap a category “scenes” and in this category i have my switch “dinner time”, it is about that icon i was talking about.
Tried this same icon on the category name, and this has no issue.
though i dont have buttons directly available in my homepag of my sitemap
Yeh, when i was writing starting thinking of some more scenarios where i would want to use it like you said.
But am i correct when i say that you can not turn of your scenes?
U need to turn them off one by one or change to a different scene to do this?
You did not create a “off” scene either then?
and i think i need to start adding a lot of lamps at the start of a scene to turn off in case they were on