andrewleech / ha_magiqtouch

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

Control functions have stopped responding to input #19

Open Dazzzwaa opened 9 months ago

Dazzzwaa commented 9 months ago

Hi, last week i have noticed the integration has stopped responding to input the magiqtouch display wont update to the value i set in Home assistant, however if i set it on magiqtouch controll it will update on Home assistant image image

see below information from the log This error originated from a custom integration.

Logger: magiqtouch Source: custom_components/magiqtouch/magiqtouch.py:274 Integration: Seeley MagIQtouch (documentation, issues) First occurred: 8:40:15 PM (3 occurrences) Last logged: 8:51:34 PM

Failed to set value properly:

AschwinGehlen commented 8 months ago

OK, this might help. Just noticed that there are 4 errors that come up one after the other whenever I try to login.

@AschwinGehlen Only error messages from magiqtouch are relevant. Have you upgraded to the latest beta version that Andrew posted 2 hours ago?

@cat2devnull Only version options I have is V4, V3 and HACS. No beta option available. Currently have V4 installed.

andrewleech commented 8 months ago

Ah @AschwinGehlen I missed the point about you having zones, yes support is currently completely broken for zones until I get more data on what they look like. Your latest error messages do have a couple of helpful clues!

andrewleech commented 8 months ago

@cat2devnull yours will now be running without zone support, I need a status update json to make some progress there. If you turn the verbose setting off then on again you should get a clean log entry of both system details and current status that you can share.

The timeout errors in your last log are interesting, but probably shouldn't matter. I'll put them aside to look at closer though.

andrewleech commented 8 months ago

@AschwinGehlen if you could update to the pre-release hacs branch, then enable verbose setting on the integration (screenshots of this setting are in a comment a little above) then restart ha it would now give some more detailed logs just at startup.

AschwinGehlen commented 8 months ago

@andrewleech, I installed the hacs version. First attempt I got an unknown error message after entering the user name and password , second attempt I got the same message as before ‘failed to connect’

image

Because I can’t login I can’t get to the point to enable verbose logging.

Here are the current logs in time order.

This error originated from a custom integration.

Logger: magiqtouch Source: custom_components/magiqtouch/magiqtouch.py:160 integration: Seeley MagIQtouch (documentation, issues) First occurred: 10:32:56 PM (2 occurrences) Last logged: 10:37:11 PM

