andrewleech / ha_magiqtouch

Home Assistant (HACS) integration to control Seeley MagiQtouch heating and cooling units.
MIT License
24 stars 6 forks source link

Zone Handling and common zones #15

Open wrodie opened 1 year ago

wrodie commented 1 year ago

I don't believe you guesses here are correct

climate.py line 187

        # Best guess: generally if this is true, this zone is a "common zone" of some kind.
        self.controls_system = (
            self.zone_index >= self.controller.current_system_state.NoOfZonesControl
            or self.controller.current_system_state.NoOfZones == 0
        )

In my system (heating only) Zones are returned as

    "ZoneName1": "MASTER BED",
    "ZoneName2": "BEDS 2,3,BATH",
    "ZoneName3": "OFFICE",
    "ZoneName4": "LOUNGE",
    "ZoneName5": "COMMON ZONE",
    "ZoneName6": "ZONE 6",
    "ZoneName7": "ZONE 7",
    "ZoneName8": "ZONE 8",
    "ZoneName9": "ZONE 9",
    "ZoneName10": "ZONE 10"

but

    "NoOfZones": 5,
    "NoOfZonesControl": 1,
    "HeaterInSystem": 1,

Your code's assumption is that zone 1 is the common zone, but in my situation that is zone5 (zone_index = 4)

Using the climate card I can turn off the zone only for the "MASTER BED" zone, if I attempt with any of the others, then it turns off the system. If I log (self.zone_index, self.controls_system, self.controller.current_system_state.NoOfZonesControl) then I get the following results

0 , False, 1
1 , True, 1
2 , True, 1
3 , True, 1
4 , True, 1

Which is not correct.

andrewleech commented 1 year ago

FYI @epetousis

So perhaps the zone name needs to be checked to find "Common Zone", maybe it's the name that's consistent across installations.

wrodie commented 1 year ago

Is it something you could leave to part of the user config? As part of the initial setup, provide the user with a dropdown list of zones and ask them to choose the common/master zone.

andrewleech commented 1 year ago

Yeah that would be more flexible, if the zone list can be queried in time... Did you get those names printed out from the API somewhere? Are they already retrieved in the code such that they could be listed?

I don't have zones so there's only so much I can figure out myself...

wrodie commented 1 year ago

The zone list was from the dump the integration logs on first connection. custom_components/magiqtouch/magiqtouch.py:161

andrewleech commented 1 year ago

Ah great, would you mind copying that entire dump json here for reference?

Feel free to mask out the Mac address if it's there.

wrodie commented 1 year ago

{"NoOfZones": 5, "NoOfZonesControl": 1, "HeaterInSystem": 1, "AOCInverterInSystem": 0, "AOCFixedInSystem": 0, "NoOfEVAPInSystem": 0, "Heater": {"SerialNo": 1, "NewZealandHeater": 0, "MinimumTemperature": 0, "CommissioningDuctPressures": " ", "DataTableVersion": "D0.0", "DownDischargeHeater": 0, "ICSSoftwareRev": "D0.0", "ModelNo": "TQM632N", "AOCInstalled": 0, "MaximumTemperature": 37, "ModbusAddress": 141, "Brands": 0, "SerialNoPrefix": " ", "MaxSetFanSpeed": 10}, "AOCFixed": {"AOCUserTimeSet": 1, "AOCUserTimeVal": 0, "MaximumTemperature": 28, "MinimumTemperature": 18, "CompressorOnTemp": 8, "CompressorOnDelay": 3, "CompressorOffTemp": 10}, "AOCInverter": {"MinimumTemperature": 18, "ModbusAddress": 244, "MaximumTemperature": 28}, "EVAPCooler": {"WeatherSealOpeningSpeed": 4, "WaterManager": 0, "TankDrainDelay": 3, "MaximumTemperature": 28, "TemperatureUnits": 0, "HumidityControl": 0, "MinimumTemperature": 18, "SpeedTablePointer": 0, "Brands": 0, "SalinityDrainTriggerLevel": 0, "PrewetSelector": 1, "RampRate": 0}, "ZoneName1": "MASTER BED", "ZoneName2": "BEDS 2,3,BATH", "ZoneName3": "OFFICE", "ZoneName4": "LOUNGE", "ZoneName5": "COMMON ZONE", "ZoneName6": "ZONE 6", "ZoneName7": "ZONE 7", "ZoneName8": "ZONE 8", "ZoneName9": "ZONE 9", "ZoneName10": "ZONE 10"}

