Ask Google Assistant to set a piston's run time?


#1

So, I have some tasks configured to run based on simple Google Assistant phrases (Google Assistant > IFTTT > WebCoRE). While I was setting my IFTTT applets I saw that there are some more complex ways of getting info from a Google Assistant phrase to IFTTT, like I could say a number and IFTTT could pass it along with the command.

I have a piston that runs at 7.30 every morning, and if the “next wash cycle” simulated switch is on, it turns on the washing machine. Sometimes depending on the day I prefer to start it earlier or later, so I go and edit the piston’s time before going to bed, and then turn the “next wash cycle” on, but if I don’t have a time preference I just say “hey google turn on the next wash cycle” and I know it will eventually turn on.

I was thinking if there is a way to set the time through Google Assistant, maybe saying something like “set the next wash cycle at 6am”. I don’t need fine control, I could say just at 6 or 7 or 8, but I’m interested in this idea.

If it’s too complicated, could you recommend a way to make it easier to input the time instead of manually editing the piston?

Thanks!
Rodrigo


#2

I sometimes cheat a bit, and bypass IFTTT completely.

If you create a “Simulated Dimmer Switch” from the IDE, then you can have one piston look for changes to that switch. (IE: if SimDimSwitch changes to 60, then set variable to 6am)

Then you can use your voice directly from Google Home or Alexa to change the variable without touching any pistons.


#3

So, I created a piston that sets a global variable at different times depending on the level of a simulated dimmer switch. This works fantastically.

And there’s another piston that says “every day at (variable) perform the action”. This piston was working before but I used to edit the time manually where now there’s a variable.

In the piston list (in the WebCoRE dashboard) there’s a countdown timer that appears on the right of each piston that has conditions based on timers. This was showing a countdown of 9 hours at midnight because the variable was set at 9am.
I now told Google Home to set the dimmer switch at 70, the variable changed to 7am, so the countdown should now be 7 hours, but it kept showing 9hs.
Refreshing the page didn’t update the countdown, so I went to edit the piston, then I just saved it without changing a thing, and now the countdown is on 7 hours.

Should I worry about this? Is there any way to tell the piston to re check the variables?

Thanks!
Rodrigo


#4

A piston is only aware of time based schedules in the future when the piston is running. A good way to let the piston be aware of a new time is to run an empty block at (let’s say) 4am. For example, in that piston, you can add an empty block like this:

Every day at 4am
    do
END EVERY

Ideally, the time for this empty block should be before your very earliest alarm.


#5

The piston that sets the time variable based on the dimmer also turns on a simulated switch, would it work if I added an empty block with the switch?

If Switch changes to ON
do
end if

Thanks!


#6

Anytime a piston runs, for any reason, it will see the new time variable, and reschedule accordingly.


#7

Just to clarify, the piston that uses the time variable needs the early wakeup.
(the piston that sets the variable does not need the extra code)

In your case, the empty block of code needs to be in your piston containing:
“every day at variable, then perform the action”


#8

I added it but it doesn’t make the countdown timer change.
Should I add the IF block at the beginning of the piston? Is there any way to change the order of the blocks without using cut/paste?


#9

The new schedule will not update until the piston runs next.
(this is the purpose of the empty block to ‘force’ a piston run)

You can also drag and drop blocks of code by using the toggle icon up top.


#10

This is not working. The wm_time variable is set at 9:00 AM, Switch 6 changed a couple of times, the countdown still shows 6hs left instead of 8 (it’s 1am) and the previous setting was at 7am).

Any ideas? :slight_smile:
Thanks!


#11

Hmmm, you are right. The last time I coded for a changing time variable, this simple concept worked perfectly:

temp

Something must have changed with the code in webCoRE, because now the “job pending” does not change unless the piston is edited/saved or paused/resumed.

(Cancel all pending tasks did not solve it either)


#12

Update

Changing the code
every day at
to
IF Time happens daily at
solved it for me.


temp


Calculate time based on switch percentage?