RobertD502 / home-assistant-flair

Custom component for Home Assistant Core for Flair pucks, vents, rooms, structures, and minisplits
MIT License
96 stars 12 forks source link

Unable to configure #18

Closed jmswindle closed 2 years ago

jmswindle commented 2 years ago

I try to configure the integration and get the following error

This error originated from a custom integration.

Logger: custom_components.flair.config_flow
Source: custom_components/flair/config_flow.py:67
Integration: Flair (documentation, issues)
First occurred: 9:08:16 AM (2 occurrences)
Last logged: 9:08:53 AM

Error occured during Flair setup: 'ON'
RobertD502 commented 2 years ago

I can't say for sure why the API would be returning such a cryptic error. Some users have had quirky problems in their setups (no fault to them, just how Flair handles some things), that has required an in depth investigation to find out why their account isn't playing nice with the API. Do you have an e-mail you can be reached at?

McSwindler commented 2 years ago

I did some debugging and here's some more details stacktrace:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/beatter/flair/.venv/lib/python3.8/site-packages/flair/flair_helper.py", line 42, in __init__
    self.discover_hvac_units()
  File "/home/beatter/flair/.venv/lib/python3.8/site-packages/flair/flair_helper.py", line 173, in discover_hvac_units
    hvac_units.append(HvacUnit(hvac, self))
  File "/home/beatter/flair/.venv/lib/python3.8/site-packages/flair/hvac_units/hvac_unit.py", line 10, in __init__
    self.refresh()
  File "/home/beatter/flair/.venv/lib/python3.8/site-packages/flair/hvac_units/hvac_unit.py", line 93, in refresh
    for key in hvac_state.attributes['constraints']['ON']['COOL']['ON'].keys():
KeyError: 'ON'

Has to do with my portable AC unit I have configured, here's the payload:

{
    "meta": {
        "self": "/api/hvac-units",
        "first": "/api/hvac-units?include=&page%5Bsize%5D=50&page%5Bpage%5D=1",
        "last": "/api/hvac-units?include=&page%5Bsize%5D=50&page%5Bpage%5D=1",
        "next": null,
        "prev": null
    },
    "data": [
        {
            "type": "hvac-units",
            "relationships": {
                "hvac-unit-states": {
                    "links": {
                        "related": "/api/hvac-units/21c2f325-7d85-4c56-9f40-abb91e130b4f/hvac-unit-states"
                    }
                },
                "room": {
                    "links": {
                        "self": "/api/hvac-units/21c2f325-7d85-4c56-9f40-abb91e130b4f/relationships/room",
                        "related": "/api/hvac-units/21c2f325-7d85-4c56-9f40-abb91e130b4f/room"
                    },
                    "data": {
                        "type": "rooms",
                        "id": "24088"
                    }
                },
                "plug": {
                    "links": {
                        "self": "/api/hvac-units/21c2f325-7d85-4c56-9f40-abb91e130b4f/relationships/plug",
                        "related": "/api/hvac-units/21c2f325-7d85-4c56-9f40-abb91e130b4f/plug"
                    },
                    "data": null
                },
                "structure": {
                    "links": {
                        "self": "/api/hvac-units/21c2f325-7d85-4c56-9f40-abb91e130b4f/relationships/structure",
                        "related": "/api/hvac-units/21c2f325-7d85-4c56-9f40-abb91e130b4f/structure"
                    },
                    "data": {
                        "type": "structures",
                        "id": "16563"
                    }
                },
                "zone": {
                    "links": {
                        "self": "/api/hvac-units/21c2f325-7d85-4c56-9f40-abb91e130b4f/relationships/zone",
                        "related": "/api/hvac-units/21c2f325-7d85-4c56-9f40-abb91e130b4f/zone"
                    },
                    "data": {
                        "type": "zones",
                        "id": "58935"
                    }
                },
                "puck": {
                    "links": {
                        "self": "/api/hvac-units/21c2f325-7d85-4c56-9f40-abb91e130b4f/relationships/puck",
                        "related": "/api/hvac-units/21c2f325-7d85-4c56-9f40-abb91e130b4f/puck"
                    },
                    "data": {
                        "type": "pucks",
                        "id": "35ae5fba-002f-5afe-9c38-772a515be8b6"
                    }
                },
                "current-state": {
                    "links": {
                        "related": "/api/hvac-units/21c2f325-7d85-4c56-9f40-abb91e130b4f/current-state"
                    },
                    "data": {
                        "type": "hvac-unit-states",
                        "id": "0f65e015-e8f8-40b7-8770-e389a58f562e"
                    }
                },
                "make": {
                    "links": {
                        "self": "/api/hvac-units/21c2f325-7d85-4c56-9f40-abb91e130b4f/relationships/make",
                        "related": "/api/hvac-units/21c2f325-7d85-4c56-9f40-abb91e130b4f/make"
                    }
                },
                "integration-structure": {
                    "links": {
                        "self": "/api/hvac-units/21c2f325-7d85-4c56-9f40-abb91e130b4f/relationships/integration_structures",
                        "related": "/api/hvac-units/21c2f325-7d85-4c56-9f40-abb91e130b4f/integration_structures"
                    },
                    "data": null
                }
            },
            "attributes": {
                "to-download": false,
                "name": "Insignia",
                "swing-auto": false,
                "power": "On",
                "make-id": "9a319931-2cda-4869-8257-41aac8ebcd67",
                "dr-start-time": null,
                "current-dr-state": null,
                "user-selected-make-id": "5ed406dc-c039-4c09-87f6-23638d28040a",
                "model-id": "4c9689b8-d2f3-4c8b-8757-8c493047bace",
                "temperature-compensation": "FLAIR NUDGE",
                "temperature": 72,
                "mode": "Cool",
                "quiet-hours-end": null,
                "ir-device-model-id": null,
                "created-at": "2020-07-21T20:47:44.531820+00:00",
                "codeset-id": "67469a03-c8dd-483a-b2b8-7ea1db8dcf29",
                "allowed-range": 300,
                "dr-end-time": null,
                "constraints": {
                    "ON": {
                        "DRY": {
                            "OFF": {
                                "FAN AUTO": [
                                    "62",
                                    "63",
                                    "64",
                                    "65",
                                    "66",
                                    "67",
                                    "68",
                                    "69",
                                    "70",
                                    "71",
                                    "72",
                                    "73",
                                    "74",
                                    "75",
                                    "76",
                                    "77",
                                    "78",
                                    "79",
                                    "80",
                                    "81",
                                    "82",
                                    "83",
                                    "84",
                                    "85",
                                    "86"
                                ]
                            }
                        },
                        "FAN": {
                            "OFF": {
                                "FAN HI": [
                                    "--"
                                ],
                                "FAN LOW": [
                                    "--"
                                ],
                                "FAN MID": [
                                    "--"
                                ],
                                "FAN AUTO": [
                                    "--"
                                ]
                            }
                        },
                        "AUTO": {
                            "OFF": {
                                "FAN AUTO": [
                                    "62",
                                    "63",
                                    "64",
                                    "65",
                                    "66",
                                    "67",
                                    "68",
                                    "69",
                                    "70",
                                    "71",
                                    "72",
                                    "73",
                                    "74",
                                    "75",
                                    "76",
                                    "77",
                                    "78",
                                    "79",
                                    "80",
                                    "81",
                                    "82",
                                    "83",
                                    "84",
                                    "85",
                                    "86"
                                ]
                            }
                        },
                        "COOL": {
                            "OFF": {
                                "FAN HI": [
                                    "62",
                                    "63",
                                    "64",
                                    "65",
                                    "66",
                                    "67",
                                    "68",
                                    "69",
                                    "70",
                                    "71",
                                    "72",
                                    "73",
                                    "74",
                                    "75",
                                    "76",
                                    "77",
                                    "78",
                                    "79",
                                    "80",
                                    "81",
                                    "82",
                                    "83",
                                    "84",
                                    "85",
                                    "86"
                                ],
                                "FAN LOW": [
                                    "62",
                                    "63",
                                    "64",
                                    "65",
                                    "66",
                                    "67",
                                    "68",
                                    "69",
                                    "70",
                                    "71",
                                    "72",
                                    "73",
                                    "74",
                                    "75",
                                    "76",
                                    "77",
                                    "78",
                                    "79",
                                    "80",
                                    "81",
                                    "82",
                                    "83",
                                    "84",
                                    "85",
                                    "86"
                                ],
                                "FAN MID": [
                                    "62",
                                    "63",
                                    "64",
                                    "65",
                                    "66",
                                    "67",
                                    "68",
                                    "69",
                                    "70",
                                    "71",
                                    "72",
                                    "73",
                                    "74",
                                    "75",
                                    "76",
                                    "77",
                                    "78",
                                    "79",
                                    "80",
                                    "81",
                                    "82",
                                    "83",
                                    "84",
                                    "85",
                                    "86"
                                ],
                                "FAN AUTO": [
                                    "62",
                                    "63",
                                    "64",
                                    "65",
                                    "66",
                                    "67",
                                    "68",
                                    "69",
                                    "70",
                                    "71",
                                    "72",
                                    "73",
                                    "74",
                                    "75",
                                    "76",
                                    "77",
                                    "78",
                                    "79",
                                    "80",
                                    "81",
                                    "82",
                                    "83",
                                    "84",
                                    "85",
                                    "86"
                                ]
                            }
                        },
                        "HEAT": {
                            "OFF": {
                                "FAN HI": [
                                    "62",
                                    "63",
                                    "64",
                                    "65",
                                    "66",
                                    "67",
                                    "68",
                                    "69",
                                    "70",
                                    "71",
                                    "72",
                                    "73",
                                    "74",
                                    "75",
                                    "76",
                                    "77",
                                    "78",
                                    "79",
                                    "80",
                                    "81",
                                    "82",
                                    "83",
                                    "84",
                                    "85",
                                    "86"
                                ],
                                "FAN LOW": [
                                    "62",
                                    "63",
                                    "64",
                                    "65",
                                    "66",
                                    "67",
                                    "68",
                                    "69",
                                    "70",
                                    "71",
                                    "72",
                                    "73",
                                    "74",
                                    "75",
                                    "76",
                                    "77",
                                    "78",
                                    "79",
                                    "80",
                                    "81",
                                    "82",
                                    "83",
                                    "84",
                                    "85",
                                    "86"
                                ],
                                "FAN MID": [
                                    "62",
                                    "63",
                                    "64",
                                    "65",
                                    "66",
                                    "67",
                                    "68",
                                    "69",
                                    "70",
                                    "71",
                                    "72",
                                    "73",
                                    "74",
                                    "75",
                                    "76",
                                    "77",
                                    "78",
                                    "79",
                                    "80",
                                    "81",
                                    "82",
                                    "83",
                                    "84",
                                    "85",
                                    "86"
                                ],
                                "FAN AUTO": [
                                    "62",
                                    "63",
                                    "64",
                                    "65",
                                    "66",
                                    "67",
                                    "68",
                                    "69",
                                    "70",
                                    "71",
                                    "72",
                                    "73",
                                    "74",
                                    "75",
                                    "76",
                                    "77",
                                    "78",
                                    "79",
                                    "80",
                                    "81",
                                    "82",
                                    "83",
                                    "84",
                                    "85",
                                    "86"
                                ]
                            }
                        }
                    },
                    "OFF": {
                        "AUTO": {
                            "OFF": {
                                "FAN AUTO": [
                                    "72"
                                ]
                            }
                        }
                    },
                    "temperature-scale": "F"
                },
                "swing": "Off",
                "updated-at": "2022-03-11T03:52:54.221225+00:00",
                "capabilities": "Cool",
                "-temperature-compensation-limit-c": 300,
                "quiet-hours-start": null,
                "fan-speed": "Auto",
                "incremental": false,
                "codesets": [
                    {
                        "id": 2,
                        "codeset-id": "67469a03-c8dd-483a-b2b8-7ea1db8dcf29",
                        "capabilities": "Both",
                        "rank": 1
                    }
                ],
                "make-name": "OTHERS",
                "default-fan-speed": "AUTO",
                "is-wifi-enabled": false,
                "type": "SpaceHeater",
                "button-presses": []
            },
            "id": "21c2f325-7d85-4c56-9f40-abb91e130b4f"
        }
    ]
}
RobertD502 commented 2 years ago

