Changing the temperature of the lights depending on the mode


#21

ok so this is the last bug i have and the logs. When i went to home from evening it sent the evening temperature and level? any ideas

28/08/2017, 22:15:26 +143ms
+0ms ╔Received event [Home].time = 1503954926965 with a delay of -823ms
+247ms ║RunTime Analysis CS > 20ms > PS > 61ms > PE > 166ms > CE
+260ms ║Runtime (45866 bytes) successfully initialized in 61ms (v0.2.0e5.20170812) (259ms)
+261ms ║╔Execution stage started
+339ms ║║Executed physical command [Hallway].off() (24ms)
+340ms ║║Executed [Hallway].off (26ms)
+342ms ║║Condition #71 evaluated true (37ms)
+343ms ║║Condition group #70 evaluated true (state did not change) (40ms)
+353ms ║║Comparison (string) :00a05f15f14bac7fcf8b8b721fbdb88b: changes_to (string) :964d0cd483c8df461f20eef29b039dab: = false (1ms)
+355ms ║║Condition #48 evaluated false (7ms)
+357ms ║║Condition group #38 evaluated false (state did not change) (9ms)
+368ms ║║Comparison (enum) on is (string) off = false (3ms)
+371ms ║║Cancelling condition #73’s schedules…
+372ms ║║Condition #73 evaluated false (14ms)
+373ms ║║Cancelling condition #72’s schedules…
+374ms ║║Condition group #72 evaluated false (state changed) (17ms)
+379ms ║╚Execution stage complete. (117ms)
+389ms ╚Event processed successfully (390ms)
28/08/2017, 22:15:21 +558ms
+1ms ╔Received event [Home].mode = Home with a delay of 89ms
+219ms ║RunTime Analysis CS > 20ms > PS > 64ms > PE > 135ms > CE
+230ms ║Runtime (45869 bytes) successfully initialized in 64ms (v0.2.0e5.20170812) (228ms)
+232ms ║╔Execution stage started
+250ms ║║Comparison (enum) on is (string) on = true (2ms)
+252ms ║║Condition #19 evaluated true (12ms)
+253ms ║║Condition group #null evaluated true (state did not change) (15ms)
+265ms ║║Comparison (string) :00a05f15f14bac7fcf8b8b721fbdb88b: changes_to_any_of (string) :11caac43340ed2b1de78f41f4f00219f:,:00a05f15f14bac7fcf8b8b721fbdb88b: = true (4ms)
+268ms ║║Cancelling condition #16’s schedules…
+269ms ║║Condition #16 evaluated true (11ms)
+270ms ║║Cancelling condition #1’s schedules…
+272ms ║║Condition group #1 evaluated true (state changed) (15ms)
+286ms ║║Comparison (enum) off is (string) on = false (3ms)
+289ms ║║Condition #61 evaluated false (12ms)
+290ms ║║Condition group #58 evaluated false (state did not change) (15ms)
+300ms ║║Comparison (string) :00a05f15f14bac7fcf8b8b721fbdb88b: changes_to (string) :aedfd61dabbaf2b5c3fc647f35488f2d: = false (1ms)
+303ms ║║Condition #36 evaluated false (7ms)
+304ms ║║Condition group #26 evaluated false (state did not change) (9ms)
+315ms ║║Comparison (enum) off is (string) off = true (3ms)
+317ms ║║Cancelling condition #71’s schedules…
+321ms ║║Cancelling statement #27’s schedules…
+348ms ║║Executed physical command [Hallway].on() (23ms)
+348ms ║║Executed [Hallway].on (25ms)
+372ms ║║Executed physical command [Hallway].setColorTemperature([4000]) (18ms)
+373ms ║║Executed [Hallway].setColorTemperature (20ms)
+399ms ║║Executed physical command [Hallway].setLevel([60]) (21ms)
+400ms ║║Executed [Hallway].setLevel (22ms)
+405ms ║║Executed virtual command [Hallway].wait (1ms)
+407ms ║║Requesting a wake up for Mon, Aug 28 2017 @ 10:15:26 PM BST (in 5.0s)
+412ms ║║Condition #71 evaluated true (106ms)
+413ms ║║Cancelling condition #70’s schedules…
+414ms ║║Condition group #70 evaluated true (state changed) (109ms)
+424ms ║║Comparison (string) :00a05f15f14bac7fcf8b8b721fbdb88b: changes_to (string) :964d0cd483c8df461f20eef29b039dab: = false (1ms)
+426ms ║║Condition #48 evaluated false (7ms)
+428ms ║║Condition group #38 evaluated false (state did not change) (8ms)
+439ms ║║Comparison (enum) off is (string) off = true (3ms)
+441ms ║║Cancelling condition #73’s schedules…
+445ms ║║Cancelling statement #39’s schedules…
+468ms ║║Executed physical command [Hallway].on() (20ms)
+469ms ║║Executed [Hallway].on (21ms)
+491ms ║║Executed physical command [Hallway].setColorTemperature([2700]) (17ms)
+492ms ║║Executed [Hallway].setColorTemperature (19ms)
+520ms ║║Executed physical command [Hallway].setLevel([20]) (23ms)
+521ms ║║Executed [Hallway].setLevel (25ms)
+526ms ║║Executed virtual command [Hallway].wait (1ms)
+528ms ║║Requesting a wake up for Mon, Aug 28 2017 @ 10:15:27 PM BST (in 5.0s)
+533ms ║║Condition #73 evaluated true (103ms)
+534ms ║║Cancelling condition #72’s schedules…
+535ms ║║Condition group #72 evaluated true (state changed) (107ms)
+540ms ║╚Execution stage complete. (309ms)
+543ms ║Setting up scheduled job for Mon, Aug 28 2017 @ 10:15:26 PM BST (in 4.865s), with 1 more job pending
+583ms ╚Event processed successfully (582ms)


