DotEfekts / ElectroluxClimateComponent

Custom Component for Home Assistant to control Electrolux airconditioners
Apache License 2.0
13 stars 3 forks source link

Support for Kelvinator KSD35HWJ (electrolux rebrand) #7

Open Tradeforlife opened 5 months ago

Tradeforlife commented 5 months ago

I tried to install the module into Home Assistant and I have received the following error message.

Logger: homeassistant.components.climate
Source: helpers/entity_platform.py:360
Integration: Climate ([documentation](https://www.home-assistant.io/integrations/climate), [issues](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+climate%22))
First occurred: 1:36:55 PM (4 occurrences)
Last logged: 1:45:32 PM

Error while setting up electrolux_climate platform for climate
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 360, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/electrolux_climate/climate.py", line 51, in async_setup_entry
    sn = json.loads(create_from_device(discovery[0]).get_status())["sn"]
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
KeyError: 'sn'

I'm running a instance of mitmproxy and can pull out the data being send to the servers, below is the data with info removed.

{
    "error": 0,
    "familyallinfo": [
        {
            "createuser": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
            "devinfo": [
                {
                    "aeskey": "XXXXXXXXXXXXXXXXXXXXXXXXXXXX",
                    "devicetypeflag": 0,
                    "devtype": 20379,
                    "did": "00000000000000000000ec0bae25f1f0",
                    "extend": "",
                    "familyid": "01622b56b358369756eb24e9603a438a",
                    "groupdevice": null,
                    "latitude": 0,
                    "lock": false,
                    "longitude": 0,
                    "mac": "ec:0b:ae:25:f1:f0",
                    "name": "Study aircon",
                    "password": XXXXXXXXX,
                    "pid": "0000000000000000000000009b4f0000",
                    "roomid": "",
                    "subdevicenum": 1,
                    "terminalid": 1,
                    "userid": "",
                    "version": "",
                    "wifimac": ""
                }
            ],
            "familyid": "",
            "familyinfo": {
                "additional": {
                    "room": {
                        "action": "",
                        "roomlist": null
                    }
                },
                "area": "",
                "attributes": [
                    ""
                ],
                "city": "",
                "country": "",
                "description": "XXXXXXXX",
                "familyid": "01622b56b358369756eb24e9603a438a",
                "familylimit": 2,
                "groupname": "",
                "icon": "https://ea59b746e7cdfe5ee37efa25560d3b3bbizihcv0.ibroadlink.com/ec4pic/3e/45/8607c79a0481d090d4ed91bdb8af.png",
                "latitude": 0,
                "location": {
                    "city": "",
                    "country": "",
                    "province": ""
                },
                "longitude": 0,
                "mailaddress": "",
                "name": "Electrolux Family",
                "order": 0,
                "orgname": "",
                "postcode": "",
                "province": "",
                "userid": "",
                "version": "2024-01-26 11:11:00"
            },
            "familystate": 0,
            "moduleinfo": [
                {
                    "attributes": [
                        ""
                    ],
                    "extend": "",
                    "extern": "",
                    "familyid": "01622b56b358369756eb24e9603a438a",
                    "flag": 1,
                    "followdev": 1,
                    "icon": "",
                    "linkagetype": "",
                    "moduledev": [
                        {
                            "content": "",
                            "devmoduleid": "",
                            "did": "00000000000000000000ec0bae25f1f0",
                            "order": 0,
                            "sdid": ""
                        }
                    ],
                    "moduleid": "3108857319406149135",
                    "moduletype": 3,
                    "name": "Study aircon",
                    "order": 1,
                    "resourcetag": "",
                    "roomid": "",
                    "scenetype": "",
                    "userid": "",
                    "version": ""
                }
            ],
            "roominfo": [
                {
                    "familyid": "01622b56b358369756eb24e9603a438a",
                    "name": "The entrance",
                    "order": 17,
                    "roomid": "2108122865905232032",
                    "type": 24
                },
                {
                    "familyid": "01622b56b358369756eb24e9603a438a",
                    "name": "Bathroom",
                    "order": 6,
                    "roomid": "2108175197022344854",
                    "type": 6
                },
                {
                    "familyid": "01622b56b358369756eb24e9603a438a",
                    "name": "Study room",
                    "order": 3,
                    "roomid": "2108249375595760075",
                    "type": 3
                },
                {
                    "familyid": "01622b56b358369756eb24e9603a438a",
                    "name": "Dining room",
                    "order": 12,
                    "roomid": "2108263985903951930",
                    "type": 19
                },
                {
                    "familyid": "01622b56b358369756eb24e9603a438a",
                    "name": "Second floor",
                    "order": 19,
                    "roomid": "2108281094908921939",
                    "type": 26
                },
                {
                    "familyid": "01622b56b358369756eb24e9603a438a",
                    "name": "Children room",
                    "order": 9,
                    "roomid": "2108288875872376298",
                    "type": 16
                },
                {
                    "familyid": "01622b56b358369756eb24e9603a438a",
                    "name": "Senior housing",
                    "order": 15,
                    "roomid": "2108320825224109835",
                    "type": 22
                },
                {
                    "familyid": "01622b56b358369756eb24e9603a438a",
                    "name": "Downstairs",
                    "order": 21,
                    "roomid": "2108416219027373986",
                    "type": 28
                },
                {
                    "familyid": "01622b56b358369756eb24e9603a438a",
                    "name": "Kitchen",
                    "order": 5,
                    "roomid": "2108442222069349331",
                    "type": 5
                },
                {
                    "familyid": "01622b56b358369756eb24e9603a438a",
                    "name": "Bedroom",
                    "order": 1,
                    "roomid": "2108482499520254050",
                    "type": 1
                },
                {
                    "familyid": "01622b56b358369756eb24e9603a438a",
                    "name": "Second bedroom",
                    "order": 11,
                    "roomid": "2108587754434943428",
                    "type": 18
                },
                {
                    "familyid": "01622b56b358369756eb24e9603a438a",
                    "name": "Pet room",
                    "order": 14,
                    "roomid": "2108768290980543766",
                    "type": 21
                },
                {
                    "familyid": "01622b56b358369756eb24e9603a438a",
                    "name": "Baby room",
                    "order": 4,
                    "roomid": "2108828963321931534",
                    "type": 4
                },
                {
                    "familyid": "01622b56b358369756eb24e9603a438a",
                    "name": "Dining room",
                    "order": 8,
                    "roomid": "2108972050854945746",
                    "type": 14
                },
                {
                    "familyid": "01622b56b358369756eb24e9603a438a",
                    "name": "Guest room",
                    "order": 2,
                    "roomid": "2109030471413154198",
                    "type": 2
                },
                {
                    "familyid": "01622b56b358369756eb24e9603a438a",
                    "name": "Master bedroom",
                    "order": 10,
                    "roomid": "2109034396124087022",
                    "type": 17
                },
                {
                    "familyid": "01622b56b358369756eb24e9603a438a",
                    "name": "Upstairs",
                    "order": 20,
                    "roomid": "2109050077471702125",
                    "type": 27
                },
                {
                    "familyid": "01622b56b358369756eb24e9603a438a",
                    "name": "Balcony",
                    "order": 13,
                    "roomid": "2109071542889666509",
                    "type": 20
                },
                {
                    "familyid": "01622b56b358369756eb24e9603a438a",
                    "name": "Shower room",
                    "order": 16,
                    "roomid": "2109147979646986333",
                    "type": 23
                },
                {
                    "familyid": "01622b56b358369756eb24e9603a438a",
                    "name": "Living-room",
                    "order": 7,
                    "roomid": "2109148457450670871",
                    "type": 10
                },
                {
                    "familyid": "01622b56b358369756eb24e9603a438a",
                    "name": "Ground floor",
                    "order": 18,
                    "roomid": "2109181167269702173",
                    "type": 25
                }
            ],
            "shareflag": 0
        }
    ],
    "msg": "ok",
    "status": 0
}

the rooms on the end are default I only have the study aircon setup.

DotEfekts commented 5 months ago

That's odd as mine are the KSD25HWJ and KSD71HWJ so I'd expect that one in particular to be working. Have you set it up in the Kelvinator Home Comfort app? The outgoing server packet is not super useful here, when the app is on the same network as the aircon it sends all the packets locally. I'll try to add the status JSON output to the error so I can get some more info.

Tradeforlife commented 5 months ago

I have set it up within the app that information above is from the app talking to the servers.

I have the aircon on my IOT network with is different to my Home Assistant however they can talk to each other..

Tradeforlife commented 5 months ago

I updated and reran, here's the results.

Logger: root
Source: custom_components/electrolux_climate/climate.py:57
Integration: Electrolux Climate
First occurred: 9:21:13 AM (1 occurrences)
Last logged: 9:21:13 AM

SN not available on entry
Logger: root
Source: custom_components/electrolux_climate/climate.py:58
Integration: Electrolux Climate
First occurred: 9:21:13 AM (1 occurrences)
Last logged: 9:21:13 AM

{'ac_pwr': 0, 'filreset': 0, 'qtmode': 1, 'scrdisp': 1, 'disimode': 0, 'i_clean': 0, 'insectrepellent': 0, 'ac_hdir': 0, 'ac_vdir': 1, 'ac_mark': 0, 'tempunit': 1, 'temp': 26, 'envtemp': 24, 'ac_mode': 0, 'anionmode': 0, 'mldprf': 0, 'ac_coldplasma': 0, 'espmode': 0, 'ecomode': 0, 'smarteyes': 0, 'ac_slp': 0, 'drmode': 0, 'drtime': 0, 'timer': '0000|01|0000|00', 'ac_timingenable': 0, 'modelnumber': 'KSD35HWJ', 'upload_enable': 1, 'ac_evapordefroststate': 0, 'ac_fourwayvalvestatus': 0, 'ac_heaterstatus': 0, 'ac_indoorfanstatus': 0, 'ac_compressorstatus': 0, 'ac_errcode': 0}
Logger: homeassistant.components.switch
Source: runner.py:188
Integration: Switch ([documentation](https://www.home-assistant.io/integrations/switch), [issues](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+switch%22))
First occurred: 9:21:02 AM (1 occurrences)
Last logged: 9:21:02 AM

Setup of switch platform electrolux_climate is taking over 10 seconds