Open scottsuine opened 8 years ago
you need to call your function argument. For example if you have a function in your particle code with the "on" argument, you would need to set that as the args. below is a quick sample particle code showing the "on" argument being passed.
`void setup() { Spark.function("on", on); Spark.function("off", off); pinMode(relay, OUTPUT); pinMode(led, OUTPUT); pinMode(led2, OUTPUT);
}
void loop() { / digitalWrite(relay,HIGH); delay(2000); digitalWrite(relay, LOW); /
}
int on(String command) {
digitalWrite(relay,HIGH);
digitalWrite(led,HIGH);
digitalWrite(led2, HIGH);
}`
I'm really struggling to understand the above example and how it relates to "args" parameters in the particle devices section in the config.json
Can anyone provide a working example to toggle a switch on/off both config.json and particle firmware.
Thanks
I have installed homebridge-particle and have it successfully subscribed to events and working. I am trying to get a successful function call
my Proton has the following function exposed get ACStatus it accepted a string Args and I have made is accept a string in the format "1=1" and "1=0". If I type these strings into the particle iPhone app, the function works as expected
my accessoryr section in config.json is "accessory": "Airconditioner", "name": "Air Conditioner", "deviceid": "removed for privacy", "type": "LIGHT", "function_name": "setACStatus", "args": "1={STATE}"
The accessory is visible in Homekit and I can toggle the button, however the function is not sucessfully called and is not triggered, what am I doing wrong
thanks