failed to query devices/system Traceback (most recent call last): File "/config/custom_components/magiqtouch/magiqtouch.py", line 160, in login self.current_system_state = SystemDetails.from_dict(system_data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/magiqtouch/structures.py", line 350, in from_dict dc.ACZones.Zones = [Zone(**d) for d in dc.ACZones.Zones] ^^^^^^^^^ TypeError: Zone.init() got an unexpected keyword argument 'Name'

This error originated from a custom integration.

Logger: magiqtouch Source: custom_components/magiqtouch/magiqtouch.py:166 integration: Seeley MagIQtouch (documentation, issues) First occurred: 10:32:56 PM (2 occurrences) Last logged: 10:37:11 PM

Current System State: {"ACZones": {"Manual": false, "SlaveWallControls": true, "Zones": [{"Name": "LOUNGE HEATER", "Type": "MASTER", "CoolerCompatible": false, "HeaterCompatible": true}]}, "AOCFixed": {"InSystem": false, "MaximumTemperature": 28, "MinimumTemperature": 18}, "AOCInverter": {"MaximumTemperature": 28, "MinimumTemperature": 18, "InSystem": false}, "Cabinets": [], "EVAPCooler": {"Brands": 0, "HumidityControl": false, "MaximumTemperature": 28, "MinimumTemperature": 18, "TemperatureUnits": 0}, "WallController": {"Firmware": "44R0619", "Type": 0}, "Heater": {"InSystem": true, "FixedFan": false, "Brands": 0, "DataTableVersion": "D0.0", "ICSSoftwareRev": "V1.9", "MaxSetFanSpeed": 10, "MaximumTemperature": 26, "MinimumTemperature": 16, "ModelNo": "TQM618N", "SerialNo": 639034}, "MasterAirSensorPresent": false, "SlaveWallControls": 1, "NoOfZoneControls": 1, "System": {"configuration": 4, "cooler": {"available": false, "fanFixed": false}, "heater": {"available": true, "fanFixed": false}, "fan": {"available": true, "fanFixed": false}, "Address": "", "Name": "My Home"}, "Wifi_Module": {"MacAddressId": "", "version": "1.7", "type": "WI-FI IoT Device"}, "ExternalAirSensorPresent": false, "DamperDelayModulePresent": false, "BMSS1": false, "BMSMS1": false, "ZoneAirSensors": 0}

This error originated from a custom integration.

Logger: magiqtouch Source: custom_components/magiqtouch/magiqtouch.py:135 integration: Seeley MagIQtouch (documentation, issues) First occurred: 10:37:28 PM (1 occurrences) Last logged: 10:37:28 PM

Bad logger message: Error with login email/password ((UserNotFoundException('An error occurred (UserNotFoundException) when calling the InitiateAuth operation: User does not exist.'),)) Traceback (most recent call last): File "/config/custom_components/magiqtouch/magiqtouch.py", line 135, in login await self._cognito.authenticate(self._password) File "/config/custom_components/magiqtouch/vendor/mandate/client.py", line 277, in authenticate tokens = await aws.authenticate_user() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/magiqtouch/vendor/mandate/aws_srp.py", line 233, in authenticate_user response = await client.initiate_auth( ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiobotocore/client.py", line 408, in _make_api_call raise error_class(parsed_response, operation_name) botocore.errorfactory.UserNotFoundException: An error occurred (UserNotFoundException) when calling the InitiateAuth operation: User does not exist.

This error originated from a custom integration.

Logger: custom_components.magiqtouch.config_flow Source: custom_components/magiqtouch/config_flow.py:45 integration: Seeley MagIQtouch (documentation, issues) First occurred: 10:32:57 PM (3 occurrences) Last logged: 10:37:28 PM

Could not connect: Zone.init() got an unexpected keyword argument 'Name' Traceback (most recent call last): File "/config/custom_components/magiqtouch/config_flow.py", line 39, in validate_input if not await hub.login(): ^^^^^^^^^^^^^^^^^ File "/config/custom_components/magiqtouch/magiqtouch.py", line 160, in login self.current_system_state = SystemDetails.from_dict(system_data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/magiqtouch/structures.py", line 350, in from_dict dc.ACZones.Zones = [Zone(**d) for d in dc.ACZones.Zones] ^^^^^^^^^ TypeError: Zone.init() got an unexpected keyword argument 'Name' Could not connect: Traceback (most recent call last): File "/config/custom_components/magiqtouch/config_flow.py", line 40, in validate_input raise InvalidAuth custom_components.magiqtouch.config_flow.InvalidAuth

andrewleech commented 8 months ago

@AschwinGehlen Ah I hadn't realised at the point of failure it would be blocking login, though that makes sense to me now. That new log you've posted however is perfect though, I think that'll get me past the login stage at least!

cat2devnull commented 8 months ago

@cat2devnull yours will now be running without zone support, I need a status update json to make some progress there.

I believe (from memory as I am not infront of the controller) the zones are called "Common Zone" and "Zone 1". Zone 1 is only for the gas heater, the Evap Cooler only has the single common zone.

This logging looks promising. log3.txt

andrewleech commented 8 months ago

@cat2devnull that is what I was looking for thanks! It's a bit strange though, the second entry in heater for zone 1 has a current (room) temperature of 157 That wouldn't make much sense to show on a second climate entity for that zone, though I'm not sure what to show instead and how to reliably detect when it's a dud value etc.

cat2devnull commented 8 months ago

It's a bit strange though, the second entry in heater for zone 1 has a current (room) temperature of 157. That wouldn't make much sense to show on a second climate entity for that zone, though I'm not sure what to show instead and how to reliably detect when it's a dud value etc.

So we had the option of installing a second MagiQtouch panel into Zone 1 but decided it wasn't worth the expense. Hence 157 might be the default reading when there is no input (open circuit across the thermistor pins?). I checked again this morning and it still reads 157 so it doesn't appear to change over time. I would think that if temp > 70 then consider it to be invalid.

andrewleech commented 8 months ago

we had the option of installing a second MagiQtouch panel into Zone 1

Can you give more details about how you do control zone 1? From the main panel obviously, but do you just manually turn it on / off and it'll just run the heater at the set fan speed or control to the same main panel ambient temperature as the common zone?

Is it really just on/off for the duct in the zone, with all control just from the common one?

I'm just trying to figure out how this would be exposed in two separate climate entities... Or if it would be better as just a switch entity to enable/disable the zone?

cat2devnull commented 8 months ago

how you do control zone 1? From the main panel obviously, but do you just manually turn it on / off and it'll just run the heater at the set fan speed or control to the same main panel ambient temperature as the common zone? Is it really just on/off for the duct in the zone, with all control just from the common one?

Yes, it is turned on/off from the main panel which just opens/closes a baffle in the duct that feeds the far end of the house. No second temp sensor. No change to the fan speed or temp set point. As for the display on the controller, when you switch to Zone 1 is still shows the common zone temp and greys out the rest of the controls.

I'm just trying to figure out how this would be exposed in two separate climate entities... Or if it would be better as just a switch entity to enable/disable the zone?

Probably just a switch as it doesn't do anything else.

AschwinGehlen commented 8 months ago

@andrewleech @cat2devnull, my system has 2 zones with 2 controllers if that helps.

Still can’t login to get the logs so that doesn’t help you guys. 🤣😂

DuL90 commented 8 months ago

@andrewleech here are some addional logs from my system which may help. Our heater has a common zone along with 4 additional zones. The heater zone names have been changed from the default and you'll see those names in the logs. We also have a new evaporative unit that was installed a few weeks back which also works with Magiqtouch. The evap is just a single zone. Let me know if you need anything else. Log_1.log

andrewleech commented 8 months ago

@AschwinGehlen could you check if hacs can see an update for the integration, if you can update (on hacs branch) to f962c0c I think it should let you login and get the next status output

@DuL90 thanks I'll take a look at that, might hopefully have everything needed!

AschwinGehlen commented 8 months ago

@andrewleech, I just got home and tested the login.

I can now login and can see two entities so it looks like it has only picked up one zone. But at least I can now login. Baby steps. :-)

Here is a short run where I captured the logs. This is only turning the Fan Only mode on and adjusting the fan speed.

If it makes it easier for you I could give you access to my setup.

home-assistant_magiqtouch_2024-03-14T05-10-29.954Z.log

andrewleech commented 8 months ago

Ok everyone, I've tried adding some initial zone support based on the logs so far, if you want to update to the latest hacs branch commit and give it a try!

AschwinGehlen commented 8 months ago

@andrewleech, loaded the latest hacs version and the current loaded entities stopped working. Went to re-add the integration and now I’m back to not being able to log in. Getting that same message ‘failed to connect’.

andrewleech commented 8 months ago

@AschwinGehlen there must be a new crash, can you see anything in the system log?

AschwinGehlen commented 8 months ago

@andrewleech, I’m wondering if it is actually OPNsence causing a the issue.

The first error I seem to see every time it fails is this one.

This error originated from a custom integration.

Logger: py.warnings Source: custom_components/opnsense/pyopnsense/init.py:167 integration: OPNsense (documentation, issues) First occurred: 9:57:14 AM (58 occurrences) Last logged: 10:27:42 AM

/usr/local/lib/python3.12/site-packages/urllib3/connectionpool.py:1061: InsecureRequestWarning: Unverified HTTPS request is being made to host '192.168.x.x'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings warnings.warn(

andrewleech commented 8 months ago

No that won't likely have anything to do with the issue, the problem is this code is all brand new and I can't test any of the new zone stuff myself. As such it's all trial and error, I write changes and someone with zones tests it. When it fails, it'll often show up as a login failure or missing entity, along with hopefully a log message from magiqtouch saying where it crashed.

That opnsense message suggests there's something wrong with that integration though, but it's unlikely to affect this one

AschwinGehlen commented 8 months ago

@andrewleech Well that makes my life easier because I don’t need to find an issue with OPNsence. 🤣😜

Here are the latest logs:

This error originated from a custom integration.

Logger: magiqtouch Source: custom_components/magiqtouch/magiqtouch.py:135 integration: Seeley MagIQtouch (documentation, issues) First occurred: 10:01:58 AM (3 occurrences) Last logged: 11:05:08 AM

Bad logger message: Error with login email/password ((UserNotFoundException('An error occurred (UserNotFoundException) when calling the InitiateAuth operation: User does not exist.'),)) Traceback (most recent call last): File "/config/custom_components/magiqtouch/magiqtouch.py", line 135, in login await self._cognito.authenticate(self._password) File "/config/custom_components/magiqtouch/vendor/mandate/client.py", line 277, in authenticate tokens = await aws.authenticate_user() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/magiqtouch/vendor/mandate/aws_srp.py", line 233, in authenticate_user response = await client.initiate_auth( ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiobotocore/client.py", line 408, in _make_api_call raise error_class(parsed_response, operation_name) botocore.errorfactory.UserNotFoundException: An error occurred (UserNotFoundException) when calling the InitiateAuth operation: User does not exist.

This error originated from a custom integration.

Logger: custom_components.magiqtouch.config_flow Source: custom_components/magiqtouch/config_flow.py:45 integration: Seeley MagIQtouch (documentation, issues) First occurred: 9:59:20 AM (9 occurrences) Last logged: 11:05:08 AM

Could not connect: Zone.init() got an unexpected keyword argument 'Name' Traceback (most recent call last): File "/config/custom_components/magiqtouch/config_flow.py", line 39, in validate_input if not await hub.login(): ^^^^^^^^^^^^^^^^^ File "/config/custom_components/magiqtouch/magiqtouch.py", line 159, in login self.current_system_state = SystemDetails.from_dict(system_data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/magiqtouch/structures.py", line 350, in from_dict dc.ACZones.Zones = [Zone(**d) for d in dc.ACZones.Zones] ^^^^^^^^^ TypeError: Zone.init() got an unexpected keyword argument 'Name' Could not connect: Traceback (most recent call last): File "/config/custom_components/magiqtouch/config_flow.py", line 40, in validate_input raise InvalidAuth custom_components.magiqtouch.config_flow.InvalidAuth

DuL90 commented 8 months ago

@andrewleech I've just downloaded and installed the updated integration. I now have entities for my 4 zones but the "Common Zone" entity has gone missing. If I turn on a heater zone then they all come on but I can't turn off any individual zone. If I adjust the "mode" for a zone it appears to work as expected, ie will change modes like heat>cool>fan. What doesn't work for a zone is if I turn the mode to off. The 4 zones appear like duplicates of the common zone but without off functionality.

cat2devnull commented 8 months ago

I'm now on version 1ded919. I've still got 3 entities but now it's Zone 1 + the two temps (I've lost the common zone). Since Zone 1 doesn't have any controls I cannot turn the aircon on/off anymore. log4.txt

andrewleech commented 8 months ago

Thanks @cat2devnull that log had the crash that caused the loss of common zone, I've just pushed what's hopefully a fix for that.

@AschwinGehlen could you check your hacs upgrade of the package, those latest loss look like it's jumped back to v4 instead of the hacs branch.

andrewleech commented 8 months ago

@DuL90 that report is interesting... I'm having to guess a bit so far on how to turn zones on and off properly, clearly it's not right yet. I'll take another look at my logic and see if what you report makes sense against the code.

AschwinGehlen commented 8 months ago

@andrewleech, it seems to like to download v4 automatically. 🤣

Just downloading the hacs version again and then I’ll test it. I’ll let you know how I get on.

DuL90 commented 8 months ago

@andrewleech Common Zone is now there! I repeated the testing I did earlier to find the behaviour the same as before but this time using the Common Zone.

AschwinGehlen commented 8 months ago

@andrewleech, ok, I have done some testing on version 993acca.

Attached are 2 log files and the sequence I did the testing with the results of each step. In short, the only reliable test was using the Fan Mode.

File ending with 'From Controller' is where I used the controller to change settings on the heater. File ending with 'From HA' is where I used HA to make changes to the heater settings.

Hope this makes sense.

HA Testing Sequence.txt home-assistant_magiqtouch_2024-03-15T07-16-53.260Z-From_Controller.log home-assistant_magiqtouch_2024-03-15T06-57-01.691Z-From_HA.log

cat2devnull commented 8 months ago

Likewise I have both zones now. I've noticed that I'm getting issues where I make a change and the aircon updates then after 30sec or so, it reverts back to the old setting. Also I can make a change and it doesn't update at all. I'm seeing timeout/ack errors in the logs. I'll attach them when I am back in front of my machine.

AschwinGehlen commented 8 months ago

@cat2devnull, the funniest one was where I couldn't turn of the heater. HA would keep turning it back on. Took a long time for it to finally turn off.

andrewleech commented 8 months ago

Thanks for the feedback! @AschwinGehlen I looked at your test sequence doc quickly and I think it'll be quite helpful thanks. I'll look at it and the logs in detail a bit later!

AschwinGehlen commented 8 months ago

@andrewleech, no rush. You are doing an amazing job on this. You are defiantly smarter than I am. :-)

andrewleech commented 8 months ago

@AschwinGehlen could you check if the verbose logging setting for the integration is still turned on? The logs aren't entirely clear on what status update messages are reported.

Regardless of that your logs show that my mechanism for waiting for settings to go through properly before showing on the GUI is not working very well, particularly when multiple things are set shortly after one another... Or multiple zone settings being changed.

You know how in the official phone app, when you change a setting it usually reverts on screen a second later, before eventually updating again to the changed setting? And if you try to change anything else before it fully updates it gets confused and loses one or more of the changes?

That's the problem I've worked on solving in this integration... but my current method isn't quite right and will need some rework ... that'll be why some of you are seeing things revert or change later unexpectedly.

cat2devnull commented 8 months ago

Here are the latest logs as promised. log5.txt

AschwinGehlen commented 8 months ago

@andrewleech, yeah the phone app does tend to get confusing if you select more than one thing. The only way to get the phone app to work properly is to select your setting, wait for it to update then select your next setting.

I have just turned on the ‘log send and received json data when anything changes’. I keep forgetting this is turned off every time I reinstall the integration.

I’ll rerun the same test order this morning and post the results.

AschwinGehlen commented 8 months ago

@andrewleech Here is some more testing. Hopefully these logs have some more information. This time it looks like the entities stopped responding and I had to do a restart of HA.

Let me know if you want me to run the test again after a restart.

HA Testing Sequence.txt home-assistant_magiqtouch_2024-03-15T20-38-50.636Z-Test_from_Controller.log home-assistant_magiqtouch_2024-03-15T20-20-13.991Z-Test_from_HA.log

andrewleech commented 8 months ago

I've just pushed a significant change to how zones and setting changes are handled, hopefully it'll behave a bit better now. Probably not all working yet but should be closer

AschwinGehlen commented 8 months ago

@andrewleech downloading it now and I’ll test it this afternoon with the same test sequence.

AschwinGehlen commented 8 months ago

@andrewleech sorry, I ran out of time to do proper testing and get the log files. I’m away on business until Thursday so I won’t be able to do testing until I’m back.

I did however have a quick play. Found that heating mode mostly works with turning off and on plus independent zone temperature control (that is a MASIVE win!)

One thing I did notice is that it doesn’t like fan mode. I can turn it on to fan mode but that is all it will do, it won’t let me turn it off or adjust the fan speed. One thing to note on the way fan mode works is that you can only control fan mode from the main controller(in my case the lounge controller). The system is designed like that and it will not let you use fan mode and individual zones at the same time.

andrewleech commented 8 months ago

Just reaching out @epetousis, no pressure but if you've got any time and interest I'd love a bit of your help finishing / cleaning up the new zone support API :-)

