Echo alarm clock


#1

1) Give a description of the problem

Not sure, everything looks ok with no errors.

2) What is the expected behaviour?

I think it should set an alarm based on the event start time

**3) What is happening/notHappening

When I check the echo device, there is no alarm set.

**4) Post a Green Snapshot of the piston![image|45x3

5) Attach logs after turning logging level to Full

Logs

1/4/2020, 12:46:07 AM +23ms
+0ms ╔Received event [Home V2].test = 1578116767022 with a delay of 0ms
+127ms ║RunTime Analysis CS > 22ms > PS > 52ms > PE > 54ms > CE
+130ms ║Runtime (42722 bytes) successfully initialized in 52ms (v0.3.110.20191009) (129ms)
+131ms ║╔Execution stage started
+146ms ║║Comparison (enum) closed is (string) closed = true (2ms)
+148ms ║║Condition #17 evaluated true (11ms)
+156ms ║║Comparison (string) Next GCal Event: Test
+156ms ║║Calendar: Menards2
+156ms ║║Event Start: Sun, Jan 05 03:00 AM
+156ms ║║Event End: Sun, Jan 05 04:00 AM
+156ms ║║ is_not (string) No events found = true (1ms)
+158ms ║║Condition #29 evaluated true (9ms)
+159ms ║║Condition group #1 evaluated true (state did not change) (23ms)
+161ms ║║Cancelling statement #2’s schedules…
+179ms ║║Calculating (integer) 49 + (integer) 12 >> (integer) 61
+185ms ║║Calculating (string) Jan 05 + (string) 2020 >> (string) Jan 05 2020
+194ms ║║Executed virtual command [Test Events].setVariable (4ms)
+211ms ║║Calculating (integer) 49 + (integer) 19 >> (integer) 68
+219ms ║║Executed virtual command [Test Events].setVariable (3ms)
+222ms ║║Cancelling statement #25’s schedules…
+237ms ║║Calculating (string) Sun, Jan 5 2020 + (string) , >> (string) Sun, Jan 5 2020,
+240ms ║║Calculating (string) Sun, Jan 5 2020, + (string) 03:00 AM >> (string) Sun, Jan 5 2020, 03:00 AM
+2422ms ║║Executed physical command [Echo - Malek’s Echo Dot].createAlarm([Sun, Jan 5 2020 @ 6:00:00 AM EST]) (2171ms)
+2423ms ║║Executed [Echo - Malek’s Echo Dot].createAlarm (2174ms)
+2440ms ║║Calculating (string) Sun, Jan 5 2020 + (string) , >> (string) Sun, Jan 5 2020,
+2445ms ║║Calculating (string) Sun, Jan 5 2020, + (string) 03:00 AM >> (string) Sun, Jan 5 2020, 03:00 AM
+2452ms ║║Executed virtual command [Echo - Malek’s Echo Dot].setState (1ms)
+2456ms ║╚Execution stage complete. (2325ms)
+2458ms ╚Event processed successfully (2458ms)


#2

I’ve not worked with the Echo, but does createAlarm really only take a single argument in the Fri, Jan 3 2020 @ 6:00:00 AM EST format? At the device handler level it seems to take label, date and time arguments in specific formats.


#3

Wouldn’t sensor 9’s event summary NOT be clear, since the summary shows past events, and thus would not be true? What kind of sensor is it?


#4

@orangebucket
I don’t know much about coding, most what I do is copy and paste and trials, the format may be what I got wrong in there, hoping some of the smart people here can point me in the right direction.

@Mebejedi
Sensor 9 is a gcal search contact sensor, when it finds an event based on search word, it stay closed but shows the next matching event.
And when the event start that sensor shows open.


#5

I’m also trying to get the createAlarm(…) command to work properly - without success so far.

In the Echo Speaks Documentation it says this for the createAlarm(…) function:

I can’t even get a direct input (no variables, etc) to produce an alarm on my Echo Show5 or my Original Echo or one of several Echo Dots (gen1, 2 or 3). The doc does mention that, “Not all alexa devices support this feature”. But with testing on many different Echoes, I’m not sure why this simple webCoRE piston does not work.


#6

Can you share your piston, I’m Not able to get the year first, and the time changing to 12 hours instead of 24.[17880C7E-E53A-4AC2-9655-886A64A578BB|690x48]


#7

It’s just a proof of concept/test piston to see if I can get the createAlarm(…) command to work To keep it simple, I just added that command as a string using the parameters from the wiki that I showed above. I also added that same format as an expression too. But, so far, it doesn’t work in either case. But here is is:

