blitzcode / hue-dashboard

A web interface for monitoring and controlling Philips Hue lights
http://www.blitzcode.net/haskell.shtml#hue-dashboard
281 stars 22 forks source link

Groups are odd on my v1 Hub #3

Open mreeves1 opened 7 years ago

mreeves1 commented 7 years ago

Here is a dump of my groups and lights via the Clip API debugger shown below:

The specific issue I have is the Iris and the GE Link Flood are both in the living room group but appear in "weird" groups not returned in the Group API call. You can see lights 6 and 10 should be in the living room group.

I don't know haskell at all but maybe now is a good time to learn 📚 so if I get a chance I'll investigate. Just wanted to let you know.

image

Groups:

{
    "1": {
        "name": "Office",
        "lights": [
            "5",
            "11",
            "9",
            "8"
        ],
        "type": "Room",
        "state": {
            "all_on": false,
            "any_on": false
        },
        "class": "Office",
        "action": {
            "on": false,
            "bri": 129,
            "alert": "none"
        }
    },
    "2": {
        "name": "Living",
        "lights": [
            "12",
            "13",
            "10",
            "6"
        ],
        "type": "Room",
        "state": {
            "all_on": true,
            "any_on": true
        },
        "class": "Living room",
        "action": {
            "on": true,
            "bri": 254,
            "hue": 49521,
            "sat": 254,
            "effect": "none",
            "xy": [
                0.1935,
                0.0999
            ],
            "ct": 165,
            "alert": "none",
            "colormode": "xy"
        }
    },
    "3": {
        "name": "Master Bedroom",
        "lights": [
            "14",
            "15",
            "7"
        ],
        "type": "Room",
        "state": {
            "all_on": false,
            "any_on": false
        },
        "class": "Bedroom",
        "action": {
            "on": false,
            "bri": 254,
            "hue": 12754,
            "sat": 53,
            "effect": "none",
            "xy": [
                0.4584,
                0.412
            ],
            "ct": 366,
            "alert": "none",
            "colormode": "xy"
        }
    },
    "4": {
        "name": "hgrp-0000002848",
        "lights": [
            "11",
            "5",
            "9",
            "8"
        ],
        "type": "LightGroup",
        "state": {
            "all_on": false,
            "any_on": false
        },
        "recycle": false,
        "action": {
            "on": false,
            "bri": 129,
            "alert": "none"
        }
    },
    "5": {
        "name": "hgrp-0000065534",
        "lights": [
            "11",
            "9",
            "4",
            "14",
            "15",
            "2",
            "7",
            "10",
            "3",
            "5",
            "8",
            "1",
            "6",
            "12",
            "13"
        ],
        "type": "LightGroup",
        "state": {
            "all_on": false,
            "any_on": true
        },
        "recycle": false,
        "action": {
            "on": true,
            "bri": 119,
            "hue": 49728,
            "sat": 101,
            "effect": "none",
            "xy": [
                0.3205,
                0.2606
            ],
            "ct": 165,
            "alert": "select",
            "colormode": "xy"
        }
    }
}

Lights:

