probonopd / ESP8266HueEmulator

Emulate a Philips Hue bridge running on an ESP8266 using the Arduino IDE.
MIT License
411 stars 93 forks source link

Any support for HUE sensors using API ? #91

Open gibman opened 6 years ago

gibman commented 6 years ago

I have a temp. humid sensor attached to the arduino. It would be cool to see the readouts using HUE.

Example call:

all : /api//sensors or one specific : /api//sensors/

JSON =>

{
"5":{
"state":{
"temperature":1796, "lastupdated":"2016-10-15T12:10:46" }, "config":{
"on":true, "battery":100, "reachable":true, "alert":"none", "ledindication":false, "usertest":false, "pending":[

     ]
  },
  "name":"Hue temperature sensor 1",
  "type":"ZLLTemperature",
  "modelid":"SML001",
  "manufacturername":"Philips",
  "swversion":"6.1.0.18912",
  "uniqueid":"##:##:##:##:##:##:##:##-##-####"

}, "6":{
"state":{
"presence":false, "lastupdated":"2016-10-15T12:05:35" }, "config":{
"on":true, "battery":100, "reachable":true, "alert":"none", "ledindication":false, "usertest":false, "sensitivity":2, "sensitivitymax":2, "pending":[

     ]
  },
  "name":"Landing MS",
  "type":"ZLLPresence",
  "modelid":"SML001",
  "manufacturername":"Philips",
  "swversion":"6.1.0.18912",
  "uniqueid":"##:##:##:##:##:##:##:##-##-####"

}, "7":{
"state":{
"lightlevel":15351, "dark":false, "daylight":true, "lastupdated":"2016-10-15T12:15:09" }, "config":{
"on":true, "battery":100, "reachable":true, "alert":"none", "tholddark":2054, "tholdoffset":7000, "ledindication":false, "usertest":false, "pending":[

     ]
  },
  "name":"Hue ambient light sensor 1",
  "type":"ZLLLightLevel",
  "modelid":"SML001",
  "manufacturername":"Philips",
  "swversion":"6.1.0.18912",
  "uniqueid":"##:##:##:##:##:##:##:##-##-####"

}, "8":{
"state":{
"status":0, "lastupdated":"2016-10-15T12:05:35" }, "config":{
"on":true, "reachable":true }, "name":"MotionSensor 6.Companion", "type":"CLIPGenericStatus", "modelid":"PHA_STATE", "manufacturername":"Philips", "swversion":"1.0", "uniqueid":"MotionSensor 6.Companion", "recycle":true } }

Is support for this planned ?

regards gibman

probonopd commented 6 years ago

I am not working on it but I'd be happy to merge Pull Requests that implement it.

gibman commented 6 years ago

thanks!!

I already started working on it.

Although I am unable to see the sensors within the android HUE app. There is a section called "accessory setup" in the app where I can add stuff like hue tap switch, hue dimmer switch and hue motion sensor. All these requires me to press the button on the physical accessory - which ofcourse is a bit hard being it is an emulator hehe.

I have no idea how to have the sensors added to the HUE app. The access. setup menu might not be the way.

Ive listed the various HTTP GET Requests along with the corresponding JSON response. If anyone could review. obviously something is wrong.

http://192.168.1.144:80/api/A020A6FFFE21065E/ => {"groups":{"1":{"name":"Living room","lights":["1","2"]}},"scenes":{},"config":{"name":"hue emulator","swversion":"81012917","bridgeid":"A020A6FFFE21065E","portalservices":false,"linkbutton":true,"mac":"A0:20:A6:21:06:5E","dhcp":true,"ipaddress":"192.168.1.144","netmask":"255.255.255.0","gateway":"192.168.1.1","apiversion":"1.3.0","localtime":"2017-11-02T19:48:48","timezone":"Europe/London","whitelist":{"api":{"name":"clientname#devicename"}},"swupdate":{"text":"","notify":false,"updatestate":0,"url":""}},"lights":{"1":{"type":"Extended color light","manufacturername":"OpenSource","swversion":"0.1","name":"Hue LightStrips 1","uniqueid":"A0:20:A6:21:06:5E-1","modelid":"LST001","state":{"on":false,"bri":0,"xy":[0.00000,0.00000],"colormode":"hs","effect":"none","ct":500,"hue":0,"sat":0,"alert":"none","reachable":true}},"2":{"type":"Extended color light","manufacturername":"OpenSource","swversion":"0.1","name":"Hue LightStrips 2","uniqueid":"A0:20:A6:21:06:5E-2","modelid":"LST001","state":{"on":false,"bri":0,"xy":[0.00000,0.00000],"colormode":"hs","effect":"none","ct":500,"hue":0,"sat":0,"alert":"none","reachable":true}}},"schedules":{},"sensors":{"1":{"manufacturername":"OpenSource","name":"Hue Sensor 1","swversion":"0.1","type":"ZLLTemperature","uniqueid":"1","modelid":"LST001","state":{"temperature":1,"humidity":2,"light":3,"lastupdated":"2016-10-15T12:10:46"},"config":{"on":true,"alert":"none","reachable":true,"ledindication":true,"usertest":true,"battery":100,"pending":{}}},"2":{"manufacturername":"OpenSource","name":"Hue Sensor 2","swversion":"0.1","type":"ZLLTemperature","uniqueid":"2","modelid":"LST001","state":{"temperature":0,"humidity":0,"light":0,"lastupdated":"2016-10-15T12:10:46"},"config":{"on":true,"alert":"none","reachable":true,"ledindication":true,"usertest":true,"battery":100,"pending":{}}}},"rules":{}}

http://192.168.1.144:80/api/A020A6FFFE21065E/sensors => {"1":{"manufacturername":"OpenSource","name":"Hue Sensor 1","swversion":"0.1","type":"ZLLTemperature","uniqueid":"1","modelid":"LST001","state":{"temperature":1,"humidity":2,"light":3,"lastupdated":"2016-10-15T12:10:46"},"config":{"on":true,"alert":"none","reachable":true,"ledindication":true,"usertest":true,"battery":100,"pending":{}}},"2":{"manufacturername":"OpenSource","name":"Hue Sensor 2","swversion":"0.1","type":"ZLLTemperature","uniqueid":"2","modelid":"LST001","state":{"temperature":0,"humidity":0,"light":0,"lastupdated":"2016-10-15T12:10:46"},"config":{"on":true,"alert":"none","reachable":true,"ledindication":true,"usertest":true,"battery":100,"pending":{}}}}

http://192.168.1.144:80/api/A020A6FFFE21065E/sensors/1 => {"manufacturername":"OpenSource","name":"Hue Sensor 1","swversion":"0.1","type":"ZLLTemperature","uniqueid":"1","modelid":"LST001","state":{"temperature":1,"humidity":2,"light":3,"lastupdated":"2016-10-15T12:10:46"},"config":{"on":true,"alert":"none","reachable":true,"ledindication":true,"usertest":true,"battery":100,"pending":{}}}

You can use : https://jsonformatter.curiousconcept.com in order to have more readable JSON output.

regards gibman