I'm still not sure how it's supposed to work, though it's getting close anyway.

epetousis commented 8 months ago

Quite busy at the moment with final year uni work, but I'd be happy to look if some free time comes up.

DuL90 commented 8 months ago

@andrewleech So I don't seem to be having so much luck unfortuantely, I can see some improvements but in most cases the zones are not behaving as you would expect. I was hoping to test more thoroughly and to document this a little better but I ran out of time today.

In my brief testing I did find you can turn on the Evap but you cannot turn it off from any zone, including the common zone. I think the rest of the Evap controls were good, just the off is not working. The heater will turn on from the common zone but generally you cannot turn on or off a particular zone once the heater is running. You cannot turn the heater off from the common zone either. The rest of the testing was quite inconsistant! Sometimes you could get the system to turn off but only from the Bedroom zone. If you started the system from a zone entity then that zone would come on and other zones would be on or off as they were last set (as expected). I couldn't get any zones to turn off except occassionally the whole system would turn off from the Bedroom zone. I also noticed my logs are filling up (linked below). If you want me to do more testing and document this a bit better let me know. Log_2.log

cat2devnull commented 8 months ago

@andrewleech I've tested again on 2fea260. I can reliably turn the unit on and change modes but I cannot turn it off or adjust fan-speed or temps. 2 steps forward, one step back. Thanks for your hard work. :)

