0

Syntax of a function RPC call

Francois Lesueur 2 years ago in bOS Server updated by Ricardo Pinto | visiontech pt 2 years ago 6

Hello, 

I want to use RPC to trigger a function. 

I've seen a POST data example that you suggested on a document : 

{"objectName":"Building\General\Users\User","functionName":"SendAlert","value":["'Hello'"]}

I want to run a RunFromClient() of a program : so, there are no parameter / value to send in the function. 

I've tried {"objectName":"Tasks\\beds24\\THStartHeating","functionName":"RunFromClient()","value":"true"} but it's not working. Could you confirm the syntax when there are no value to send within the function ? 

Thank you very much, 

François 

Hello Francois,

there is a small deserialization issue when converting the string on our side and we've already fixed it. You can expect a fix with the next beta/stable release.

In the meantine, you can use RPC and send commands, but instead of sending them directly to the user, You can create a Message task and simply run that task, that will send the alert to the user, image attached.

Hope this helps!

Best regards, Davidmessage.JPG

Hi David, 

Thank you for your quick answer. 

What is the syntax to run the message task from RPC ? 

Best regards, 

François 

Hello Francois,

I attached the image of the http program task that uses RPC for communication. You can use on the same server or other servers that have RPC enabled. Just fill out the server info under http task. You can follow along with the tutorial video:

;ab_channel=ComfortClick

Best regards, David

Hello Francois,

If it helps: RunFromClient() from an RPC call, is exactly the same syntax as for calling a scene, simply just the Run function.

Instead of using:

{"objectName":"Tasks\\beds24\\THStartHeating","functionName":"RunFromClient()","value":"true"}

Simply use:

{"objectName":"Tasks\\beds24\\THStartHeating","functionName":"Run"}

Best regards

Hello Ricardo, 

How are you doing ?

Thank you for the syntax. The simplest things are sometimes difficult to find :-)

It's working great. 

Best regards, 

François 

Hello Francois, my coffee friend in Porto! I'm fine thanks, and you?

Not everything is documented on the RPC, but it's a matter of searching and testing.

The options are not that much, so by association I usually get there.

Best regards