dlarrick / pykumo

Python library to interact with Mitsubishi KumoCloud devices via their local API
MIT License
33 stars 12 forks source link

feat: Add support for kumo station with its outdoor temp #17

Closed brgaulin closed 2 years ago

brgaulin commented 2 years ago

This PR adds support for different MHK2 types. In our system we have units attached to the Kumo Station, and units attached to the indoor ductless units. This also allows you to pull the relevant data from the Kumo Station(currently only outdoor temperature, but we can add more later).

Rough Draft, but were you thinking something like this @dlarrick ? I'm in no rush to get this merged, but had a spark of inspiration and didn't want to lose it lol. It looks like a lot more changes than it is. Mostly in that there is some refactoring of where the things are. I broke out PyKumo -> PyKumoIndoorUnit, and PyKumoCloudAccount to its own file.

Locally, when I use that optional script I have commented out in the server_parser, so it actually goes out and makes API calls to the units, I get the expected output.

I can work on a PR for the hass custom component as well to be able to consume this, thinking somewhat similar.

if (indoorUnit) { expose climate } else (kumoStation) { expose sensor }

Also looking for feedback on how we are detecting the station vs the indoor unit. This seems to work well with our system, but not sure if it is conservative enough to be able to tell 100%. I also do not have a thermostat or remote sensor in my system, not sure if those would appear differently. So I think this would be the biggest area of concern.

dlarrick commented 2 years ago

Merging this into a local branch for easier review & testing

dlarrick commented 2 years ago

@brgaulin your description references MHK2 which is confusing me. My understanding:

My system has neither of these so please correct my understanding if needed.

brgaulin commented 2 years ago

I’m not actually sure where I got MHK2 from. The kumo station uses the same wireless interface as the indoor units. Mine uses a PAC-USWHS002-WF-2.

I don’t have it handy but I think the kumo station model number is PAC-WHS01HC-E. And you have described it correctly. It has an outdoor temp sensor that it is wired to. And if temps go below, say 10F. It will call for oil heat instead of using the heat pump. The kumo station controls the oil, and kumo cloud(through the wireless interface) controls the kumo station.

Additional info: the kumo station is paired to a single indoor air handler. So if you have multiple on a single floor. It can call for heat, but it only uses the thermostat of one of the indoor units to provide a more consistent experience.

dlarrick commented 2 years ago

@brgaulin thanks, that makes more sense now. Do you have a complete response from a {"c":{"eqc":{}}} query that you're willing to share? Stripped of any sensitive information of course.

brgaulin commented 2 years ago

@dlarrick