BTW, the Echo Speaks wiki information says the time portion of the command must be in 24 hour format.


#8

I got it to work but it didn’t get the date correctly, the alarm was set for tomorrow instead on the 24th. you had them all in one string, you needed 3 separate strings

now that the format worked, I have to figure out how to auto populate this based on my calendar events.


#9

OK. Thanks for letting me know about the (3) parameters, I now have this:

However, there are some things about this that make it a bit odd:

  1. Although the date parameter has to be there (I tried leaving it blank but then the alarm was not created), it doesn’t seem to matter much what date it is. It just needs to be there. Note that in my piston, I’ve got it set at January 1st. Works the same no matter what date I use. Anyway, in my testing, if the alarm you’re trying to set is later than the time the piston is executed, it will create the alarm for today - no matter what date you put in the parameter. If the time is earlier than the time the piston is executed, it’ll create the alarm for tomorrow - again without regard to the date parameter you set. So, in my use case, I execute the piston at 02:21 each morning. If we’re home, it’ll create an alarm for 07:30 later that same day. If I ran the same piston after 07:30, the 07:30 alarm would be created for tomorrow. Even though it’s a bit odd, it works for my use case.
  2. It appears that single-event alarms become inactive after they execute (at the alarm time). That’s fine, but they don’t delete themselves from Alexa. This means that there will be an ever-increasing list of inactive alarms in Alexa - that at some point will need to be manually deleted. I’m going to test this for a while and see if it’s worth it rather than just setting a daily repeating alarm that I need to remember to pause when I’m going to be away.

In your case, the date parameter (as we’ve input it) does not have any discernible effect - and it is an issue. I’ll keep playing a bit and let you know if I discover anything else.


#10

This is the way Alexa’s alarms currently works.
(Alarms are always set within the next 24 hour period)

I wonder if this concept can be ported over to “Reminders” in Alexa, which can be more than 24 hours in the future…


#11

You can set an alarm for any date you want with Alexa voice command.


the problem may be with the Echo speaks code, trying to find more info.
But regardless of the date do you know of a way to make this a variable

I created 2 variables and changed that third string into an expression

it didn’t work as the computed time was 1641 when it should have been 16:41


#12

Cool! I did not know they improved this. Thanks for confirming!!


#13

Since it appears that all three parameter entries for the createAlarm(…) function must be strings, using the two variables you created, you should try this : string(Hour":“Minute) as an expression in the parameter. If you wanted that to use the current time, it would be: string($24hour”:"$minute). You could also just define one string variable, say alarmTime like I did and then use it as the second parameter of the createAlarm(…) function.

In my case, I now have the date of the alarm created like this: string($year"-"$month"-"$day). Today, that results in “2020-1-19”.

My piston now looks like this:


I’m still left with the issue of the ever-increasing list of inactive alarms in Alexa that will need to be manually deleted. However, that’s not a webCoRE issue. My piston works as it is.


#14

I’ll need another day to confirm this, but… Contrary to what I previously thought, it seems that the new alarms - when created by the piston above, overwrite the older one . This is likely because in normal use the older alarms become inactive before the piston writes a new one - while in testing, I was leaving them active. Therefore, they will probably not require manual deletion. If this is not true, I’ll report back.


#15

Question: Does the term gcal refer to Google Calendar? If so, how does WC access it?


#16

Yes, that’s what it means.

I’ve never done anything with GCAL, but you can look here to possibly get you started:


#17

I use it to tell wc I’m on holiday so it can operate the lights in holiday mode.

In effect you create a virtual switch/event in the ST app, with a string to search for. When a calendar event is found with the string in, the switch turns on, until the event has passed. You can setup multiple events to fire the switch and also multiple switches for different occasions. e.g I also put my work from home days in, webcore then operates the heating appropriately.


#18

I’ve been running the above Piston for the past week. Until today it worked as expected. Today, it ran as usual - including the log entry saying that it set the alarm. Except it didn’t actually set the alarm on the Echo. Although it sent the command to set the alarm, either the Echo didn’t receive it - or at least it did not set it. Since it is unacceptable for an alarm to not be set, and I am unaware of any method to check and retry on an Echo device as needed when it fails (like I have for ST controllable devices), I have discontinued use if this Piston.


#19

Imagine the look on our boss’ face when we blame our SmartHome for being late for work…


#20

As I am ‘recently’ retired, I don’t have this specific issue any longer. But you’re certainly correct. While I was employed for just over 50 years, I can’t imagine trying to use my smart home as an excuse for lateness.