smcallis77 commented 1 year ago

I have the same problem as @wrodie My system (heating only) has three zones. Haven't got a log of my system state yet (waiting for a HA restart), but, based on testing my "COMMON ZONE" (system control) must also be the last zone in the index.

Changing this:

    # self.controls_system = (
    #     self.zone_index >= self.controller.current_system_state.NoOfZonesControl
    #     or self.controller.current_system_state.NoOfZones == 0
    # )

to this:

    if self.zone_index == 2:
        self.controls_system = True
    else:
        self.controls_system = False

works for my system.

Haven't tested yet but a more general case should be replace lines 188-191 with this:

    self.controls_system = (
        self.zone_index == self.controller.current_system_state.NoOfZones - 1
        or self.controller.current_system_state.NoOfZones == 0
    )

Perhaps it's just a better 'guess'.

When I can restart HA and get some logs. I'll report back my system state json dump and the success or otherwise of the code replacement.

BTW. Thanks for this integration @andrewleech. Other than this issue everything is working well. Before using the integration I was relying on Google Assistant that is plagued by 'Google cannot contact Magiqtouch' or words to that effect. This makes my wife very happy who was getting frustrated with a system that said it couldn't do what she asked it to do even though it actually (in most instances) did it. Obviously, the big advantage though is that I can now integrate my heating into my overall home automation.

smcallis77 commented 1 year ago

As expected the initial state shows I have 3 zones and the common zone is indeed zone_index 2. Here is my json dump. { "AOCFixed": { "AOCUserTimeSet": 1, "AOCUserTimeVal": 0, "CompressorOffTemp": 10, "CompressorOnDelay": 3, "CompressorOnTemp": 8, "MaximumTemperature": 28, "MinimumTemperature": 18 }, "AOCFixedInSystem": 0, "AOCInverter": { "MaximumTemperature": 28, "MinimumTemperature": 18, "ModbusAddress": 244 }, "AOCInverterInSystem": 0, "EVAPCooler": { "Brands": 0, "HumidityControl": 0, "MaximumTemperature": 28, "MinimumTemperature": 18, "PrewetSelector": 1, "RampRate": 0, "SalinityDrainTriggerLevel": 0, "SpeedTablePointer": 0, "TankDrainDelay": 3, "TemperatureUnits": 0, "WaterManager": 0, "WeatherSealOpeningSpeed": 4 }, "Heater": { "AOCInstalled": 0, "Brands": 0, "CommissioningDuctPressures": " ", "DataTableVersion": "D0.0", "DownDischargeHeater": 0, "ICSSoftwareRev": "D0.0", "MaximumTemperature": 25, "MaxSetFanSpeed": 10, "MinimumTemperature": 0, "ModbusAddress": 141, "ModelNo": "TQM520N", "NewZealandHeater": 0, "SerialNo": 1074005, "SerialNoPrefix": " " }, "HeaterInSystem": 1, "NoOfEVAPInSystem": 0, "NoOfZones": 3, "NoOfZonesControl": 1, "ZoneName1": "BEDROOM ZONE", "ZoneName10": "ZONE 10", "ZoneName2": "LIVING ROOM ZONE", "ZoneName3": "COMMON ZONE", "ZoneName4": "ZONE 4", "ZoneName5": "ZONE 5", "ZoneName6": "ZONE 6", "ZoneName7": "ZONE 7", "ZoneName8": "ZONE 8", "ZoneName9": "ZONE 9" }

and here is a current state dump

