Adding Time Last Opened Announced By Google Into Piston


#1

Is it possible to add in a time to the google assistant callout? So it says "dash last fed @ time. I tried to create a new variable in the first step but it didn’t seem to work

Note I was not the original creator of the piston, that goes to killahbee, i just incorporated google assistant callouts.


#2

I don’t know how to do this with google callout but I found a piston (and IFTTT) here on this forum that says the time of your meeting etc thru google calendar.

Maybe this will give you some ides…


#3

I found an easier way to do this than google calendar. But it is a little tricky…

First, a few of the limitations…

  1. You have to speak the time to Google Home as a decimal. You can’t say “o’clock” anywhere in the command to google home, that will screw things up.
  2. If you can do it by the number of minutes or hours you want a thing to happen for, that is much, MUCH easier.

So, if you want to do either of these from Google Assistant, the first step is in webCoRE, create a piston with the trigger of the virtual device IFTTT. Select a name for it, then copy the Link that webCoRE will give you below the piston.

Now, take that link over to IFTTT. You want to create a new applet with Google Assistant as the “this” part. You want to pick, “Say a simple phrase with a number component.”
In the applet, you want to use a phrase that you will be able to remember and that makes sense. Substitute in the # sign where you will speak the number. Again, this is where using a simple “this many minutes” from now is easier. But you can speak the time as well, it just means that your work will be harder on the backend. For this example, I’ll asumming you’re going to trigger it in so many minutes from now. Here’s an example:

Now, for the “then” part, pick maker webhooks. Paste your URL from webCoRE into the URL field. After the trigger name, in my case “time”, add a question mark and then some argument name you want to use, I have used “minutes”, then an equal sign, then click add ingridient and click number field. There is a CRUCIAL STEP here. IFTTT has put a space automatically between the equal sign and the number field. YOU MUST REMOVE IT or nothing will work. (I won’t tell you how long I fought with that before figuring it out. It was a LONG time). It should look something like this:

Now, back over in your webcore piston, you want to add a variable to capture that number, in my case, I’ve used minutes again. You’ll use the actions of set variable, and you’ll do that by selecting the variable and then the argument entry and then typing in your argument name from IFTTT, in my case “minutes” again.


Then add a wait for that number of minutes.

Then add your actions after that. And voila…you’re done! You can now trigger an action to happen in so many minutes. You can also make it really complicated where an action happens immediately, then another happens after the delay. I do this to turn on lights for so many minutes.
For example, my driveway light. When someone is leaving I always used to forget to turn it off after they were gone. Now I can say to Google Home, turn on driveway light for 10 minutes and it turns on immediately and then off after 10 minutes. :slight_smile:
If you want to do it based on a specific time, i can walk through that as well but parsing it is a lot more complicated.


#4

The problem with doing this from Google Calendar is that if the time is short, you’ll never get the IFTTT trigger event. This is only intended for events scheduled at least hours in advance. A few minutes isn’t going to be enough time for IFTTT to be able to update based on Google Calendar.


#5

Okay…so I reread your question…Google Home isn’t actually announcing the information, you are speaking it to goolge home, correct?


#6

there’s a virtual switch, it gets turned on and based on if a contact sensor has been opened in the last 12 hours, it will say one of two things (yes, dog was fed or no he wasn’t). I want to attach a time so it says yes, dash was fed at (time) or no dash hasn’t been fed since (time).

It sounds so simple but I can’t for the life of me get it to announce the time.


#7

Well, do you want it to say “Three o’clock pm” or do you want it to say “Fifteen hundred”? Or do you want just “Three o’clock”? There is going to be a difference. Also, do you want it to be accurate to the point of saying “three seventeen twenty two seconds pm”?

The easiest way to accomplish this is to set a global variable at the time the button is pushed, not to figure out later what time it is getting pushed. You can simply create a global variable equal to the system variable $time when the event occurs. $time is a string variable, unlike $now, that is a representation of the time it occurs. It is in the format of “7:22 P.M.” Then just insert that into your announcement to Google Home. That should work. Then you can remove the A.M. / P.M. through an expression in webCoRE.


#8

i tried this but it’s still not working.


#9

Line 32 can set a global, if you like… but it will not reflect as you want on line 22.

pic

I would leave line 22 as (no value set), and duplicate line 32 if you want a local variable as well.


#10

i’ve tried it before, it won’t announce the time


#11

You still have the variable defined incorrectly. You can’t have it set for “Nothing selected”.

image

image

Yours is set to no value, which will erase the variable at the end of the execution of the piston.
Also, what are you using to issue the broadcast? Google Assistant Relay?


#12

Variables do not get erased. They stick until written to again in the future. Then the new data sticks… etc


#13

Not according to webcore.

This is for local variables, not global ones. The variable in that piston is not defined correctly.


#14

Trying to use assistant relay which says everything but the time piece.


#15

Correct. Nothing selected, is the same as (no value set)… which is the same as:

image


#16

Modify the variable like I suggested…it will work. You can see that your variable has no value right now.


#17

No… his says.

image


#18

It does have a value in the Piston, not sure why when it screenshots it removed it


#19

Can you show a screenshot of the value assigned in the piston? Just that area of the screen, not the whole thing.


#20