Set up piston to use data from API


#1

I am trying to have my hub automatically change the mode to “Shabbat/Holiday” mode based on data from an API.

The API’s URL is: https://www.hebcal.com/hebcal/?v=1&cfg=json&year=now&month=now&maj=on&c=on&m=72&b=18&geo=zip&zip=11230

What I’m looking to do is as follows:

  1. Turn on “Shabbat/Holiday” mode at “Candle lighting”
  2. Keep “Shabbat/Holiday” mode on until “Havdalah (72 min)” (which can be 1 or 2 days later)

Note: “Havdalah (72 min)” & “Candle lighting” are under “title” in the JSON data

Things To Keep In Mind

  • Because holidays aren’t at a consistent interval, whenever there is a holiday in the data it is noted by an additional object right before the object with the properties for the holiday.
  • At this point in time I don’t need the system to differentiate if it’s Shabbat or if it’s a holiday, though it would be cool to be able to use that at a later date.

Link to info about the API: https://www.hebcal.com/home/195/jewish-calendar-rest-api

Thank you very much in advanced!


#2

I count six “Candle lightings” over a month’s time…

If you are starting from scratch, I think the answers to your questions will take 4-5 hours to do properly…


#3

Honestly, with the month nearly over, I would cheat a bit, and just hard code webCoRE to do X on specific dates at specific times.

This way, you have 11 months to work on next years piston, LOL


#4

If the holiday details can be added to, or are available as a google calendar, there is a simple solution.

I use the Gcal smart search smart app. This allows your google calendar to be searched for a calendar entry containing specific text. It then toggles on a virtual switch, at the end of the event it toggles off again. You can easily check this in webcore to set your presence mode.

I use this to set holiday mode.


#5

@Paul1964 :thinking: That’s an interesting idea. Thanks!

@WCmore I don’t mind spending the time but I am having a hard time figuring out what I need to do. Would u be able to give me a rough outline?


#6

Here is what I meant by “hard coding”

Obviously, this is only accurate for 2019, but with your time restraints, it seems like the best path this time around.

Also, feel free to complexify the alerts/lights etc. This is just the basic structure to get you heading in the right direction.


This method gives you 11 months to brush up on your advanced webCoRE logic such as:

  • Querying an external API or JSON
  • Parsing JSON dataPoints
  • Storing JSON data in a variable
  • Converting that variable to time and dates understood by webCoRE
  • Using those variables as schedules
  • Adding dummy code to keep the variables up to date
  • etc…

The crash course to learning (and become familiar with) all of these will take many many hours…


#7

Thank you @WCmore for your guidelines.

I tried out something. What you think?

The only issue I’m having right now, is that I’m getting an error: “Error retrieving JSON data part null”