{ "ActualTempZone1": 23, "ActualTempZone10": 0, "ActualTempZone2": 23, "ActualTempZone3": 23, "ActualTempZone4": 0, "ActualTempZone5": 0, "ActualTempZone6": 0, "ActualTempZone7": 0, "ActualTempZone8": 0, "ActualTempZone9": 0, "AutoClean": 0, "BasicFault": 0, "CFanOnlyOrCool": 0, "CFanSpeed": 0, "ClearSoftwareUpdate": 0, "CoolerType": 0, "CTemp": 23, "DamperOnOffZone1": 0, "DamperOnOffZone10": 0, "DamperOnOffZone2": 0, "DamperOnOffZone3": 1, "DamperOnOffZone4": 0, "DamperOnOffZone5": 0, "DamperOnOffZone6": 0, "DamperOnOffZone7": 0, "DamperOnOffZone8": 0, "DamperOnOffZone9": 0, "DateKey": 20230427, "DrainDry": 0, "DrainExternalSensor": 0, "EnableLiveStreaming": 0, "EvapCRunning": 0, "ExternalTemp": 0, "FanOrTempControl": 0, "FAOCActualCompressorON": 0, "FAOCRunning": 0, "FAOCTemp": 23, "Fault": 0, "FaultCodePresent": 0, "FlameSenseVoltage": 0, "HActualFanSpeed": 0, "HActualGasRate": 0, "HActualGasRateVariable": 0, "HFanOnly": 0, "HFanSpeed": 0, "HNewFault": 0, "HRunning": 1, "HSetGasRate": 3, "HTemp": 23, "HumidityActualValue": 0, "IAOCActualTemp": 0, "IAOCCompressorON": 0, "IAOCRunning": 0, "IAOCSetTemp": 23, "InternalTemp": 22, "LoggingFrequency": 0, "MacAddressId": "XXXXXXXXXXXX", "ManualDrain": 0, "NightQuietMode": 0, "OnOffZone1": 0, "OnOffZone10": 0, "OnOffZone2": 0, "OnOffZone3": 1, "OnOffZone4": 0, "OnOffZone5": 0, "OnOffZone6": 0, "OnOffZone7": 0, "OnOffZone8": 0, "OnOffZone9": 0, "PadFlush": 0, "ProgramMode": 0, "ProgramModeOverridden": 0, "ProgramModeOverriddenZone1": 0, "ProgramModeOverriddenZone10": 0, "ProgramModeOverriddenZone2": 0, "ProgramModeOverriddenZone3": 0, "ProgramModeOverriddenZone4": 0, "ProgramModeOverriddenZone5": 0, "ProgramModeOverriddenZone6": 0, "ProgramModeOverriddenZone7": 0, "ProgramModeOverriddenZone8": 0, "ProgramModeOverriddenZone9": 0, "ProgramModeZone1": 0, "ProgramModeZone10": 0, "ProgramModeZone2": 0, "ProgramModeZone3": 0, "ProgramModeZone4": 0, "ProgramModeZone5": 0, "ProgramModeZone6": 0, "ProgramModeZone7": 0, "ProgramModeZone8": 0, "ProgramModeZone9": 0, "PumpOffExternalAirSensor": 1, "PumpStatus": 0, "SetTempZone1": 23, "SetTempZone10": 0, "SetTempZone2": 23, "SetTempZone3": 23, "SetTempZone4": 0, "SetTempZone5": 0, "SetTempZone6": 0, "SetTempZone7": 0, "SetTempZone8": 0, "SetTempZone9": 0, "SignalStrength": 53, "Spanner": 0, "SystemOn": 0, "ThermistorTemperature": 19, "TimeKey": 1309, "TimeRunning": "2023-04-27 21:49:37.000", "TouchCount": 0, "UpdateCompleted": 1, "UpdateFailed": 0, "UpdateInPogress": 0, "UpdateMicroProcessor": 0, "UpdateWiFiModule": 0 }

There may be a more elegant solution but if the system control zone is always the last zone then the suggested change to climate.py - line 187 works ok.

epetousis commented 1 year ago

Excuse my rather late reply to this @wrodie,

Your code's assumption is that zone 1 is the common zone, but in my situation that is zone5 (zone_index = 4)

I think I made an error in the code and used NoOfZonesControl instead of NoOfZones, because I’m fairly sure my unit is also the exact same in terms of the Common Zone being the last zone.

Rumbaar commented 1 year ago

How do I get a log to see if this is the case in my setup? Has this been pushed out? As currently the 4 zones I have, appear to have an issue with global updates and non zone correctly updating.

Rumbaar commented 1 year ago

FYI in my setup, I have

"ZoneName1": "FAMILY/DINING", "ZoneName2": "LIVING/STUDY", "ZoneName3": "LEISURE/BED 1", "ZoneName4": "BED 2,3 & 4"

and

"NoOfZones": 4, "NoOfZonesControl": 1

Of which ZONE 1 is my control/master controller. But the operation of the zones isn't correct with all being the same values across the 'child' zone/controllers.