unfoldedcircle / integration-home-assistant

Home-Assistant Integration for Remote Two
Mozilla Public License 2.0
28 stars 5 forks source link

Light entity: can we retrieve mired range per light? #9

Open zehnm opened 1 year ago

zehnm commented 1 year ago

Relates to src/client/service/light.rs

zehnm commented 1 year ago

We might have to extract it directly from a change event and store it internally:

{
  "id": 1,
  "type": "event",
  "event": {
    "event_type": "state_changed",
    "data": {
      "entity_id": "light.sitting_room_chandellier",
      "old_state": {
        "entity_id": "light.sitting_room_chandellier",
        "state": "on",
        "attributes": {
          "min_color_temp_kelvin": 2000,
          "max_color_temp_kelvin": 6535,
          "min_mireds": 153,
          "max_mireds": 500,
          "supported_color_modes": [
            "color_temp",
            "hs"
          ],
          "color_mode": "hs",
          "brightness": 161,
          "hs_color": [
            240.0,
            85.714
          ],
          "rgb_color": [
            36,
            36,
            255
          ],
          "xy_color": [
            0.144,
            0.053
          ],
          "friendly_name": "Sitting room chandellier",
          "supported_features": 0
        },
        "last_changed": "2023-03-18T16:59:23.087164+00:00",
        "last_updated": "2023-03-18T17:02:29.844119+00:00",
        "context": {
          "id": "01GVTTRDY9QW6VTCDHBRXQ76NZ",
          "parent_id": null,
          "user_id": "1571c1bbf7b443108b00f06a3c35de00"
        }
      },
      "new_state": {
        "entity_id": "light.sitting_room_chandellier",
        "state": "on",
        "attributes": {
          "min_color_temp_kelvin": 2000,
          "max_color_temp_kelvin": 6535,
          "min_mireds": 153,
          "max_mireds": 500,
          "supported_color_modes": [
            "color_temp",
            "hs"
          ],
          "color_mode": "hs",
          "brightness": 102,
          "hs_color": [
            240.0,
            85.714
          ],
          "rgb_color": [
            36,
            36,
            255
          ],
          "xy_color": [
            0.144,
            0.053
          ],
          "friendly_name": "Sitting room chandellier",
          "supported_features": 0
        },
        "last_changed": "2023-03-18T16:59:23.087164+00:00",
        "last_updated": "2023-03-18T17:03:02.509146+00:00",
        "context": {
          "id": "01GVTTSDSZP99SP3MXZBPKEZFG",
          "parent_id": null,
          "user_id": "1571c1bbf7b443108b00f06a3c35de00"
        }
      }
    },
    "origin": "LOCAL",
    "time_fired": "2023-03-18T17:03:02.509146+00:00",
    "context": {
      "id": "01GVTTSDSZP99SP3MXZBPKEZFG",
      "parent_id": null,
      "user_id": "1571c1bbf7b443108b00f06a3c35de00"
    }
  }
}