Writing values in the PI Server with Google Assistant

Blog Post created by cvillanua on Dec 28, 2018

I have been playing around a lot lately at my house with Google Home Mini and some other cool smart switches and devices.


That gave me a lot to think and to work on a little project that I thought it was pretty interesting and it is to write values with my Google Assistant.


Be aware that this project was made on a test server and it is not meant to be used in production.

It is an example of how the PI System can integrate with other Systems in a very easy way.


Thank you Albert Abeijon for giving me the trigger idea for the software needed to develop the solution.




First of all I developed my PI Web API query using postman in order to see if the POST request that I was willing to perform was suitable:

  1. I want to write a value in a PI Tag from PI Data Archive
  2. I would like to be able to write to any tag
  3. I would like to be able to write any value.


A Batch request with basic authentication needs to be used, to do that we will place the user name and the password before the server.




Since I would like to write something on the server I need to make a POST request

"Resource": "https://cvillanua-pi/piwebapi/points?path=\\\\cvillanua-pi\\sinusoid"
"ParentIds": [
"Parameters": [
"Resource": "https://cvillanua-pi/piwebapi/streams/{0}/value",
\"Value\": 77,



Then it is needed PI Web API and IFTTT + Google Assistant + Webhooks.


Steps to configure the solution:

  • Register a google account in IFTTT to be able to access to the Google Assistant and Webhooks configurator.
  • Create a New Applet

  • Clicked on "+this"

  • Look for the Google Assistant applet

  • Choose the trigger "Say a phrase with both a number and a text ingredient"

  • Configure the trigger phrase and create the trigger.

  • Select the "+that"

  • Search for Webhooks to send the web requests.


  • Configure Webhooks with the parameters used in Postman using as substitution parameters the number and text introduce by voice.
  • Use the "add ingredient" button to select the text and the number
  • Click on create action


Now you can see your new applet in My Applets.


To test it out you would need to say "OK Google" and the phrase that you used to trigger.



This solution could work with any other PI Web API query that you would like to perform like writing values in attributes, creating new PI Points...


It is true that sometimes there are understanding issues from the Google Assistant and some tags would be very hard to be used.