Trying to send text from Power Automate to Webcore


#4

Yes, you’ll add the ?name=value

name = variable name, your choice
value = data you want to pass to webcore


#5

Thanks again. The variable is ‘CurrentDateTime’ so I’ll add that to the url end, but what do I change ‘value’ too? Do I just leave it as ‘value’ like this:

?%CurrentDateTime%=value


#6

value would be the data you want to send to webCoRE, you mentioned it is a variable from power automate

Is current %CurrentDateTime% the actual variable?


#7

Yes


#8

What is an example output of %CurrentDateTime%?


#9

To clarify essentially the variable could be anything, I’ve just chosen the '%CurrentDateTime2% variable in Power Automate to try and learn how to do this, so in my ‘flow’ essentially I pull the current date and time in the first step and it gets store into a %CurrentDateTime2% variable, in this format:

2/6/2023 6:37:17 PM

Then the next step in the flow is a HTTP POST using the ‘Invoke web service’ option which shows the screen I pasted above.

This is where I have pasted the WebCore piston url, which, when called, turns a light on (so I know it actually got triggered) and then, what I’m trying to do is to also pass the variable data across to webcore, i.e. 2/6/2023 6:37:17 PM


#10

In total it looks like this:

Power Automate:

Invoke web service details (I’m very unsure what to do here - have I correctly selected ‘POST’? Or should it be ‘GET’ and some other details etc?)

…and my WebCore piston (which is a total guess atm!):
Webcore%20piston


#11

A GET should work in your Invoke web service. Correction on the piston URL. I forgot that Hubitat adds the access_token in the URL so you’ll have to append to it:

&name=value_you_are_sending

You can create a test piston with just the following.

image

If your web call is successful, it should log the content you passed into webcore.


#12

Thanks again.

So to clarify I would be appending the power automate variable to the end of the piston external url, i.e:

&name=%CurrentDateTime2%

So the new ‘invoke’ section would look like this?

Is that right?


#13

Yes, the format is correct. I’m not sure if powerautomate will urlencode characters that needs it. So you can go ahead and give it a try and see what webcore logs.


#14

So it didn’t work, at least when linked to this piston - I was unable to replicate the ‘log info’ test piston you showed above, so instead I did the following - not sure if something is wrong with the below?

Failed


#15

Logs if they help?


#16

The piston example you posted will not do anything with the data you pass until you try to log the contents of DateTimeInfo.

Add another Log task after the Turn on and in the value, put {DateTimeInfo}

Edit: Correction, put the Log task before the IF IFTTT.


#17

On it… give me a sec!


#18

Apologies, stuck on this one - I don’t know how to add a ‘log’ before the ‘IF’ I only seem to get the option as a ‘task’ in the ‘Action’ section as per the below:

…and this didn’t lo anything when it ran unfortunately.


#19

On the bottom of the IF statement, click “add a new statement” > Add an action > Add a task > Log to console

Once you have added the new statement, you can drag it up above the if IFTTT statement using the drag handles in the gutter.

image

If the drag handles are not visible, you will have to enable it.

image


#20

Right, got it to record something! Alas it’s come through a bit muddled, the stuff I want is in ‘bold’, but I need to lose all of the other elements:

{“name”:“06/02/2023 22:49:37”,“remoteAddr”:[“86.155.20.74, 130.176.222.113”],“referer”:null}

So would something like ‘set variable’ be a better to use? Or is it because I’m using a dynamic variable?

Don’t worry about answering now @eibyer - you’ve done enough for one night and I need to hit the lights and try and get some sleep now. But massive thanks for all of your help!


#21

No prob, play with it again tomorrow :smiley:


#22

Good morning!

Ok, I have a confession - I wasn’t scroolling far enough down to see whether the variable had been populated… I was looking at the ‘Local Varible’ area expecting the args statement to populate, when instead if I should have scrolled down further to ‘System Variables’ and I would have seen the thing working a while back (albeit with the same additional jibberish). Plus it also works using ‘Post’ in Power Automate.

Anyway, on to my next challenge. Essentially I want to transfer what is captured in the system $args variable into a local ‘DateTimeInfo’ variable, that I can then apply a push message command to, or get a speaker to read out the info stored etc.

But I cannot seem to get the local variable to populate from the system variable - nor does trying to send a push message with the sysytem variable value of {$args} work either - both just come back ‘null’ - any idea what I’m doing wrong? In pictures:

Setting the local variable to be what the $args system variable is (it doesn’t work, local variable just always lists {$args} and instead of the value that system variable contains (despite when setting it, it seems to work - note the white text box pop out shgowing what it should report):

WebCore logs if they help (note the local variable remains set to {$args} on the right side of the image.

Not sure if this makes sense, but put simply, I want to take the information sent from Power automate which is captured in a system variable and get it into a usable state to be pushed out via a message or read out by a speaker…


#23

My word, I’ve only gone and flippin’ done it with this piston! (I changed the variable name in case you are wondering).

I can now push variables from Power Automate, and log them into a local variable using the &name=%TESTVar% suffix to the webcore piston’s external url. Amazing times.

@eibyer thank you so much again for helping get this far!