I have a feeling it has something to do with the way I set it up to pull out the time data. They give me a date and time as “2000-09-06T19:01:00-04:00” (this would be 7:01 PM Eastern Time on 9/6/2019 - I believe the "-04:00 part is the time zone). As you can see in the piston I am able to pull out of this 7:01 PM but I have a feeling it’s not being recognized as a time by webCoRE or that it’s not being encoded into the “Candle Lighting” variable properly. Does this make sense?

Here are my logs:
9/20/2019, 5:25:49 PM +768ms
+183ms ╔Stopping piston…
+304ms ╚Piston successfully stopped (122ms)
9/20/2019, 5:25:47 PM +55ms
+0ms ╔Received event [Home].time = 1569014748310 with a delay of -1255ms
+187ms ║RunTime Analysis CS > 20ms > PS > 133ms > PE > 33ms > CE
+190ms ║Runtime (52257 bytes) successfully initialized in 133ms (v0.3.10f.20190822) (189ms)
+191ms ║╔Execution stage started
+215ms ║║Error retrieving JSON data part null
+219ms ║║Error retrieving JSON data part null
+225ms ║║Comparison (string) 2019-9-20 is_equal_to (string) 2019-9-20 = true (1ms)
+227ms ║║Condition #82 evaluated true (24ms)
+230ms ║║Error retrieving JSON data part null
+234ms ║║Comparison (dynamic) is (string) candles = false (1ms)
+235ms ║║Condition #83 evaluated false (7ms)
+236ms ║║Condition group #81 evaluated false (state did not change) (34ms)
+251ms ║║Error retrieving JSON data part null
+255ms ║║Error retrieving JSON data part null
+261ms ║║Comparison (string) 2019-9-20 is_equal_to (string) 2019-9-20 = true (2ms)
+262ms ║║Condition #88 evaluated true (23ms)
+265ms ║║Error retrieving JSON data part null
+268ms ║║Comparison (dynamic) is (string) havdalah = false (1ms)
+270ms ║║Condition #89 evaluated false (7ms)
+271ms ║║Condition group #87 evaluated false (state did not change) (33ms)
+274ms ║╚Execution stage complete. (83ms)
+276ms ║Setting up scheduled job for Fri, Sep 20 2019 @ 5:25:58 PM EDT (in 10.98s)
+284ms ╚Event processed successfully (284ms)
9/20/2019, 5:25:37 PM +93ms
+1ms ╔Received event [Home].time = 1569014738310 with a delay of -1218ms
+239ms ║RunTime Analysis CS > 38ms > PS > 164ms > PE > 37ms > CE
+242ms ║Runtime (52257 bytes) successfully initialized in 164ms (v0.3.10f.20190822) (240ms)
+243ms ║╔Execution stage started
+271ms ║║Error retrieving JSON data part null
+276ms ║║Error retrieving JSON data part null
+283ms ║║Comparison (string) 2019-9-20 is_equal_to (string) 2019-9-20 = true (2ms)
+285ms ║║Condition #82 evaluated true (29ms)
+289ms ║║Error retrieving JSON data part null
+293ms ║║Comparison (dynamic) is (string) candles = false (2ms)
+294ms ║║Condition #83 evaluated false (8ms)
+296ms ║║Condition group #81 evaluated false (state did not change) (40ms)
+313ms ║║Error retrieving JSON data part null
+317ms ║║Error retrieving JSON data part null
+325ms ║║Comparison (string) 2019-9-20 is_equal_to (string) 2019-9-20 = true (1ms)
+327ms ║║Condition #88 evaluated true (28ms)
+331ms ║║Error retrieving JSON data part null
+335ms ║║Comparison (dynamic) is (string) havdalah = false (2ms)
+337ms ║║Condition #89 evaluated false (9ms)
+338ms ║║Condition group #87 evaluated false (state did not change) (40ms)
+342ms ║╚Execution stage complete. (99ms)
+344ms ║Setting up scheduled job for Fri, Sep 20 2019 @ 5:25:48 PM EDT (in 10.874s)
+353ms ╚Event processed successfully (353ms)
9/20/2019, 5:25:27 PM +61ms
+1ms ╔Received event [Home].time = 1569014728310 with a delay of -1249ms
+206ms ║RunTime Analysis CS > 33ms > PS > 138ms > PE > 35ms > CE
+209ms ║Runtime (52257 bytes) successfully initialized in 138ms (v0.3.10f.20190822) (208ms)
+210ms ║╔Execution stage started
+234ms ║║Error retrieving JSON data part null
+238ms ║║Error retrieving JSON data part null
+244ms ║║Comparison (string) 2019-9-20 is_equal_to (string) 2019-9-20 = true (1ms)
+245ms ║║Condition #82 evaluated true (24ms)
+248ms ║║Error retrieving JSON data part null
+251ms ║║Comparison (dynamic) is (string) candles = false (1ms)
+252ms ║║Condition #83 evaluated false (6ms)
+253ms ║║Condition group #81 evaluated false (state did not change) (32ms)
+268ms ║║Error retrieving JSON data part null
+272ms ║║Error retrieving JSON data part null
+279ms ║║Comparison (string) 2019-9-20 is_equal_to (string) 2019-9-20 = true (1ms)
+281ms ║║Condition #88 evaluated true (25ms)
+283ms ║║Error retrieving JSON data part null
+287ms ║║Comparison (dynamic) is (string) havdalah = false (1ms)
+288ms ║║Condition #89 evaluated false (7ms)
+289ms ║║Condition group #87 evaluated false (state did not change) (34ms)
+292ms ║╚Execution stage complete. (82ms)
+293ms ║Setting up scheduled job for Fri, Sep 20 2019 @ 5:25:38 PM EDT (in 10.956s)
+302ms ╚Event processed successfully (302ms)
9/20/2019, 5:25:17 PM +671ms
+0ms ╔Starting piston… (v0.3.10f.20190822)
+502ms ║╔Subscribing to devices…
+607ms ║╚Finished subscribing (115ms)
+675ms ║Comparison (string) 2019-9-20 is_equal_to (string) 2019-9-20 = true (2ms)
+681ms ║Comparison (dynamic) is (string) candles = false (1ms)
+709ms ║Comparison (string) 2019-9-20 is_equal_to (string) 2019-9-20 = true (2ms)
+715ms ║Comparison (dynamic) is (string) havdalah = false (1ms)
+727ms ║Setting up scheduled job for Fri, Sep 20 2019 @ 5:25:28 PM EDT (in 9.912s)
+743ms ╚Piston successfully started (743ms)
9/20/2019, 5:24:17 PM +679ms
+0ms ╔Starting piston… (v0.3.10f.20190822)
+461ms ║╔Subscribing to devices…
+530ms ║╚Finished subscribing (80ms)
+556ms ╚Piston successfully started (555ms)
9/20/2019, 5:20:49 PM +353ms
+0ms ╔Received event [Home].test = 1569014449353 with a delay of 0ms
+190ms ║RunTime Analysis CS > 16ms > PS > 140ms > PE > 33ms > CE
+193ms ║Runtime (54722 bytes) successfully initialized in 140ms (v0.3.10f.20190822) (192ms)
+194ms ║╔Execution stage started
+198ms ║║Cancelling statement #1’s schedules…
+201ms ║║Executed virtual command wait (0ms)
+202ms ║║Waiting for 1000ms
+1210ms ║║Sending external web request to: www.hebcal.com/hebcal/?v=1&cfg=json&year=now&month=now&maj=on&c=on&m=72&b=18&geo=zip&zip=11230
+1238ms ║║Executed virtual command httpRequest (29ms)
+1244ms ║║date:2019-09-20T18:40:51-00:00, items:[category:candles, date:2019-09-06T19:01:00-04:00, hebrew:הדלקת נרות, title:Candle lighting: 7:01pm], [category:havdalah, date:2019-09-07T20:29:00-04:00, hebrew:הבדלה - 72 דקות, title:Havdalah (72 min): 8:29pm], [category:candles, date:2019-09-13T18:49:00-04:00, hebrew:הדלקת נרות, title:Candle lighting: 6:49pm], [category:havdalah, date:2019-09-14T20:18:00-04:00, hebrew:הבדלה - 72 דקות, title:Havdalah (72 min): 8:18pm], [category:candles, date:2019-09-20T18:38:00-04:00, hebrew:הדלקת נרות, title:Candle lighting: 6:38pm], [category:havdalah, date:2019-09-21T20:06:00-04:00, hebrew:הבדלה - 72 דקות, title:Havdalah (72 min): 8:06pm], [category:candles, date:2019-09-27T18:26:00-04:00, hebrew:הדלקת נרות, title:Candle lighting: 6:26pm], [category:havdalah, date:2019-09-28T19:54:00-04:00, hebrew:הבדלה - 72 דקות, title:Havdalah (72 min): 7:54pm], category:holiday, date:2019-09-29, hebrew:ערב ראש השנה, link:https://www.hebcal.com/holidays/rosh-hashana, memo:The Jewish New Year, ti…[TRUNCATED]
+1245ms ║║Executed virtual command log (2ms)
+1248ms ║║Executed virtual command wait (0ms)
+1249ms ║║Waiting for 2000ms
+3255ms ║║Executed virtual command setVariable (3ms)
+3259ms ║║Executed virtual command wait (1ms)
+3260ms ║║Waiting for 2000ms
+5266ms ║║2019-09-06T19:01:00-04:00
+5267ms ║║Executed virtual command log (1ms)
+5271ms ║║Executed virtual command wait (0ms)
+5272ms ║║Waiting for 2000ms
+7282ms ║║7:01 PM
+7283ms ║║Executed virtual command log (2ms)
+7287ms ║║Executed virtual command wait (0ms)
+7288ms ║║Waiting for 2000ms
+9294ms ║║candles
+9295ms ║║Executed virtual command log (2ms)
+9297ms ║╚Execution stage complete. (9103ms)
+9298ms ╚Event processed successfully (9298ms)
9/20/2019, 5:20:43 PM +47ms
+0ms ╔Starting piston… (v0.3.10f.20190822)
+483ms ║╔Subscribing to devices…
+583ms ║╚Finished subscribing (113ms)
+614ms ╚Piston successfully started (614ms)
9/20/2019, 5:19:18 PM +849ms
+0ms ╔Received event [Home].test = 1569014358848 with a delay of 0ms
+183ms ║RunTime Analysis CS > 21ms > PS > 132ms > PE > 31ms > CE
+186ms ║Runtime (54129 bytes) successfully initialized in 132ms (v0.3.10f.20190822) (185ms)
+188ms ║╔Execution stage started
+192ms ║║Cancelling statement #1’s schedules…
+195ms ║║Executed virtual command wait (1ms)
+196ms ║║Waiting for 1000ms
+1203ms ║║Sending external web request to: www.hebcal.com/hebcal/?v=1&cfg=json&year=now&month=now&maj=on&c=on&m=72&b=18&geo=zip&zip=11230
+1333ms ║║Executed virtual command httpRequest (130ms)
+1339ms ║║date:2019-09-20T18:40:51-00:00, items:[category:candles, date:2019-09-06T19:01:00-04:00, hebrew:הדלקת נרות, title:Candle lighting: 7:01pm], [category:havdalah, date:2019-09-07T20:29:00-04:00, hebrew:הבדלה - 72 דקות, title:Havdalah (72 min): 8:29pm], [category:candles, date:2019-09-13T18:49:00-04:00, hebrew:הדלקת נרות, title:Candle lighting: 6:49pm], [category:havdalah, date:2019-09-14T20:18:00-04:00, hebrew:הבדלה - 72 דקות, title:Havdalah (72 min): 8:18pm], [category:candles, date:2019-09-20T18:38:00-04:00, hebrew:הדלקת נרות, title:Candle lighting: 6:38pm], [category:havdalah, date:2019-09-21T20:06:00-04:00, hebrew:הבדלה - 72 דקות, title:Havdalah (72 min): 8:06pm], [category:candles, date:2019-09-27T18:26:00-04:00, hebrew:הדלקת נרות, title:Candle lighting: 6:26pm], [category:havdalah, date:2019-09-28T19:54:00-04:00, hebrew:הבדלה - 72 דקות, title:Havdalah (72 min): 7:54pm], category:holiday, date:2019-09-29, hebrew:ערב ראש השנה, link:https://www.hebcal.com/holidays/rosh-hashana, memo:The Jewish New Year, ti…[TRUNCATED]
+1340ms ║║Executed virtual command log (2ms)
+1343ms ║║Executed virtual command wait (0ms)
+1344ms ║║Waiting for 2000ms
+3350ms ║║Executed virtual command setVariable (3ms)
+3354ms ║║Executed virtual command wait (0ms)
+3354ms ║║Waiting for 2000ms
+5361ms ║║2019-09-06T19:01:00-04:00
+5362ms ║║Executed virtual command log (2ms)
+5366ms ║║Executed virtual command wait (1ms)
+5367ms ║║Waiting for 2000ms
+7377ms ║║7:01 PM
+7378ms ║║Executed virtual command log (1ms)
+7380ms ║╚Execution stage complete. (7193ms)
+7381ms ╚Event processed successfully (7381ms)
9/20/2019, 5:19:12 PM +416ms
+1ms ╔Starting piston… (v0.3.10f.20190822)
+482ms ║╔Subscribing to devices…
+555ms ║╚Finished subscribing (85ms)
+583ms ╚Piston successfully started (581ms)
9/20/2019, 5:15:25 PM +636ms
+1ms ╔Received event [Home].test = 1569014125636 with a delay of 0ms
+184ms ║RunTime Analysis CS > 21ms > PS > 131ms > PE > 32ms > CE
+188ms ║Runtime (54123 bytes) successfully initialized in 131ms (v0.3.10f.20190822) (187ms)
+189ms ║╔Execution stage started
+194ms ║║Cancelling statement #1’s schedules…
+197ms ║║Executed virtual command wait (1ms)
+198ms ║║Waiting for 1000ms
+1209ms ║║Sending external web request to: www.hebcal.com/hebcal/?v=1&cfg=json&year=now&month=now&maj=on&c=on&m=72&b=18&geo=zip&zip=11230
+1386ms ║║Executed virtual command httpRequest (177ms)
+1392ms ║║date:2019-09-20T18:40:51-00:00, items:[category:candles, date:2019-09-06T19:01:00-04:00, hebrew:הדלקת נרות, title:Candle lighting: 7:01pm], [category:havdalah, date:2019-09-07T20:29:00-04:00, hebrew:הבדלה - 72 דקות, title:Havdalah (72 min): 8:29pm], [category:candles, date:2019-09-13T18:49:00-04:00, hebrew:הדלקת נרות, title:Candle lighting: 6:49pm], [category:havdalah, date:2019-09-14T20:18:00-04:00, hebrew:הבדלה - 72 דקות, title:Havdalah (72 min): 8:18pm], [category:candles, date:2019-09-20T18:38:00-04:00, hebrew:הדלקת נרות, title:Candle lighting: 6:38pm], [category:havdalah, date:2019-09-21T20:06:00-04:00, hebrew:הבדלה - 72 דקות, title:Havdalah (72 min): 8:06pm], [category:candles, date:2019-09-27T18:26:00-04:00, hebrew:הדלקת נרות, title:Candle lighting: 6:26pm], [category:havdalah, date:2019-09-28T19:54:00-04:00, hebrew:הבדלה - 72 דקות, title:Havdalah (72 min): 7:54pm], category:holiday, date:2019-09-29, hebrew:ערב ראש השנה, link:https://www.hebcal.com/holidays/rosh-hashana, memo:The Jewish New Year, ti…[TRUNCATED]
+1394ms ║║Executed virtual command log (2ms)
+1397ms ║║Executed virtual command wait (1ms)
+1398ms ║║Waiting for 2000ms
+3405ms ║║Executed virtual command setVariable (4ms)
+3408ms ║║Executed virtual command wait (0ms)
+3409ms ║║Waiting for 2000ms
+5417ms ║║[]
+5418ms ║║Executed virtual command log (2ms)
+5421ms ║║Executed virtual command wait (0ms)
+5422ms ║║Waiting for 2000ms
+7432ms ║║5:15 PM
+7433ms ║║Executed virtual command log (2ms)
+7435ms ║╚Execution stage complete. (7247ms)
+7436ms ╚Event processed successfully (7436ms)


#8

I also just realized that this statement should come out to be true. Why is it getting it wrong?


#9

Another thing I noticed is this:

  • When I have the candle lighting time logged I get 7:01 PM (example 1) but when I have the same thing used to set a variable it just sets it to the current time (example 2).

(Screenshots and logs below)

Example 1

Logs
9/20/2019, 5:59:01 PM +183ms
+0ms ╔Received event [Home].test = 1569016741183 with a delay of 0ms
+179ms ║RunTime Analysis CS > 16ms > PS > 134ms > PE > 28ms > CE
+182ms ║Runtime (53189 bytes) successfully initialized in 134ms (v0.3.10f.20190822) (181ms)
+184ms ║╔Execution stage started
+188ms ║║Cancelling statement #1’s schedules…
+191ms ║║Executed virtual command wait (1ms)
+192ms ║║Waiting for 1000ms
+1200ms ║║Sending external web request to: www.hebcal.com/hebcal/?v=1&cfg=json&year=now&month=now&maj=on&c=on&m=72&b=18&geo=zip&zip=11230
+1276ms ║║Executed virtual command httpRequest (76ms)
+1282ms ║║date:2019-09-20T18:40:51-00:00, items:[category:candles, date:2019-09-06T19:01:00-04:00, hebrew:הדלקת נרות, title:Candle lighting: 7:01pm], [category:havdalah, date:2019-09-07T20:29:00-04:00, hebrew:הבדלה - 72 דקות, title:Havdalah (72 min): 8:29pm], [category:candles, date:2019-09-13T18:49:00-04:00, hebrew:הדלקת נרות, title:Candle lighting: 6:49pm], [category:havdalah, date:2019-09-14T20:18:00-04:00, hebrew:הבדלה - 72 דקות, title:Havdalah (72 min): 8:18pm], [category:candles, date:2019-09-20T18:38:00-04:00, hebrew:הדלקת נרות, title:Candle lighting: 6:38pm], [category:havdalah, date:2019-09-21T20:06:00-04:00, hebrew:הבדלה - 72 דקות, title:Havdalah (72 min): 8:06pm], [category:candles, date:2019-09-27T18:26:00-04:00, hebrew:הדלקת נרות, title:Candle lighting: 6:26pm], [category:havdalah, date:2019-09-28T19:54:00-04:00, hebrew:הבדלה - 72 דקות, title:Havdalah (72 min): 7:54pm], category:holiday, date:2019-09-29, hebrew:ערב ראש השנה, link:https://www.hebcal.com/holidays/rosh-hashana, memo:The Jewish New Year, ti…[TRUNCATED]
+1283ms ║║Executed virtual command log (2ms)
+1290ms ║║Executed virtual command setVariable (3ms)
+1296ms ║║Executed virtual command setVariable (3ms)
+1305ms ║║7:01 PM
+1306ms ║║Executed virtual command log (1ms)
+1309ms ║╚Execution stage complete. (1125ms)
+1310ms ╚Event processed successfully (1310ms)
9/20/2019, 5:58:58 PM +71ms
+0ms ╔Received event [Home].time = 1569016738528 with a delay of -458ms
+202ms ║RunTime Analysis CS > 32ms > PS > 135ms > PE > 35ms > CE
+205ms ║Runtime (53192 bytes) successfully initialized in 135ms (v0.3.10f.20190822) (204ms)
+206ms ║╔Execution stage started
+207ms ║╚Execution stage complete. (1ms)
+208ms ╚Event processed successfully (209ms)

Example 2

Logs
9/20/2019, 6:07:26 PM +93ms
+1ms ╔Received event [Home].time = 1569017247334 with a delay of -1241ms
+315ms ║RunTime Analysis CS > 24ms > PS > 259ms > PE > 32ms > CE
+318ms ║Runtime (53179 bytes) successfully initialized in 259ms (v0.3.10f.20190822) (316ms)
+319ms ║╔Execution stage started
+343ms ║║Error retrieving JSON data part null
+347ms ║║Error retrieving JSON data part null
+354ms ║║Comparison (string) 2019-9-20 is_equal_to (string) 2019-9-20 = true (2ms)
+355ms ║║Condition #82 evaluated true (24ms)
+360ms ║║Comparison (string) candles is (string) candles = true (1ms)
+361ms ║║Condition #83 evaluated true (5ms)
+362ms ║║Condition group #81 evaluated true (state did not change) (31ms)
+365ms ║║Cancelling statement #84’s schedules…
+368ms ║║Error retrieving JSON data part null
+377ms ║║Executed virtual command setVariable (3ms)
+382ms ║║Executed virtual command waitForTime (2ms)
+384ms ║║Requesting a wake up for Sat, Sep 21 2019 @ 6:07:00 PM EDT (in 86373.525s)
+388ms ║╚Execution stage complete. (69ms)
+390ms ║Setting up scheduled job for Fri, Sep 20 2019 @ 6:08:27 PM EDT (in 60.852s), with 1 more job pending
+399ms ╚Event processed successfully (399ms)
9/20/2019, 6:06:34 PM +81ms
+1ms ╔Received event [Home].test = 1569017194081 with a delay of 0ms
+201ms ║RunTime Analysis CS > 23ms > PS > 144ms > PE > 34ms > CE
+205ms ║Runtime (53175 bytes) successfully initialized in 144ms (v0.3.10f.20190822) (202ms)
+206ms ║╔Execution stage started
+211ms ║║Cancelling statement #1’s schedules…
+214ms ║║Executed virtual command wait (0ms)
+215ms ║║Waiting for 1000ms
+1223ms ║║Sending external web request to: www.hebcal.com/hebcal/?v=1&cfg=json&year=now&month=now&maj=on&c=on&m=72&b=18&geo=zip&zip=11230
+1436ms ║║Executed virtual command httpRequest (213ms)
+1442ms ║║date:2019-09-20T18:40:51-00:00, items:[category:candles, date:2019-09-06T19:01:00-04:00, hebrew:הדלקת נרות, title:Candle lighting: 7:01pm], [category:havdalah, date:2019-09-07T20:29:00-04:00, hebrew:הבדלה - 72 דקות, title:Havdalah (72 min): 8:29pm], [category:candles, date:2019-09-13T18:49:00-04:00, hebrew:הדלקת נרות, title:Candle lighting: 6:49pm], [category:havdalah, date:2019-09-14T20:18:00-04:00, hebrew:הבדלה - 72 דקות, title:Havdalah (72 min): 8:18pm], [category:candles, date:2019-09-20T18:38:00-04:00, hebrew:הדלקת נרות, title:Candle lighting: 6:38pm], [category:havdalah, date:2019-09-21T20:06:00-04:00, hebrew:הבדלה - 72 דקות, title:Havdalah (72 min): 8:06pm], [category:candles, date:2019-09-27T18:26:00-04:00, hebrew:הדלקת נרות, title:Candle lighting: 6:26pm], [category:havdalah, date:2019-09-28T19:54:00-04:00, hebrew:הבדלה - 72 דקות, title:Havdalah (72 min): 7:54pm], category:holiday, date:2019-09-29, hebrew:ערב ראש השנה, link:https://www.hebcal.com/holidays/rosh-hashana, memo:The Jewish New Year, ti…[TRUNCATED]
+1443ms ║║Executed virtual command log (2ms)
+1449ms ║║Executed virtual command setVariable (3ms)
+1456ms ║║Executed virtual command setVariable (3ms)
+1466ms ║║7:01 PM
+1467ms ║║Executed virtual command log (1ms)
+1514ms ║╚Execution stage complete. (1307ms)
+1516ms ║Setting up scheduled job for Fri, Sep 20 2019 @ 6:07:27 PM EDT (in 51.738s)
+1528ms ╚Event processed successfully (1528ms)
9/20/2019, 6:06:26 PM +724ms
+1ms ╔Starting piston… (v0.3.10f.20190822)
+477ms ║╔Subscribing to devices…
+583ms ║╚Finished subscribing (118ms)
+636ms ║Comparison (string) 2019-9-20 is_equal_to (string) 2019-9-20 = true (2ms)
+642ms ║Comparison (string) candles is (string) candles = true (1ms)
+672ms ║Comparison (string) 2019-9-20 is_equal_to (string) 2019-9-20 = true (2ms)
+679ms ║Comparison (dynamic) is_equal_to (string) havdalah = false (2ms)
+686ms ║Setting up scheduled job for Fri, Sep 20 2019 @ 6:07:27 PM EDT (in 59.924s)
+696ms ╚Piston successfully started (696ms)


#10

Unfortunately, I will not have freetime to look at this until it is probably too late…

For what it’s worth, when learning the advanced logic of webCoRE, it really helps to start small (one or two lines only) and then test it at that phase. Once you get good results, then build upon it. (testing it all along the way)

If you wait until the piston is built before troubleshooting, it makes it much trickier to pinpoint multiple issues


#11

I don’t have any deadline for this project. Whenever you’re able to get to it is fine. I really appreciate your help!!

As for taking it one line at a time. I sort-of did that. I used logging as a method to test if I was pulling the proper data but for some reason when I used the exact same format within the piston it’s not understanding it the way I expected it to. I think I’m missing some key point in the way the data is understood by webCoRE.


#12

The holidays will be over in a week, and not celebrated again for another 11 months…

Surely someone will jump in to help you within the next year!


#13

I’m sorry if I wasn’t clear. I’m creating this piston for use at least once a week for the Sabbath. In addition, for every holiday. So whenever I can get it up and running the better but there’s no rush.

Thanks for your help!!


#14

So I think I’m getting somewhere but I hit another snag I can’t figure out.

I’m using $index function in a for loop and looking for when 2 conditions are met in an object from the JSON data then it should return a certain piece of info from that same object. However that’s not what’s happening. Instead, it’s returning that piece of data from all the objects that meet one of the criteria and it’s ignoring the other.

More Specific
I need it to return the candle lighting time from an object IF the date is today and the category is “candles”. However it returns the candle lighting time for all the objects that are in the “candles” category.
What am I doing wrong?


9/27/2019, 5:48:06 PM +834ms
+1ms ╔Received event [Home].test = 1569620886834 with a delay of 0ms
+181ms ║RunTime Analysis CS > 21ms > PS > 136ms > PE > 24ms > CE
+184ms ║Runtime (47280 bytes) successfully initialized in 136ms (v0.3.10f.20190822) (182ms)
+185ms ║╔Execution stage started
+190ms ║║Cancelling statement #1’s schedules…
+193ms ║║Executed virtual command wait (1ms)
+194ms ║║Waiting for 1000ms
+1201ms ║║Sending external web request to: www.hebcal.com/hebcal/?v=1&cfg=json&year=now&month=now&maj=on&c=on&m=72&b=18&geo=zip&zip=11230
+1319ms ║║Executed virtual command httpRequest (117ms)
+1330ms ║║12
+1331ms ║║Executed virtual command log (1ms)
+1338ms ║║[2019-09-06T19:01:00-04:00, 2019-09-07T20:29:00-04:00, 2019-09-13T18:49:00-04:00, 2019-09-14T20:18:00-04:00, 2019-09-20T18:38:00-04:00, 2019-09-21T20:06:00-04:00, 2019-09-27T18:26:00-04:00, 2019-09-28T19:54:00-04:00, 2019-09-29, 2019-09-29T18:22:00-04:00, 2019-09-30, 2019-09-30T19:51:00-04:00]
+1339ms ║║Executed virtual command log (1ms)
+1361ms ║║Comparison (date) 1569556800000 is_equal_to (date) 1569556800000 = true (2ms)
+1362ms ║║Condition #22 evaluated true (10ms)
+1368ms ║║Comparison (dynamic) candles is_equal_to (string) candles = true (1ms)
+1370ms ║║Cancelling condition #23’s schedules…
+1371ms ║║Condition #23 evaluated true (8ms)
+1372ms ║║Cancelling condition #21’s schedules…
+1373ms ║║Condition group #21 evaluated true (state changed) (21ms)
+1375ms ║║Cancelling statement #24’s schedules…
+1386ms ║║Calculating (string) candle lighting today is at + (string) 7:01 PM >> (string) candle lighting today is at 7:01 PM
+1390ms ║║candle lighting today is at 7:01 PM
+1391ms ║║Executed virtual command log (2ms)
+1412ms ║║Comparison (date) 1569556800000 is_equal_to (date) 1569556800000 = true (2ms)
+1413ms ║║Condition #22 evaluated true (10ms)
+1419ms ║║Comparison (dynamic) havdalah is_equal_to (string) candles = false (2ms)
+1421ms ║║Cancelling condition #23’s schedules…
+1422ms ║║Condition #23 evaluated false (7ms)
+1423ms ║║Cancelling condition #21’s schedules…
+1424ms ║║Condition group #21 evaluated false (state changed) (21ms)
+1444ms ║║Comparison (date) 1569556800000 is_equal_to (date) 1569556800000 = true (3ms)
+1446ms ║║Condition #22 evaluated true (10ms)
+1451ms ║║Comparison (dynamic) candles is_equal_to (string) candles = true (1ms)
+1453ms ║║Cancelling condition #23’s schedules…
+1454ms ║║Condition #23 evaluated true (7ms)
+1455ms ║║Cancelling condition #21’s schedules…
+1456ms ║║Condition group #21 evaluated true (state changed) (21ms)
+1459ms ║║Cancelling statement #24’s schedules…
+1470ms ║║Calculating (string) candle lighting today is at + (string) 6:49 PM >> (string) candle lighting today is at 6:49 PM
+1474ms ║║candle lighting today is at 6:49 PM
+1475ms ║║Executed virtual command log (1ms)
+1498ms ║║Comparison (date) 1569556800000 is_equal_to (date) 1569556800000 = true (2ms)
+1499ms ║║Condition #22 evaluated true (10ms)
+1506ms ║║Comparison (dynamic) havdalah is_equal_to (string) candles = false (2ms)
+1507ms ║║Cancelling condition #23’s schedules…
+1508ms ║║Condition #23 evaluated false (8ms)
+1510ms ║║Cancelling condition #21’s schedules…
+1511ms ║║Condition group #21 evaluated false (state changed) (21ms)
+1531ms ║║Comparison (date) 1569556800000 is_equal_to (date) 1569556800000 = true (3ms)
+1533ms ║║Condition #22 evaluated true (10ms)
+1539ms ║║Comparison (dynamic) candles is_equal_to (string) candles = true (1ms)
+1540ms ║║Cancelling condition #23’s schedules…
+1542ms ║║Condition #23 evaluated true (7ms)
+1543ms ║║Cancelling condition #21’s schedules…
+1544ms ║║Condition group #21 evaluated true (state changed) (22ms)
+1546ms ║║Cancelling statement #24’s schedules…
+1557ms ║║Calculating (string) candle lighting today is at + (string) 6:38 PM >> (string) candle lighting today is at 6:38 PM
+1562ms ║║candle lighting today is at 6:38 PM
+1563ms ║║Executed virtual command log (2ms)
+1584ms ║║Comparison (date) 1569556800000 is_equal_to (date) 1569556800000 = true (2ms)
+1586ms ║║Condition #22 evaluated true (10ms)
+1591ms ║║Comparison (dynamic) havdalah is_equal_to (string) candles = false (1ms)
+1593ms ║║Cancelling condition #23’s schedules…
+1594ms ║║Condition #23 evaluated false (8ms)
+1595ms ║║Cancelling condition #21’s schedules…
+1596ms ║║Condition group #21 evaluated false (state changed) (21ms)
+1617ms ║║Comparison (date) 1569556800000 is_equal_to (date) 1569556800000 = true (3ms)
+1619ms ║║Condition #22 evaluated true (10ms)
+1625ms ║║Comparison (dynamic) candles is_equal_to (string) candles = true (1ms)
+1626ms ║║Cancelling condition #23’s schedules…
+1627ms ║║Condition #23 evaluated true (7ms)
+1628ms ║║Cancelling condition #21’s schedules…
+1629ms ║║Condition group #21 evaluated true (state changed) (21ms)
+1632ms ║║Cancelling statement #24’s schedules…
+1643ms ║║Calculating (string) candle lighting today is at + (string) 6:26 PM >> (string) candle lighting today is at 6:26 PM
+1646ms ║║candle lighting today is at 6:26 PM
+1648ms ║║Executed virtual command log (1ms)
+1668ms ║║Comparison (date) 1569556800000 is_equal_to (date) 1569556800000 = true (2ms)
+1670ms ║║Condition #22 evaluated true (10ms)
+1676ms ║║Comparison (dynamic) havdalah is_equal_to (string) candles = false (1ms)
+1677ms ║║Cancelling condition #23’s schedules…
+1678ms ║║Condition #23 evaluated false (7ms)
+1680ms ║║Cancelling condition #21’s schedules…
+1681ms ║║Condition group #21 evaluated false (state changed) (21ms)
+1701ms ║║Comparison (date) 1569556800000 is_equal_to (date) 1569556800000 = true (2ms)
+1703ms ║║Condition #22 evaluated true (10ms)
+1708ms ║║Comparison (dynamic) holiday is_equal_to (string) candles = false (1ms)
+1710ms ║║Condition #23 evaluated false (6ms)
+1711ms ║║Condition group #21 evaluated false (state did not change) (19ms)
+1732ms ║║Comparison (date) 1569556800000 is_equal_to (date) 1569556800000 = true (2ms)
+1733ms ║║Condition #22 evaluated true (10ms)
+1739ms ║║Comparison (dynamic) candles is_equal_to (string) candles = true (1ms)
+1741ms ║║Cancelling condition #23’s schedules…
+1742ms ║║Condition #23 evaluated true (8ms)
+1743ms ║║Cancelling condition #21’s schedules…
+1744ms ║║Condition group #21 evaluated true (state changed) (21ms)
+1746ms ║║Cancelling statement #24’s schedules…
+1757ms ║║Calculating (string) candle lighting today is at + (string) 6:22 PM >> (string) candle lighting today is at 6:22 PM
+1761ms ║║candle lighting today is at 6:22 PM
+1762ms ║║Executed virtual command log (2ms)
+1784ms ║║Comparison (date) 1569556800000 is_equal_to (date) 1569556800000 = true (3ms)
+1786ms ║║Condition #22 evaluated true (11ms)
+1792ms ║║Comparison (dynamic) holiday is_equal_to (string) candles = false (1ms)
+1793ms ║║Cancelling condition #23’s schedules…
+1795ms ║║Condition #23 evaluated false (7ms)
+1796ms ║║Cancelling condition #21’s schedules…
+1797ms ║║Condition group #21 evaluated false (state changed) (21ms)
+1817ms ║║Comparison (date) 1569556800000 is_equal_to (date) 1569556800000 = true (2ms)
+1819ms ║║Condition #22 evaluated true (10ms)
+1825ms ║║Comparison (dynamic) candles is_equal_to (string) candles = true (1ms)
+1827ms ║║Cancelling condition #23’s schedules…
+1828ms ║║Condition #23 evaluated true (8ms)
+1829ms ║║Cancelling condition #21’s schedules…
+1830ms ║║Condition group #21 evaluated true (state changed) (22ms)
+1833ms ║║Cancelling statement #24’s schedules…
+1844ms ║║Calculating (string) candle lighting today is at + (string) 7:51 PM >> (string) candle lighting today is at 7:51 PM
+1848ms ║║candle lighting today is at 7:51 PM
+1849ms ║║Executed virtual command log (2ms)
+1871ms ║║Comparison (date) 1569556800000 is_equal_to (date) 1569556800000 = true (2ms)
+1873ms ║║Condition #22 evaluated true (11ms)
+1879ms ║║Comparison (dynamic) is_equal_to (string) candles = false (2ms)
+1881ms ║║Cancelling condition #23’s schedules…
+1882ms ║║Condition #23 evaluated false (7ms)
+1883ms ║║Cancelling condition #21’s schedules…
+1884ms ║║Condition group #21 evaluated false (state changed) (23ms)
+1886ms ║╚Execution stage complete. (1701ms)
+1888ms ╚Event processed successfully (1888ms)


#15

hi shmuel ,
did you succeed ?
im new with WebCore and what are you doing it’s Exactly what i want to do