glenndehaan / ikea-tradfri-coap-docs

How can you communicate to your ikea tradfri gateway/hub through coap-client
MIT License
189 stars 21 forks source link

Possible to get the Bulb Type? #12

Closed Joey-1970 closed 4 years ago

Joey-1970 commented 4 years ago

Hello Glenn,

I'm still working on my module. In the category there are Bulb with different white, Bulb with Colors or transformers.

Is it possible to find out, which device is connected without analyze the parameter from device Info: [3] => stdClass Object ( [0] => IKEA of Sweden [1] => TRADFRI bulb E14 CWS opal 600lm Maybe I can read the "CWS" to know this bulb can colors and the "WS" when it is only different white but that look not very professional. I want to change the controls dependent of the exact device... Here a big list: http://sprunge.us/CCQF But I don't find what I'm searching for, do you know whats the best way?

Joachim

glenndehaan commented 4 years ago

Yeah so I did some testing with my lights and the output of my bulbs is as follows:

{
  "9001": "Ceiling 1",
  "9002": 1518962113,
  "9020": 1583058020,
  "9003": 65537,
  "9054": 0,
  "9019": 1,
  "3": {
    "0": "IKEA of Sweden",
    "1": "TRADFRI bulb E27 CWS opal 600lm",
    "2": "",
    "3": "1.3.009",
    "6": 1
  },
  "5750": 2,
  "3311": [
    {
      "5850": 1,
      "5851": 203,
      "5708": 42596,
      "5707": 5427,
      "5709": 30015,
      "5710": 26870,
      "5706": "f1e0b5",
      "9003": 0
    }
  ]
}
{
  "9001": "TV Light",
  "9002": 1519564265,
  "9020": 1583058045,
  "9003": 65544,
  "9054": 0,
  "9019": 1,
  "3": {
    "0": "IKEA of Sweden",
    "1": "TRADFRI bulb E27 WS opal 980lm",
    "2": "",
    "3": "2.3.007",
    "6": 1
  },
  "5750": 2,
  "3311": [
    {
      "5850": 1,
      "5851": 25,
      "5717": 0,
      "5711": 454,
      "5709": 33008,
      "5710": 27213,
      "5706": "efd275",
      "9003": 0
    }
  ]
}
{
  "9001": "Bed Front",
  "9002": 1534071987,
  "9020": 1582999678,
  "9003": 65546,
  "9054": 0,
  "9019": 1,
  "3": {
    "0": "IKEA of Sweden",
    "1": "TRADFRI bulb GU10 W 400lm",
    "2": "",
    "3": "1.2.214",
    "6": 1
  },
  "5750": 2,
  "3311": [
    {
      "5850": 1,
      "5851": 203,
      "9003": 0
    }
  ]
}

From this I could take the following:

  1. You are able to check if a light is just only dimmable by checking the 3311 output. Since this is missing the RGB values.
  2. If you want to check if a light is RGB capable or just Cold / Warm capable. Well.... I can't find it. The only thing that I discovered is that when using the 'default' colors in the app the RGB bulbs will never use the colors described here: https://github.com/glenndehaan/ikea-tradfri-coap-docs#cold--warm-bulbs

So you could check if a bulb is using those colors by reading out the 5706 hex value. In the example output above all lights where set to the 'Glow' color provided by IKEA. But as you can see the RGB bulb won't choose that hex value.

Now I know that this method also feels hacky. And if I was making an implementation I would just go for a regex of the item name.

Joey-1970 commented 4 years ago

Thank you very much! Your data help me, to configure devices I don't have.

Joachim