Setting switches for MKR Wifi 1010 through Arduino IoT Cloud API


I have an Arduino Explore IoT Kit that came with an Arduino MKR Wifi 1010 and Maker IoT carrier. I have been able to go a bit beyond the tutorial and I have 4 variables setup on the Arduino IoT (2 Cloudswitches for Button 0 and 1, and the Temperature and Humidity sensor running). These all work on the IoT dashboard and if I change switches on the Arduino IoT dashboard the Carrier screen updates appropriately. I am also able to read all the values in a custom mobile app through Arduino IoT rest API.

My question is that I now trying to send a command to the Arduino IoT API to change the state of the cloudswitches just like I can with the IoT dashboard. Is this even possible? If so, which API command should I use to set the cloudswitch and what information should I send? The cloudswitches are set to read-write and I can confirm this when I read the property info through the API.

Just an update to what I posted - I am using web request through C# so the post is most like the cURL example. I can update now all the variable settings for variable such as the name and such using propertiesV2Update method, just not the variable property itself. The example in the IoT API documentation does not have an example for updating the variable itself or how to call out that parameter.

Edit - I found the answer

It was to use propertiesV2Publish -HOWEVER using the documentation as directed caused the dashboard on the IOT cloud to update but not the device. When I removed the device tag from the property value JSON everything worked.

this post helped

It would be fantastic if the documentation (especially in cURL section) was updated to show the removal of the device id in the example. Also it would be much clearer if a sentence or two was added to the description of propertiesV2Update that it only changes the parameters of the property and not the value. Also propertiesV2Publish might be much clear if it just said use this method to directly change the values of variables.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.