#22

Minions have voted unanimously (ok, only 6 bothered to vote lol) to allow all users to mention @webCoRE_Minions.

I’ll make the setting change now.

Edit - it’s done… you can now nag all of us in one easy mention :grimacing:


#23

:open_mouth::grimacing: I may have opened a can of worms!

I will remember that with great power, comes great responsibility :wink:


#24

This is where i have got to for tonight, i’m still getting something wrong somewhere but can’t find out why it goes down the wrong way sometimes. ive tweaked it again rightly or wrongly, what i have noticed is sometime when it goes to the wrong level/ temp, it turns off like it should but then randomly turns back on and goes to the different temp/ level. Im wondering if its a ST issue, rather than WC?


#25

Just had a thought is there a maximum number of pistons that can be fired at once? As a most of my pistons are fired depending on the location mode, I’m wondering if that is why I’m getting random issue?


#26

Hi @webCoRE_Minions,

I’ve got this as far as I can on my own and it works well ish, but it still randomly goes to the wrong level or colour. I have 3 of these same pistons for 3 different lights and I will eventually have 4, would that have anything to do with it? Any help to get this fixed would be greatly appreciated.


#27

I think the issue might be the use of ‘changes to’… as this will tend to fire twice (once for changing to that mode, and again 20 seconds of so later when it is no longer classed as recently ‘changed’.

Therefore when you change mode, your actions will fire as planned, but 20 seconds later the ‘else’ section will fire.

Try using ‘Location mode IS…’ instead.


#28

Does this make sense?


#29

This makes sense with what seems to be happening, but if that’s the case with ‘changes to’ what situation could you use it for? Also how would it cause it to trigger, does it constantly monitor the state, so essentially its always running?


#30

Brilliant thanks guys

Would this work? Didn’t realise you could write it like that, the simplicity of it is genius!

Im testing both ideas and will report back :smile:

many thanks


#31

Most certainly can do it like this haha.

Also if you have several different pistons like this then you could do this for all of them in the same piston.


#32

This was the winner! meny many thanks! with the location as ‘IS’ it seemed to go on a constant loop and went through all the possible options then when i turned it off it turned back on, god knows why?

like this?


#33

No need for all the extra if statements. Just add multiple lights into the first with statement and the else with statement

edit: Could you clarify why you have the if switch is on and else?

If you need the if switch is on else off then you can do it like this.


#34

And then because the async is on it will fire them all?
I did think I should be able to do one step less but as it was late, was going to look at it again today, but this makes sense.

Yeah it’s because I want the modes to change but I don’t want the lights to be left on if there not being used, so if they are off they turn on to receive their levels then turn back off. :smile:

If anyone wants the finished piston here it is many thanks to all that helped :smiley:


#35

Hi @c1arkbar, had to make some changes to the piston because of something else i implemented would this cause a issue?