For one of my recent projects I would need to update IP Symcon variables from a PowerShell script.

I found the following approach handy and adopted it:

JSON-RPC Web Request from within PowerShell

It’s been a while since I worked on this script but as far as I remember, I struggled with the “payloadJsonRPCVersion”. I had to provide the version in the JSON payload.

JSON_RPC.ps1 contains the two functions you need. In the next step I will dot-source this script file into my script from which I want to make the remote procedure call.

In the script from which you want to call the remote procedure, first dot-source the JSON_RPC.ps1 like this:

Next you need to specify the url to you IP Symcon WebFront including the ‘/api/’ to address the JSON payload and the credentials. You may also declare the method(s) you want to call as well as the Symcon variable IDs and their new values in an array. In my case I just used the ‘SetValue’ method but for the sake of clarity I added it to the PowerShell variables, too:

You can now finally make your JSON RPC like this:

I think there is still some space for improvement in these script snippets but it serves my desired purpose – for now 🙂

Based on the script variable names you may guess what I need this for. Probably this will be another post 😉

Bye

No Comment

You can post first response comment.

Leave A Comment

Please enter your name. Please enter an valid email address. Please enter a message.