Trying to send text from Power Automate to Webcore


#1

1) Give a description of the problem
I want to send text stored in a Power Automate variable into a variable in WebCore

2) What is the expected behaviour?
Power automate variable text is stored in a Webcore variable

3) What is happening/not happening?
I can trigger a piston from power automate, but no idea where to start, or what to do to send text from power automate into a Webcore Variable.

These are my options in Power automate:

I’ve got a feeling this maybe something to do with ‘parsing JSON’ and I’ll need to add some sort of code into the form? Then I’d need to set some sort of variable up in WebCore to capture this info?

Unfortunately I’m really out of my depth with this, so could do with a step-by-step guide if anyone would be so kind.


#2

From power automate, call the webcore_piston_url?name=value

In webcore, you can extract the forwarded information via the variable $args.name


#3

Thanks eibyer, but I think you’ve over-estimated my understanding - apologies, I feel like I’m entering

In my image above, in the url section, I have pasted the webcore piston url found under the ‘Quick Facts’ section of the piston. Do you mean add something to the end of that url?


#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!