andrewleech commented 8 months ago

@DuL90 that is some extreme log spam, I'll need to figure out what's wrong with that function. It's supposed to be filtering all cooler and heater devices to just return the ones for the requested zone.

The turn off issue everyone has, well I do have some logic for when/how the "system off" flag is set that must be wrong with how zones actually work. Either that or the bug that's spamming the logs is also breaking the off function.

andrewleech commented 8 months ago

@DuL90 I've just pushed a change that might be worse, just to capture more detail on that log spam so I can see what's actually triggering it

DuL90 commented 8 months ago

@andrewleech New logs attached! Log_3.log

Thanks also for all the work you're putting into this!

andrewleech commented 8 months ago

Thanks @DuL90 turns out it didn't tell me what I was expecting, but instead did point me must of the way to the problem.

Those heater only zones entities are looking for an active device in their zone, but system is in cooling mode.

I've just pushed another change to hopefully capture just what exactly is trying to query the active device.

DuL90 commented 8 months ago

@andrewleech Sorry for the delay, more logs.... Log_4.log

andrewleech commented 8 months ago

@andrewleech Sorry for the delay, more logs.... Log_4.log

No apologies necessary, no one is on a deadline here 😜

That log was perfect, makes complete sense now. I need to adjust how zone entries check things like current temperature when the system is on but in a mode that isn't supported by the zone.

TheOriginalMrWolf commented 8 months ago

Hi @andrewleech,

Thanks for all your efforts on this integration.

I'm located in Sydney with a system config as follows:

Configuration is 5 zones (Wall controller is the temp sensor for one zone + 4 additional temp sensors) + a common zone.

HAss is running in a Docker container on an Odroid N2 (similar to Pi).

Integration (d1e6870) is now successfully connecting and is able to retrieve state, but is struggling with the following:

Happy to supply logs, do tests etc - just lemme know what you need.