armzilla / amazon-echo-ha-bridge

emulates philips hue api to other home automation gateways
Apache License 2.0
732 stars 168 forks source link

Support Brightness Value In content-body #39

Open maddox opened 9 years ago

maddox commented 9 years ago

It's awesome being able to append ${intensity.percent} and ${intensity.byte} to our URLs so that we can pass brightness. But it'd be great if this could work via our content-body as well. Some APIs expect this value in the content-body not the actual URL params.

Example

{
  "name": "Family Room Light",
  "deviceType": "switch",
  "offUrl": "http://192.168.1.201:3480/services/light/turn_on",
  "onUrl": "http://192.168.1.201:3480/services/light/turn_on",
  "contentType" : "application/json",
  "httpVerb":"POST",
  "contentBody" : "{\"entitiy_id\":\"light.family_room\", \"brightness\": "${intensity.byte}" }"
}
armzilla commented 9 years ago

Can you give it a try? The content body gets evaluated by the same method as the url

On Mon, Sep 14, 2015, 12:56 Jon Maddox notifications@github.com wrote:

It's awesome being able to append ${intensity.percent} and ${intensity.byte} to our URLs so that we can pass brightness. But it'd be great if this could work via our content-body as well. Some APIs expect this value in the content-body not the actual URL params. Example

{ "name": "Family Room Light", "deviceType": "switch", "offUrl": "http://192.168.1.201:3480/services/light/turn_on", "onUrl": "http://192.168.1.201:3480/services/light/turn_on", "contentType" : "application/json", "httpVerb":"POST", "contentBody" : "{\"entitiy_id\":\"light.family_room\", \"brightness\": "${intensity.byte}" }" }

— Reply to this email directly or view it on GitHub https://github.com/armzilla/amazon-echo-ha-bridge/issues/39.

maddox commented 9 years ago

OH, i tried it and i didn't see results. I must have screwed something up. I'll give it another go, thanks!!