I appreciate you doing that. Flair is weird in that some instances their IR code library includes an ON key for settings such as cool, but in others, even if the unit supports cooling, they do not. I'll have to push an update to the library to run a check. Once that is done, I'll push out a new release. Still odd that the Home assistant log didn't log the exception in its entirety and just logged the key that is missing.

awakefie commented 2 years ago

I am getting an error when trying to add using OAuth 1 credentials. I don't have any IR based HVAC units. The flair product is integrated to EcoBee today. I would love to provide logging, but I do not see anything meaningful in the log related to Flair.

RobertD502 commented 2 years ago

I am getting an error when trying to add using OAuth 1 credentials. I don't have any IR based HVAC units. The flair product is integrated to EcoBee today. I would love to provide logging, but I do not see anything meaningful in the log related to Flair.

What error is popping up?

awakefie commented 2 years ago

Right now I just get 'Unknown Error' I can't seem to find anything in the logs.

RobertD502 commented 2 years ago

Right now I just get 'Unknown Error' I can't seem to find anything in the logs.

If you could email me your credentials to FlairHass at gmail dot com I can take a deeper look into it. Be sure to also include the email that is associated with your Flair account in case I need to provide it to the Flair Developers.

RobertD502 commented 2 years ago

@McSwindler @jmswindle

Sorry for getting back to you so late. I just pushed out an update to the library.

  1. Go to the flair folder (located in the custom_components folder in Home Assistant)
  2. Open the manifest file
  3. Change hass-flair-helper==0.1.1 to hass-flair-helper==0.1.2
  4. Save the changes
  5. Restart Home Assistant
  6. Try setting up the integration using your credentials

Please let me know if that fixed the problem for you.

McSwindler commented 2 years ago

@RobertD502 yes! this worked, I was able to configure all my devices successfully Thank you!

RobertD502 commented 2 years ago

Fixed in 0.0.5.5 release