I have some devices that I control using a particle.io photon and spark. This is a device like arduino; however, it is WiFi capable and has a complementary rest service provided by particle.
What integration approach would you recommend? I will be using it mostly to dim lights - set lights to wake me up in the morning - turn fans on and off - water plants - check humidity and temperature.
Thanks! Still trying to work out the Syntax for the payload. I have an access token as well as an argument (presented as a string of comma separated values. How would multiple parameters be passed in the payload? The rough stab below is probably not right, but aims to present what I’m trying to do. New to HA and what I assume is Jinja?
Thanks, I searched through all of the git repositories and only found one example of a post to a restful api, which looks a lot different from the documentation provided.
- platform: rest
scan_interval: 3600
resource: !secret gas_buddy_resource
method: POST
name: Gas Price
value_template: '{{value_json.trend.Today}}'
unit_of_measurement: '$'
Thanks, MQTT does seem to have much more documentation for home assistant. I’m still hoping that I can use my existing restful infrastructure and avoid complicating what I have going on. Seems that I’m really close, I just need a clue on how I should be passing 2 arguments (token + args) using the rest implementation.
Any progress? I am going down the MQTT route.
Currently reading temp/humidity with a DHT11 on my particle photon. Following this guide for ESP now, just not sure how to adapt PubSubClient client(espClient); for the Particle…
The switch above does send a post to the device, however, the arguments are not being passed correctly. the format is typically something like args=“1,100,10” where args are passed as a string.
I have also tried “args=1,100,10” and “1,100,10” without luck. In a cURL request the arguments are in quotes and passed as a string args=“1%2C0%2C10”’
Any idea for how the body on param could be passed so that it is interpreted as args=“1,100,10” ? Right now, it’s just passing args as a null value.
body_on: ‘{“args”=“1,100,10”}’
body_on: ‘{args = “1,100,10”}’
body_on: ‘{“args”:“1,100,10”}’
body_on: ‘{args : “1,100,10”}’
body_on: ‘{“args=1,100,10”}’
body_on: ‘{“args”=“1”,“100”,“10”}’ (the 1,100,10 need to be passed as a single string).
Also tried reversing the double quotes and quotes. Without quotes around the brackets it does not compile.
No errors and no problem using postman. I’m able to pass args (key) and “1,100,10” (value) as a key value pair parameter. I have no idea what the syntax is for key value pairs in HAss =/