Thanks. I played around with the refresh. It takes 5-7 seconds to refresh 10 bulbs. Yikes. My idea was to do a refresh() once the toggle button was pressed before checking on/off. But since that added this large delay I decided to put the refresh AFTER the lifx scene. This way the scene activation happens right away, but also means that if you have to wait at least 5-7 seconds after pressing the toggle button before you can do it again. I’d really like this to be closer to 1-2 seconds.
One idea is to do a mix of this plus my own state tracking. You see, I can’t do my own state tracking within webCoRE because another app like LIFX app may change the bulb state. But perhaps I can do a hybrid and track state of the button press. Because the main condition I care about is when someone presses the button.
Also do you know why a single button press is causing this code to run twice? Press the button once and the top IF’s GETS PUSHED is true which is good. But then 1 second later this routine executes again (according to the trace) exactly like the button was pressed a second time.
Okay, this is a fairly straight forward piston - if any of 3 light switches changes to on, then turn all 3 on. If any change to off, turn all 3 off. But I’m getting the dreaded “Piston waited at a semaphore for…” errors - why?
I thought about using IS, but I think that would be a problem because as they are turning on or off some will always be in other state which should reverse the piston - repeatedly, no?
Thanks but I’m not sure what part of my message you’re referring to or how that ties in. In particular I’m trying to figure out why a single press of the button is causing the trigger (“if button 7 is pushed”) to fire twice in a row, a second apart?
Can anyone please point me in the right direction for a way of counting the number of people present (mobile presence devices) and either setting that as a variable or setting it to display on a modified dth of some sort?
My plan is so that webcore will know how many people are at home and do different actions depending on the amount of us home.
In this particular case, yes. I have an All Off and All On scene. All Off scene has all bulbs turned off, and All On has all bulbs turned on and at 100% level brightness.
@ady624 It seems that in the process of playing around with this piston that I have somehow broke the Active LIFX Scene command. According to my logs, the Active LIFX Scene is getting called. But the scene never activates. I pulled up my LIFX app and was able to activate the same scenes instantly using the LIFX app, immediately responsive no matter how many times I try. Yes as I keep trying webCoRE with Active LIFX scene, the same scenes never trigger.
I did notice this in my logs:
+10799ms ║║Error while activating LIFX scene: java.net.SocketTimeoutException: Read timed out
+10801ms ║║Executed virtual command lifxScene (10118ms)
Also I had a similar Piston in CoRE. So I paused my webCoRE piston, then unpaused my CoRE piston, and that older CoRE piston also did not update the LIFX scene when it should have.
It’s as if I broke the API or something. I put my CoRE piston back on pause and unpaused my new webCoRE piston, but the issue persists.
Any idea what caused this and how to troubleshoot it further? Is there a way to reset things?
I was very impressed with myself when this piston initially seemed to be working, but the euphoria did not last long - it pushes the “Turned On at #” message out more or less every 5 minutes.
How should I change my piston to prevent that from happening? Any other suggestions would be appreciated:
2017/06/12, 20:42:56 +119ms
+1ms ╔Received event [Home].time = 1497292977096 with a delay of -978ms
+207ms ║RunTime Analysis CS > 23ms > PS > 87ms > PE > 97ms > CE
+222ms ║Runtime (42255 bytes) successfully initialized in 87ms (v0.2.0bc.20170611) (218ms)
+223ms ║╔Execution stage started
+280ms ║║Calculating (string) Heater + (string) Turned ON at >> (string) Heater Turned ON at
+286ms ║║Calculating (string) Heater Turned ON at + (string) Mon, Jun 12 2017 @ 8:42:56 PM SAST >> (string) Heater Turned ON at Mon, Jun 12 2017 @ 8:42:56 PM SAST
+291ms ║║Calculating (string) Heater Turned ON at Mon, Jun 12 2017 @ 8:42:56 PM SAST + (string)
+309ms ║║Executed virtual command [Heater].sendNotification (13ms)
+331ms ║║Calculating (string) Heater + (string) Turned ON at >> (string) Heater Turned ON at
+338ms ║║Calculating (string) Heater Turned ON at + (string) Mon, Jun 12 2017 @ 8:42:56 PM SAST >> (string) Heater Turned ON at Mon, Jun 12 2017 @ 8:42:56 PM SAST
+343ms ║║Calculating (string) Heater Turned ON at Mon, Jun 12 2017 @ 8:42:56 PM SAST + (string)
+368ms ║║Executed virtual command [Heater].sendPushNotification (17ms)
+392ms ║║Calculating (string) + (string) Heater >> (string) Heater
+399ms ║║Calculating (string) Heater + (string) Turned On at >> (string) Heater Turned On at
+405ms ║║Calculating (string) Heater Turned On at + (string) Mon, Jun 12 2017 @ 8:42:56 PM SAST >> (string) Heater Turned On at Mon, Jun 12 2017 @ 8:42:56 PM SAST
+411ms ║║Calculating (string) Heater Turned On at Mon, Jun 12 2017 @ 8:42:56 PM SAST + (string) >> (string) Heater Turned On at Mon, Jun 12 2017 @ 8:42:56 PM SAST
+416ms ║║Executed virtual command [Heater].setState (2ms)
+436ms ║║Comparison on is on = true (4ms)
+438ms ║║Condition #79 evaluated true (19ms)
+440ms ║║Condition group #72 evaluated true (state did not change) (21ms)
+451ms ║╚Execution stage complete. (229ms)
+454ms ║Setting up scheduled job for Tue, Jun 13 2017 @ 12:00:00 AM SAST (in 11823.428s)
+481ms ╚Event processed successfully (481ms)
2017/06/12, 20:42:50 +44ms
+1ms ╔Received event [Guest Bedroom].mode = heat with a delay of 141ms
+914ms ║RunTime Analysis CS > 44ms > PS > 663ms > PE > 208ms > CE
+929ms ║Piston waited at a semaphore for 583ms
+932ms ║Runtime (42323 bytes) successfully initialized in 663ms (v0.2.0bc.20170611) (929ms)
+933ms ║╔Execution stage started
+961ms ║║Comparison 1497292970989 is_between 1497218460000 .. 1497218400000 = true (9ms)
+965ms ║║Condition #80 evaluated true (19ms)
+967ms ║║Cancelling statement #80's schedules...
+981ms ║║Requesting time schedule wake up at Tue, Jun 13 2017 @ 12:00:00 AM SAST
+1002ms ║║Comparison 14.7 is_less_than 17.0 = true (3ms)
+1005ms ║║Condition #81 evaluated true (21ms)
+1017ms ║║Comparison :6c38c9bd0bf40f1421e41b87261f9d56: is_not_any_of :505876b20778b1965e8cabb2f3b7eb16:,:d4a1c39210d8b16919d75a9820dcd40c: = true (5ms)
+1019ms ║║Condition #82 evaluated true (13ms)
+1021ms ║║Condition group #63 evaluated true (state did not change) (77ms)
+1027ms ║║Cancelling statement #73's schedules...
+1041ms ║║Skipped execution of physical command [Heater].on([]) because it would make no change to the device. (5ms)
+1042ms ║║Executed [Heater].on (7ms)
+1049ms ║║Executed virtual command [Heater].wait (1ms)
+1051ms ║║Requesting a wake up for Mon, Jun 12 2017 @ 8:42:57 PM SAST (in 6.0s)
+1062ms ║╚Execution stage complete. (130ms)
+1065ms ║Setting up scheduled job for Mon, Jun 12 2017 @ 8:42:57 PM SAST (in 5.988s), with 1 more job pending
+1161ms ╚Event processed successfully (1162ms)
(I use the piston to turn on a heater. Currently, I have the time set so that it runs around the clock for testing purposes, but the plan is to change it later to only run during night time hours)
I’m not sure but I’m guessing that every time the temp is reported, and the piston is true, it runs. Not sure though.
Just as an aside, in your first statement, if you want it to run every day, you do not need to select all the days. Leave it blank and it will run everyday anyway.
Anyone know why this piston is not running every 5 and 10 minutes like it is supposed too. Every few days, I’ll have to pause and resume this piston to get things back on schedule until the next time I have to pause and resume again.
Thanks. (I added the dates because I want to use this piston as one of my master pistons - other pistons will only be running on weekdays e.g.)
Any suggestion how to prevent the piston from reporting every time the temperature changes? Maybe set it up to only send the notification if the Heater changes from Off to On (and visa verse), but I don’t know if this is an elegant way of doing it.
Ok, thanks. Odd I only have scheduling issues with 2 pistons. This one and other one where the schedule just disappears from time to time. All other pistons with schedules seem to be just fine. I’m sure @ady624 has it on the to-do-list so I’ll be patient.
You could set a variable (boolean=true or false) when the temp is below the desired level, or maybe a virtual switch that is on when temp below the desired level or off when above.
I have a series of virtual switches that turn on or off depending on various levels of lux because I had the same issue every time a lux change was reported. Makes things a bit more complicated but it works for me.
Here it is just for information. This could be global variables instead of virtual switches but this was written before global variables were fully supported.
Can I get some help please? I have setup a piston to record air quality with my Netatmo weather station. It is recording air quality to an integer however the piston is showing to lots of decimal places: