Is it possible to get the contents of a variable OUT of webcore?


#21

So the developer got back to me and implemented a way to access the latest value… Here’s their response:

Jeff, I liked that idea a lot. Feel kinda silly for not doing it in the first place. So I implemented it. You can just use /latest to get the latest dump. And you can do /latest/json if you are doing something programatic, etc.

At some point I need to update the Toilet view to automatically update when new dumps come in but that’s not a 30 minute job like this was.

Just tack on “d/latest” to the URL, for example:
http://ptsv2.com/t/allrak/d/latest

And bonus points… you can also grab it in JSON:
http://ptsv2.com/t/allrak/d/latest/json

Now you can program in a GET request to your bucket and tack on /latest/json in iOS shortcuts, then filter the JSON to verify the variable got set correctly.

Pretty cool!


#22

okay OP, here ya go…

I’m dumping the value of $time, which I want to validate in iOS shortcuts, which is done below:

that was kinda fun :smile:

So once you set your time value in iOS shortcuts, process it through webcore and upload your variable as the last action in the piston, then re-validate in your shortcut. Might need to put a small “wait” in your shortcut to allow webcore to process it.


#23

Woah! That’s it! Thank you so much. What a solution!


#24

When you get a chance to implement and test your entire piston and shortcut, please share both. I’d be curious to see the final version. This has potential for a lot of scenarios! Please mark my post as “solution” too if it works for ya :wink:

Glad to help!


#25

One last question, my time is set as a “time” variable, but when I send it, 6:30 AM sends as “23400000” (which I know is the number of milliseconds after midnight). Any idea how I’d check that value against the time that I chose in the time picker of the shortcut?


#26

So you may need to make a conversion:

If the iOS shortcut 'POST’s it to $time_from_shortcut variable in WC, then you can convert it into a WC var named “wc_time”, which is equal to the function+argument: formatDuration(time_from_shortcut)

There may be an easier way… but definitely check out the wiki on functions (formatDuration())


#27

That’s helpful, but I think I need to go the other way. The shortcut sends the argument as “6:30AM” which works fine to trigger the smart plug.

When I POST that “@coffeebottime” variable (time variable) to the service, it sends as “23400000”.

In shortcuts, I presume I’d need to validate that the value in the response is the same as the value chosen earlier in the picker. Right now, it’s failing because the shortcuts “picker” time is “6:30AM” and the value that returns back from WC through the POST service is “23400000”.

EDIT: Nevermind! Figured it out in the shortcut itself. Used the “Get Time Between Dates” to get the time between 12:00 AM and the Time from the picker, then multiplied it by 1000 to get the same value that WC is returning. Success!! See below.


#28

Ok! Here’s my functioning CoffeeBot setup. The shortcut sends the time, WC sets the variables (first piston) and POSTS a response back to ptsv2.com, then the shortcut GETS that response to validate that the @coffeebottime variable matches the time selected in the shortcut, and that @coffeebotarmed is TRUE.

The Shortcut:

The Piston to Set Variables & POST to ptsv2.com:

The Piston to Run SmartPlug (coffee maker) at the right time, then reset variables:

If you can’t tell, the validation occurs in the shortcut during the IF block analyzing the contents of the FormValues response from ptsv2.com. IF input contains “”@coffeebotarmed":[“true”],"@coffeebottime":["%%MillisecondsTime VARIABLE%%"]"


#29

Nice work!


#30

Question: what brand & model is the coffee pot?

I’ve researched this ad nauseum, and can’t find the right configuration. The ‘dumb’ coffeemakers I’ve experienced make less than wonderful coffee. The programmable ones don’t have separate day-of-week start times, and cannot be turned on via smart outlet. The lower priced ‘smart’ makers are Bluetooth, and require constant connectivity to your phone to operate (and the reviews on them are not good) - and the actual ‘smart’ makers are waaay overfeatured and overpriced.

All I want is a good, fresh cup of coffee in the morning.

That works best if it finishes brewing just before you’re ready to have a cup. Which for me is when I wake up. On weekdays, that’s around 5:30am… and on weekends and holidays, around 6:30.

So my entire goal here is to be able to program coffee start time M T W T F for 5:15am, and weekends/holidays for 6:15am. Without having to go to the coffeemaker and re-program it. Perhaps on weekends and holidays, have no schedule but say “Alexa, start coffee” and it would start brewing.

Can’t they just put a simple z-wave or zigbee or WiFi on/off switch in these things?


#31

I use a Coffee Percolator connected to a Smart Outlet to make perfect coffee. Just make sure the device is ‘dumb’. In other words, when you plug it in, it turns on. When you unplug it, it turns off. You do not want a Percolator that has a timer built in, since all the logic will be programmed here in webCoRE.

(mine is over 20 years old, and is still my favorite appliance, LOL)

Side Note:
When programming the ON times, don’t forget to also program the OFF times. Otherwise, it will stay on 24/7


#32

I’ve got the Technivorm Moccamaster KBT 741. It’s certainly not cheap, but it’ll outlast me and makes incredible coffee. Simple to operate; on-off switch. If the carafe is in place, water is in the reservoir, and switch is on, the smart plug does the rest. I’ll second the other comment about needing to program the “off” of the smart plug, too… Mine is set to wait 66 minutes. (Moccamaster brews a full pot in 6 minutes, then the “light” on the switch stays on for 60 more minutes, almost like a “freshness indicator”, even though the brew stops once the reservoir is empty).

From there, you can set the smart plug however you want. The iOS app/shortcut was to simplify the experience for my wife, but you can obviously trigger that however you want. Good luck!


#33

Thanks! I really appreciate all of your help with everything.