Echo alarm clock


#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.


#21

I just discovered this thread. I’ve got a working Echo Speaks alarm with GCal events script if anyone wants it. Notes:

  • Change Contact Sensor 20 and the GCal event name in timeAlarm/dateAlarm variables to be the same, and match your GCal device name
  • Switch 48 is a virtual switch (‘Sleep In Toggle’) to override setting the alarm automatically
  • Music Player 4 is your Echo
  • @HolidayTodayIsFederal comes from @JimmyS 's holiday scripts at U.S. Holiday detection pistons


#22

My script posted above is now failing as well. There is an issue open here: https://github.com/tonesto7/echo-speaks/issues/221 . It seems it stopped working with this commit I believe, https://github.com/tonesto7/echo-speaks/commit/720942c15277cbbc0e57039820a4815c4b60dd0e, or maybe in this PR, https://github.com/tonesto7/echo-speaks/pull/184/commits/c752c7fbfd2037b0a21886a6f2ccd4ea810a8eb1 . Since I’m not a Groovy or Alexa developer I’m not sure how to debug. Maybe some @webCoRE_Minions can help @tonesto7 debug?

ST log errors look like:

28ba91a9-7824-45f3-b2f5-3c38cccc4d33 6:05:32 PM: error Echo (v3.4.0.0) | CreateAlarm Response Exception | Status: (500) | Msg: Internal Server Error
28ba91a9-7824-45f3-b2f5-3c38cccc4d33 6:05:32 PM: debug params: [type:Alarm, status:ON, alarmTime:1580259992500, createdDate:1580259932500, originalTime:05:45.00.000, originalDate:2020-01-29, timeZoneId:null, reminderIndex:null, sound:null, deviceSerialNumber:G0911B0592560922, deviceType:A4ZP7ZC4PI6TO, recurrenceEligibility:false, alarmLabel:2020-01-29, reminderLabel:null, reminderSubLabel:Echo Speaks, timerLabel:null, skillInfo:null, isSaveInFlight:true, triggerTime:0, id:createAlarm, isRecurring:false, remainingDuration:0, rRuleData:null, recurringPattern:null]
28ba91a9-7824-45f3-b2f5-3c38cccc4d33 6:05:32 PM: debug rule: [data:null, pattern:null]
28ba91a9-7824-45f3-b2f5-3c38cccc4d33 6:05:32 PM: debug transormRecurString(type: null, opt: null, time: 05:45,date: 2020-01-29)
28ba91a9-7824-45f3-b2f5-3c38cccc4d33 6:05:32 PM: trace createdNotification params: [cmdType:CreateAlarm, label:2020-01-29, date:2020-01-29, time:05:45, type:Alarm]

#23

The Tomcat related error shown in those logs looks like the same one that was taking out webCoRE (and a few other things) two or three weeks ago.