WebCoRE asks a question, my voice response determines the action

text-to-speech
answer
query
voice
alexa

#62

What I wish to do: when Schlage lock is opened from the inside (not with a presence sensor, not with a code), have Alexa report the state of the garage and if closed, ask if you would like it opened… and do so or not based on the reply (or lack of reply).

Then again, looking at the android control tablet right by that lock and tapping it to open or close the garage as desired is easy enough. Lol


#63

I agree Glen. If your control tablet is near the Schlage lock, you will get a quicker response by just tapping an icon on the Android. (since the methods on this page has a built-in 15 second delay)


#64

Did anyone make it work with Google Home? I’m not sure, where to start…


#65

The concept should be similar. Just make sure that Google Home is able to control the two SimSwitches. (Answer Yes and Answer No)


#66

Okay, having an issue.

I’m trying to create a piston that will query me every half-hour after midnight to see if I’ve fallen asleep with the TV on. I’m testing it with my desk lamp for now.

For one thing, I’d love to figure out a way to have it check on me every half-hour after midnight (until, say, 2:00).

The other thing I’m having an issue with is setting it to ask me only when the TV (or, in this case, light) is on. I was hoping that putting the If ComputerLight=On restriction would work if I put it at the beginning of the piston, but instead, I’ve had to put it in every instance when AR speaks. What am I doing wrong here?


#67

I have not tested this inside a 30 minute timer, but I believe this would work. (using 75% less code)
It runs every 30 minutes between 12AM and 1:59AM.

One caveat: depending on what time the piston was last saved,
the first alert will happen between 12AM and 12:29AM.


Edit March 2020:

ATTN Everyone… Please do not use this piston. I made the mistake of starting with code that was not 100% examined, so a lot of things slipped past my radar. There are two or three things that would need to change to make the above piston work properly.

To preserve the flow of conversation, I am only editing / removing the import code.


#68

I’ll give it a shot!

[EDIT] Shouldn’t that be INSIDE OF RANGE?

[EDIT] It works! Seems kind of a waste of processing to have it counting every 30 minutes all day long (but only running the piston between 12 and 2), but I’ll take what I can get!


#69

I intentionally chose “outside of range” because it easily spans midnight.
IE: My code above tells webCoRE to do nothing between 2am and 11:59pm.

As far as the daily event, it only reads the first first line of code (line 30 above) and then exits out, (unless it is between 12am and 1:59am). Probably 10 milliseconds of processing time, at most.


#70

Use the Google cast API smartapp


#71

Hmmm…apparently the code didn’t work…gonna have to troubleshoot some more.

You know, I’m not a “hacker”, but I’m no stranger to programming. Some of the simplest tasks in Webcore seem to require such circuitous routes, and I could easily knock out some of these pistons in BASIC with some If/Then/Gotos. The “Outside of Range”, in my reasoning, seems to do the complete opposite of what I want.

Still trying to wrap my mind around some of this stuff…sorry for the rant. :stuck_out_tongue:


#72

What part of the code did not work?


As far as the $hour24 section, perhaps this will help bring clarity.

If the military hour is between 2 and 23 (2AM and 11:59PM) then do nothing.
Outside that range (12AM - 1:59AM), the piston is allowed to run (if Switch 3 is on)


#73

Not sure. I awoke at 3 with the TV and lights on.

I think my issue is not understanding how Webcore loops around when going from before midnight to after. I know it’s me, and not Webcore’s fault. I ended up changing the times to 24 and 3, assuming 24 is 12 midnight, right?

That said, it did work at 12:30, but I fell asleep before 1, so I’m still kinda puzzled. I’ve also had to put in several WHEN’s to see if my TV is on (via my Harmony Hub). It just seems like something’s funky with my setup, and some stuff isn’t reading right. It was supposed to announce to two of my Echos, but was only speaking on one, so something’s up.

Maybe I should try something simpler…telling it to start at 12:00 AM, and WAIT 30 minutes 6 times…but I’m not sure how to program that.


#74

You are right, but I think in webCoRE, midnight is seen as $hour24 = 0
The reason I used 23 is so it would be easy for you to tweak the beginning hour if you wanted. (IE: if you wanted the question to happen after 11pm, then change it to say: IF $hour24 is outside the range of 22 and 2)


temp

I would expect the above code to fail, since you are only allowing it to run from 3AM thru 11:59PM. (blocking it from running the 3 hours you want it to happen) Changing it to my original wording should fix that portion:

temp


Harmony is great at sending commands, but not so great on monitoring the status of devices. I would use a light instead of your TV in the "only when" section. Ideally, a light that is always on at midnight, yet one you turn off when you are going to bed.


Your code points towards only one music player… (Music Player 4)


#75

Yeah, but it’s usually been on for awhile, so the On status showing in ST is pretty much guaranteed at that point.

I know. I changed it last night after the 12:00 and 12:30 responses only came from the other Echo. I’ll mess around with it today using the light over my computer.


#76

It is also important to note that if you fall asleep, and do not answer Alexa’s question, then you need to make sure that the next line of code turns off every single one of the "only when" devices, or it will ask again and again every 30 minutes. (this is why my example only monitored a single light)


#77

For future reference, if you have issues with a piston, please capture a green snapshot before editing the piston. That way, we can see what the code was at the time of the issue.


#78

Sorry…just a question…do you have individual Alexa Responds pistons for each kind of scenario? Or is it a separate piston that other pistons refer to? (using variables to carry over information and commands)?


#79

I have exactly one SimSwitch called “Answer Yes” and one SimSwitch called “Answer No”. They are re-used in all my various questions in many different pistons. My logic in the first post does not rely on variables, and nothing is “carried over”. (although technically, my SimSwitches are acting like boolean variables, which is why the other piston resets them 30 seconds after they are turned on. This gets the SimSwitches ready for another question from another piston)


#80

So you use this same logic in different pistons (reusing the same two Simswitches). Good to know.

Okay, Why doesn’t this work? Checking to see how long a light has been on is listed as a trigger, but it only works once (after I turn the light off and back on.) :frowning:


#81

Yes, that is the normal behavior. One trigger, one question, and one set of actions to happen depending on your reply.

This is why I created the workaround for you so it can ask the question multiple times (every 30 minutes) until the light is turned off.