wshankles
(William Shankles)
July 14, 2016, 10:37am
1
I have a particle photon that I’m trying to use to remotely control a relay and send sensor data. I tried getting MQTT to work on it, but I have no idea what I’m doing and can hardly understand MQTT in the first place. I have been able to control an LED using a tasker HTTP post task.
Server:Port https://api.particle.io
Path /v1/devices/<my device>/led?access_token=<my access token>
Data/File params=on
I’ve tried using REST switch in my configuration.yaml file
switch 3:
name: Particle
platform: rest
resource: https://api.particle.io/v1/devices/<my device>/led?access_token=<my access token>
method: PUT
body_on: "ON"
body_off: "OFF"
Any advice? My switch shows up in my states as switch.particle, but I don’t think it’s communicating with my particle.
laf
(Laf)
July 14, 2016, 10:50am
2
I could be way off here so take what I say with a pinch of salt seeing as I’m days into HA myself.
Your example shows sending params=on where as your config shows just sending ON or OFF.
If you were sending json you could do:
body_on: "{\"params\":\"on\"}"
Not sure if it’s just normal http params that doing this is the alternative:
body_on: "params=on"
wshankles
(William Shankles)
July 14, 2016, 11:02am
3
Thanks for the reply. Just tried it. Unfortunately it didn’t work.
laf
(Laf)
July 14, 2016, 11:14am
5
I’ve just looked at the python requests doc and the first example should be correct. Could try:
body_on: "{'params': 'on'}"
laf
(Laf)
July 14, 2016, 11:37am
7
body_on: "{'on': 'true'}"
?
wshankles
(William Shankles)
July 14, 2016, 12:04pm
8
Nope. I think I need to read up on the particle more.
treynaer
(Tim)
November 5, 2016, 2:48pm
9
Try this:
switch 3:
name: Particle
platform: rest
resource: https://api.particle.io/v1/devices/<my device>/led?access_token=<my access token>
body_on: "params=on"
body_off: "params=off"
dee4dog
(Dirk Cilliers)
April 4, 2018, 7:24pm
10
Enybody got this to work? Sitting with the exact same problem as firs post!
dee4dog
(Dirk Cilliers)
April 6, 2018, 2:54pm
11
anyone , anyone… bueller?
1 Like