{
    "1": {
        "state": {
            "on": false,
            "bri": 0,
            "alert": "none",
            "reachable": false
        },
        "type": "Dimmable light",
        "name": "Bedroom Lux Lamp 1",
        "modelid": "LWB004",
        "manufacturername": "Philips",
        "uniqueid": "00:17:88:01:00:da:b3:4a-0b",
        "swversion": "5.38.2.19136"
    },
    "2": {
        "state": {
            "on": false,
            "bri": 0,
            "alert": "none",
            "reachable": false
        },
        "type": "Dimmable light",
        "name": "Bedroom Lux Lamp 2",
        "modelid": "LWB004",
        "manufacturername": "Philips",
        "uniqueid": "00:17:88:01:00:da:b3:be-0b",
        "swversion": "5.38.2.19136"
    },
    "3": {
        "state": {
            "on": false,
            "bri": 0,
            "alert": "none",
            "reachable": false
        },
        "type": "Dimmable light",
        "name": "living room 1a",
        "modelid": "LWB006",
        "manufacturername": "Philips",
        "uniqueid": "00:17:88:01:10:29:96:e0-0b",
        "swversion": "5.38.2.19136"
    },
    "4": {
        "state": {
            "on": false,
            "bri": 0,
            "alert": "none",
            "reachable": false
        },
        "type": "Dimmable light",
        "name": "living room 1b",
        "modelid": "LWB006",
        "manufacturername": "Philips",
        "uniqueid": "00:17:88:01:10:52:8d:a8-0b",
        "swversion": "5.38.2.19136"
    },
    "5": {
        "state": {
            "on": false,
            "bri": 178,
            "alert": "none",
            "reachable": true
        },
        "type": "Dimmable light",
        "name": "office lamp 1b",
        "modelid": "LWB006",
        "manufacturername": "Philips",
        "uniqueid": "00:17:88:01:10:2b:3c:3e-0b",
        "swversion": "5.38.2.19136"
    },
    "6": {
        "state": {
            "on": true,
            "bri": 160,
            "hue": 3010,
            "sat": 249,
            "effect": "none",
            "xy": [
                0.6726,
                0.3219
            ],
            "alert": "none",
            "colormode": "xy",
            "reachable": true
        },
        "type": "Color light",
        "name": "Hue iris 1",
        "modelid": "LLC010",
        "manufacturername": "Philips",
        "uniqueid": "00:17:88:01:00:0c:82:fd-0b",
        "swversion": "5.23.1.13452"
    },
    "7": {
        "state": {
            "on": false,
            "bri": 254,
            "hue": 12754,
            "sat": 53,
            "effect": "none",
            "xy": [
                0.4584,
                0.412
            ],
            "alert": "none",
            "colormode": "xy",
            "reachable": true
        },
        "type": "Color light",
        "name": "Hue bloom 1",
        "modelid": "LLC012",
        "manufacturername": "Philips",
        "uniqueid": "00:17:88:01:00:c1:e5:69-0b",
        "swversion": "5.23.1.13452"
    },
    "8": {
        "state": {
            "on": false,
            "bri": 178,
            "alert": "none",
            "reachable": true
        },
        "type": "Dimmable light",
        "name": "office lamp 2",
        "modelid": "LWB006",
        "manufacturername": "Philips",
        "uniqueid": "00:17:88:01:10:40:88:79-0b",
        "swversion": "5.38.2.19136"
    },
    "9": {
        "state": {
            "on": false,
            "bri": 178,
            "alert": "none",
            "reachable": true
        },
        "type": "Dimmable light",
        "name": "office lamp 1a",
        "modelid": "LWB006",
        "manufacturername": "Philips",
        "uniqueid": "00:17:88:01:10:57:42:6a-0b",
        "swversion": "5.38.2.19136"
    },
    "10": {
        "state": {
            "on": true,
            "bri": 99,
            "alert": "none",
            "reachable": false
        },
        "type": "Dimmable light",
        "name": "ge link flood 1",
        "modelid": "ZLL Light",
        "manufacturername": "GE_Appliances",
        "uniqueid": "7c:e5:24:00:00:01:5a:b0-01",
        "swversion": "1.3.4.0"
    },
    "11": {
        "state": {
            "on": false,
            "bri": 178,
            "alert": "none",
            "reachable": true
        },
        "type": "Dimmable light",
        "name": "office lamp 1c",
        "modelid": "LWB006",
        "manufacturername": "Philips",
        "uniqueid": "00:17:88:01:10:57:43:2f-0b",
        "swversion": "5.38.2.19136"
    },
    "12": {
        "state": {
            "on": true,
            "bri": 254,
            "hue": 6652,
            "sat": 254,
            "effect": "none",
            "xy": [
                0.556,
                0.4101
            ],
            "ct": 500,
            "alert": "none",
            "colormode": "xy",
            "reachable": true
        },
        "type": "Extended color light",
        "name": "living room color 1a",
        "modelid": "LCT014",
        "manufacturername": "Philips",
        "uniqueid": "00:17:88:01:02:33:78:db-0b",
        "swversion": "1.15.2_r19181",
        "swconfigid": "A315E69E",
        "productid": "Philips-LCT014-1-A19ECLv4"
    },
    "13": {
        "state": {
            "on": true,
            "bri": 254,
            "hue": 4797,
            "sat": 254,
            "effect": "none",
            "xy": [
                0.5938,
                0.3817
            ],
            "ct": 153,
            "alert": "none",
            "colormode": "xy",
            "reachable": true
        },
        "type": "Extended color light",
        "name": "living room color 1b",
        "modelid": "LCT014",
        "manufacturername": "Philips",
        "uniqueid": "00:17:88:01:02:33:7c:96-0b",
        "swversion": "1.15.2_r19181",
        "swconfigid": "A315E69E",
        "productid": "Philips-LCT014-1-A19ECLv4"
    },
    "14": {
        "state": {
            "on": false,
            "bri": 254,
            "hue": 14916,
            "sat": 142,
            "effect": "none",
            "xy": [
                0.4584,
                0.41
            ],
            "ct": 366,
            "alert": "none",
            "colormode": "xy",
            "reachable": true
        },
        "type": "Extended color light",
        "name": "bedroom color lamp 2",
        "modelid": "LCT007",
        "manufacturername": "Philips",
        "uniqueid": "00:17:88:01:02:44:03:6a-0b",
        "swversion": "5.50.1.19085"
    },
    "15": {
        "state": {
            "on": false,
            "bri": 254,
            "hue": 14916,
            "sat": 142,
            "effect": "none",
            "xy": [
                0.4584,
                0.41
            ],
            "ct": 366,
            "alert": "none",
            "colormode": "xy",
            "reachable": true
        },
        "type": "Extended color light",
        "name": "bedroom color lamp 1",
        "modelid": "LCT007",
        "manufacturername": "Philips",
        "uniqueid": "00:17:88:01:02:44:03:72-0b",
        "swversion": "5.50.1.19085"
    }
}
blitzcode commented 7 years ago

That's (unfortunately) working as designed, see here:

https://github.com/blitzcode/hue-dashboard#groups

Basically, Hue had no idea of rooms etc. when I originally wrote this software and I simply implemented the most basic thing that worked for me, grouping on prefix. We had the prefixes anyway since HomeKit, Alexa etc. wants pronounceable and unique names for bulbs. So you can't call two bulbs 'Table', so we simply had 'Kitchen Table' etc.

I realize this might not work for everybody's setup. I'm thinking I could either actually respect the rooms from the Hue API or maybe have my own scheme where you can just pick bubs like in the scene creation dialog.

It's always a good idea to learn Haskell ;-) If you're interested, the grouping is done here:

https://github.com/blitzcode/hue-dashboard/blob/master/App.hs#L51

(Also note the TODOs)

mreeves1 commented 7 years ago

OK, thanks. I will try to take a look when I get a moment.

blitzcode commented 7 years ago

I'm thinking it would be nice to have a command line option to select between the prefix grouping and pulling the Hue rooms, might be a while till I get around to implementing that, though