{
    "r": {
        "eqc": {
            "reporting": {
                "1": "",
                "2": "",
                "3": "",
                "4": "",
                "5": ""
            },
            "heatModeDisable": true,
            "connected": true,
            "oat": -10.6,
            "tempSource": "tb24",
            "sourceReport": {
                "serial": "__ungettable",
                "roomTemp": "__ungettable",
                "setPoint": "__ungettable",
                "error": "__ungettable",
                "mode": "__ungettable",
                "defrost": "__ungettable",
                "humidity": "__ungettable"
            },
            "channels": {
                "1": {
                    "permission": "auto",
                    "status": "off",
                    "sourceZone": {
                        "serial": "1734P008T1809999",
                        "setPoint": 0,
                        "roomTemp": 17.5,
                        "mode": 7,
                        "error": false,
                        "defrost": false,
                        "humidity": null
                    },
                    "ductHeater": false,
                    "type": "heater",
                    "heaterOptions": {
                        "lockout": 1.5,
                        "hpBalance": 7,
                        "stage": 1,
                        "delay": 20
                    },
                    "depZones": {
                        "1": "1734P008T1809999",
                        "2": "",
                        "3": "",
                        "4": "",
                        "5": "",
                        "6": "",
                        "7": "",
                        "8": "",
                        "9": "",
                        "10": ""
                    },
                    "ventOptions": {
                        "airCycle": 0,
                        "duration": 0,
                        "remaining": 0,
                        "start": null,
                        "end": "0000"
                    },
                    "ductHumid": false,
                    "humidOptions": {
                        "auto": false,
                        "autoset": 0
                    },
                    "hydronicOptions": {
                        "lockout": 1.5,
                        "hpBalance": 7,
                        "delay": 1,
                        "bumpDuty": 20,
                        "bumpPeriod": 0,
                        "bumpTime": "0000",
                        "bumping": false
                    }
                },
                "2": {
                    "permission": "auto",
                    "status": "off",
                    "sourceZone": {
                        "serial": "1434P008T1009999",
                        "setPoint": 18,
                        "roomTemp": 20,
                        "mode": 0,
                        "error": false,
                        "defrost": false,
                        "humidity": null
                    },
                    "ductHeater": false,
                    "type": "heater",
                    "heaterOptions": {
                        "lockout": -1,
                        "hpBalance": 1.5,
                        "stage": 1,
                        "delay": 20
                    },
                    "depZones": {
                        "1": "1434P008T1009999",
                        "2": "1434P008T1009999",
                        "3": "1434P008T1009999",
                        "4": "1434P008T1009999",
                        "5": "",
                        "6": "",
                        "7": "",
                        "8": "",
                        "9": "",
                        "10": ""
                    },
                    "ventOptions": {
                        "airCycle": 0,
                        "duration": 0,
                        "remaining": 0,
                        "start": null,
                        "end": "0000"
                    },
                    "ductHumid": false,
                    "humidOptions": {
                        "auto": false,
                        "autoset": 0
                    },
                    "hydronicOptions": {
                        "lockout": -1,
                        "hpBalance": 1.5,
                        "delay": 1,
                        "bumpDuty": 20,
                        "bumpPeriod": 0,
                        "bumpTime": "0000",
                        "bumping": false
                    }
                },
                "3": {
                    "permission": "off",
                    "status": "off",
                    "sourceZone": {
                        "serial": "",
                        "setPoint": 0,
                        "roomTemp": 0,
                        "mode": 0,
                        "error": false,
                        "defrost": false,
                        "humidity": null
                    },
                    "ductHeater": false,
                    "type": "unset",
                    "heaterOptions": {
                        "lockout": 0,
                        "hpBalance": 0,
                        "stage": 0,
                        "delay": 0
                    },
                    "depZones": {
                        "1": "",
                        "2": "",
                        "3": "",
                        "4": "",
                        "5": "",
                        "6": "",
                        "7": "",
                        "8": "",
                        "9": "",
                        "10": ""
                    },
                    "ventOptions": {
                        "airCycle": 0,
                        "duration": 0,
                        "remaining": 0,
                        "start": "0000",
                        "end": "0000"
                    },
                    "ductHumid": false,
                    "humidOptions": {
                        "auto": false,
                        "autoset": 0
                    },
                    "hydronicOptions": {
                        "lockout": 0,
                        "hpBalance": 0,
                        "delay": 0,
                        "bumpDuty": 0,
                        "bumpPeriod": 0,
                        "bumpTime": "0000",
                        "bumping": false
                    }
                },
                "4": {
                    "permission": "off",
                    "status": "off",
                    "sourceZone": {
                        "serial": "",
                        "setPoint": 0,
                        "roomTemp": 0,
                        "mode": 0,
                        "error": false,
                        "defrost": false,
                        "humidity": null
                    },
                    "ductHeater": false,
                    "type": "unset",
                    "heaterOptions": {
                        "lockout": 0,
                        "hpBalance": 0,
                        "stage": 0,
                        "delay": 0
                    },
                    "depZones": {
                        "1": "",
                        "2": "",
                        "3": "",
                        "4": "",
                        "5": "",
                        "6": "",
                        "7": "",
                        "8": "",
                        "9": "",
                        "10": ""
                    },
                    "ventOptions": {
                        "airCycle": 0,
                        "duration": 0,
                        "remaining": 0,
                        "start": "0000",
                        "end": "0000"
                    },
                    "ductHumid": false,
                    "humidOptions": {
                        "auto": false,
                        "autoset": 0
                    },
                    "hydronicOptions": {
                        "lockout": 0,
                        "hpBalance": 0,
                        "delay": 0,
                        "bumpDuty": 0,
                        "bumpPeriod": 0,
                        "bumpTime": "0000",
                        "bumping": false
                    }
                }
            }
        }
    }
}

Note depZones are the serials of the indoor units that belong to that "group". In my instance I have 2 "groups" aka "zones" of oil heating. One zone only has a single indoor unit, the other has 3. So when any of those dependent indoor units need heat, they activate the appropriate zone of oil heat via the kumo station. I think the kumo station can control up to 4 alternative heat sources.