andrewleech / ha_magiqtouch

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

Installation #1

Open dphroon opened 2 years ago

dphroon commented 2 years ago

Hi, This looks fantastic and very promising.... have you been running this on your own system? I'd love to try it out too

Willing to help if you need anything, testing etc

andrewleech commented 2 years ago

It's not really ready yet unfortunately, I haven't had time to finish it off yet. It connects, reads currently settings, but changing settings doesn't really work. It also seems to lose the connection after a while.

palitu commented 2 years ago

@andrewleech - super keen for this! have you seen this project? https://github.com/mrhteriyaki/airconcontrol

It is a win forms replacement for the magiqtouch app. Potentially you could get some hints as to what is happening from that one.

Would be happy for just reading the settings/state in HA if you are happy to make it available in HACs?

cheers.

andrewleech commented 2 years ago

It is already available in HACS in general, but it sounds like there are still module dependency issues breaking install for some people.

As far as the rest of the mqtt communication to get/set the state I did previously have the format of that worked out and working (though suspect I might have lost a bit when my server died last year).

When I had it mostly working last time though there were some issues in the conversion of mqtt state to HA controls, and stability issues (it died after a few hours, probably a mqtt login/refresh issue).

The problem for me is far too many active projects, very little spare time, so yeah not a lot of progress.

palitu commented 2 years ago

haha, yeah... always lots going on!

I will be getting my A/C installed next friday, so i will be giving it a go! If i can figure any of the issue out, i will let you know / PR.

BTW, are you using gitlab or github?

dphroon commented 2 years ago

Yes, I haven't been able to install the integration - keeps stopping with a config flow error.

dpdump commented 2 years ago

Yes, I haven't been able to install the integration - keeps stopping with a config flow error.

I’m getting the same error.

dphroon commented 2 years ago

something to do with the mandate.git package in the requirements section in manifest.json. Replacing it with the published mandate package allows it to progress past the config flow error, but it still doesn't allow login

raym777 commented 2 years ago

Just wondering if there's been any progress on this? I'm also unable to get beyond the config flow error. Any update appreciated.

andrewleech commented 2 years ago

Sorry no I've got far too many projects on the go, this one hasn't made it back to the top of the list yet!

Prosatanos commented 2 years ago

Hey Also getting the config flow error. We really appreciate that you have gotten it this far.

Thanks!

Prosatanos commented 2 years ago

something to do with the mandate.git package in the requirements section in manifest.json. Replacing it with the published mandate package allows it to progress past the config flow error, but it still doesn't allow login

How did you manage to do this? Any tips?

DeltaTangoLima commented 2 years ago

How did you manage to do this? Any tips?

I did it by exec'ing an interactive bash shell in my Home Assistant docker container and using pip to install the mandate module manually. Still can't login to the Seeley service though.

epetousis commented 2 years ago

If anyone's looking for a "just works" solution, I've hacked in the newer web based API using research from mrhteriyaki. Still experimental and doesn't support anything more than simple on/off and temperature control, but at least you can sign in now.

dphroon commented 2 years ago

If anyone's looking for a "just works" solution, I've hacked in the newer web based API using research from mrhteriyaki. Still experimental and doesn't support anything more than simple on/off and temperature control, but at least you can sign in now.

@epetousis Looks good - it fails at login for me though; 2022-08-19 22:29:02.498 ERROR (MainThread) [custom_components.MagiQtouch.config_flow] Could not connect: Connect timeout on endpoint URL: "http://169.254.169.254/latest/api/token" Traceback (most recent call last):

epetousis commented 2 years ago

@epetousis Looks good - it fails at login for me though; 2022-08-19 22:29:02.498 ERROR (MainThread) [custom_components.MagiQtouch.config_flow] Could not connect: Connect timeout on endpoint URL: "http://169.254.169.254/latest/api/token" Traceback (most recent call last):

Looks like the workaround I implemented in code didn't work, I'll look into a better fix later. In the meantime, try exporting AWS_EC2_METADATA_DISABLED=true as an environment variable in Home Assistant's shell environment. In my Docker configuration for Home Assistant, I've done it like so:

---
version: '2'
services:
  homeassistant:
    image: ghcr.io/home-assistant/home-assistant:stable
    restart: unless-stopped
    privileged: true
    environment:
      - AWS_EC2_METADATA_DISABLED=true
DeltaTangoLima commented 2 years ago

Looks like the workaround I implemented in code didn't work, I'll look into a better fix later. In the meantime, try exporting AWS_EC2_METADATA_DISABLED=true as an environment variable in Home Assistant's shell environment. In my Docker configuration for Home Assistant, I've done it like so:

This worked perfectly for me! Thank you. Now I can get rid of my unstable Home Assistant | node-red | Alexa automations!

dphroon commented 2 years ago

@epetousis Looks good - it fails at login for me though; 2022-08-19 22:29:02.498 ERROR (MainThread) [custom_components.MagiQtouch.config_flow] Could not connect: Connect timeout on endpoint URL: "http://169.254.169.254/latest/api/token" Traceback (most recent call last):

Looks like the workaround I implemented in code didn't work, I'll look into a better fix later. In the meantime, try exporting AWS_EC2_METADATA_DISABLED=true as an environment variable in Home Assistant's shell environment. In my Docker configuration for Home Assistant, I've done it like so:

---
version: '2'
services:
  homeassistant:
    image: ghcr.io/home-assistant/home-assistant:stable
    restart: unless-stopped
    privileged: true
    environment:
      - AWS_EC2_METADATA_DISABLED=true

I'm using Home Assistant OS - not sure I can easily export variables. Unless someone knows?

epetousis commented 2 years ago

I've fixed the other broken AWS Cognito connection in the login flow. You should be able to pull my latest changes and log in without any environment variables needed.

dphroon commented 2 years ago

I've fixed the other broken AWS Cognito connection in the login flow. You should be able to pull my latest changes and log in without any environment variables needed.

Nice! works perfectly now thanks!

raym777 commented 2 years ago

Really appreciate the effort in getting this working. Having some trouble though... I re-installed the integration via HACS and when I try to set in up in HA, I get the error: "This integration does not support configuration via the UI".

I gather I've done something wrong or need to set this up manually. Any help is appreciated...

KaiboshOz commented 2 years ago

"This integration does not support configuration via the UI".

I had the same thing happen. Complete removal of the integration and reboot of the host (not just the HA instance) followed by reinstalling fixed it for me..

DeltaTangoLima commented 2 years ago

I had the same thing happen. Complete removal of the integration and reboot of the host (not just the HA instance) followed by reinstalling fixed it for me..

Yeah - happened to me a couple of times. I find it also gets out of sync with the cloud service at times - doesn't track the on/off state, or temperature changes made at the panel (or with the app).

But, as an alpha release, I'm really, really happy with it. This is (will be) the final piece of my climate management puzzle.

raym777 commented 2 years ago

"This integration does not support configuration via the UI".

I had the same thing happen. Complete removal of the integration and reboot of the host (not just the HA instance) followed by reinstalling fixed it for me..

Thanks! That worked.

Yeah - happened to me a couple of times. I find it also gets out of sync with the cloud service at times - doesn't track the on/off state, or temperature changes made at the panel (or with the app).

But, as an alpha release, I'm really, really happy with it. This is (will be) the final piece of my climate management puzzle.

I'm also noticing this - doesn't sync with changes made at the wall panel but also isn't reflecting changes in current room temp for me either - or any setpoint changes. At least I can automate the on/off state of the device at least so for this, I'm very grateful. Thanks!

raym777 commented 2 years ago

To clarify my last comment regarding setpoint, my system is central heating only, no cooling. I presume setpoint changes should only apply to when the thermostat is in "override" mode - and not auto/program mode? I guess this might be why setpoint has no effect for me because I don't see any override/manual mode available to me. The only hvac attributes I have are: off, cool, fan_only and auto.

dphroon commented 2 years ago

It's a great leap forward! There's two things I think need work next

dphroon commented 2 years ago

It's a great leap forward! There's two things I think need work next

  • it stops syncing after a while (not sure after what time period). Reloading the integration reconnects it. Probably needs to log into the system again after a while.
  • Only has auto / cool / fan /off. Is auto = heat? or does it need a heat option as well. Or can it tell what systems are installed?

Actually - I think this integration is causing a more general failure in my Home Assistant setup. Most sensors are no longer available at the same time Magiqtouch stops communicating. Something is stuck in a loop somewhere? Disabling this integration tonight to see if it resolves, and then will investigate further.

epetousis commented 2 years ago

@dphroon I've noticed the updating issue as well - not 100% on what's causing it, but it's possible that I broke something by moving to that new API. I'll have to take a look when I get some free time next, I'll probably push it alongside/after the multi-zone support that I'm working on.

As for the auto/cool/fan/off thing, I believe auto corresponds to heat right now, but I'm also working on improving this so that the modes are correctly set based off of what's hooked up to the control panel.

raym777 commented 2 years ago

@dphroon I've noticed the updating issue as well - not 100% on what's causing it, but it's possible that I broke something by moving to that new API. I'll have to take a look when I get some free time next, I'll probably push it alongside/after the multi-zone support that I'm working on.

As for the auto/cool/fan/off thing, I believe auto corresponds to heat right now, but I'm also working on improving this so that the modes are correctly set based off of what's hooked up to the control panel.

Thanks for that. As others have mentioned also, I'm noticing that it frequently loses its connection and no longer controls anything. I need to reload the integration to restore functionality (and re-sync).

raym777 commented 2 years ago

Also, for me, with a heating system only, auto corresponds to "program" mode. For manual control, I use "override" on the wall panel or app but this is not yet available via the integration. So I think there should be separate heat and cool modes (allowing setpoint control via the integration - ie, override mode) AND auto for program mode where dialling in a setpoint manually probably doesn't make sense. Thanks again for getting it all working this far!

epetousis commented 2 years ago

I've fixed the failing state refresh, was a mistake on my part - the entity wasn't calling the async refresh method in the driver properly. It's pretty inefficient and each zone calls the refresh method, so multiple refreshes happen at once, I'll fix this soon. I've also added rudimentary support for multiple zones. Auto mode support has not been added yet - haven't yet looked into it.

DeltaTangoLima commented 2 years ago

I've fixed the failing state refresh, was a mistake on my part

@epetousis I've tried your updated commit, even removed and reinstalled completely, and am getting the below error in my Home Assistant logs. The integration logs in successfully, but creates no entities.

2022-08-24 18:33:06.972 WARNING (MainThread) [magiqtouch] The MagiQtouch API is reporting no zones. No devices will be available from the MagiQtouch integration.

I've checked my MagiQtouch app and profile settings, and can't see anything related to zones.

epetousis commented 2 years ago

@DeltaTangoLima whoops, I don't know why I assumed that zoneless systems weren't a thing. Pushed a hotfix, let me know if that works for you.

DeltaTangoLima commented 2 years ago

@epetousis Cheers! It's loading correctly now - now to see if it stays in sync. I'll let you know.

DeltaTangoLima commented 2 years ago

@epetousis Hmmmm - still appears to be losing sync. Showing as off, with 0°/0° for the setpoint/current temp.

epetousis commented 2 years ago

@DeltaTangoLima do you happen to see any logs from the integration?

DeltaTangoLima commented 2 years ago

@epetousis no, nothing since I restarted Home Assistant after your hotfix. The last log entries contain what look like a json payload of some sort, with the final one being about 5 or 6 minutes after the restart, then nothing.

The log entries all look pretty much identical (line breaks added - this is all a single line in the logfile):

WARNING (SyncWorker_6) [magiqtouch] Sent: {"SerialNo": "[REDACTED]",
"TimeRequest": "2022-08-24T18:59:43.178332+10:00","StandBy": 0,"EvapCRunning": 0,
"CTemp": 23,"CFanSpeed": 0,"CFanOnly": 0,"CThermosOrFan": 0,"HRunning": 1,"HTemp": 23,
"HFanSpeed": 10,"HFanOnly": 0,"FAOCRunning": 0,"FAOCTemp": 23,"IAOCRunning": 0,
"IAOCTemp": 23,"OnOffZone1": 1,"TempZone1": 23,"Override1": 1,"OnOffZone2": 0,
"TempZone2": 0,"Override2": 0,"OnOffZone3": 0,"TempZone3": 0,"Override3": 0,"OnOffZone4": 0,
"TempZone4": 0,"Override4": 0,"OnOffZone5": 0,"TempZone5": 0,"Override5": 0,"OnOffZone6": 0,
"TempZone6": 0,"Override6": 0,"OnOffZone7": 0,"TempZone7": 0,"Override7": 0,"OnOffZone8": 0,
"TempZone8": 0,"Override8": 0,"OnOffZone9": 0,"TempZone9": 0,"Override9": 0,"OnOffZone10": 0,
"TempZone10": 0,"Override10": 0,"CC3200FW_Major": 0,"CC3200FW_Minor": 0,"STM32FW_Major": 0,
"STM32FW_Minor": 0,"TouchCount": 0,"CCL": null,"STL": null}
epetousis commented 2 years ago

Interesting, I just got the same issue on my Home Assistant install. I'll enable debug logs and see if I can spot anything.

epetousis commented 2 years ago

Looks like the issue was the refresh method wasn't properly throwing an exception when the authentication token expired, so the Home Assistant state was being set to blank defaults, and a reauthentication request wasn't being triggered. I believe my latest fix should work, but I haven't tested long-term yet.

DeltaTangoLima commented 2 years ago

No worries - have loaded it up, but about to head away for a few days, so won't be able to check the long-term fix myself either. Will let you know when I get back.

KaiboshOz commented 2 years ago

@epetousis - Still looking good, maintaining sync after about 5 hours here..

epetousis commented 2 years ago

Yeah, looking good for me as well now.

KaiboshOz commented 2 years ago

Poop.. After restart following HA 2022.8.7 update:

Logger: homeassistant.setup
Source: setup.py:192
First occurred: 10:02:59 AM (1 occurrences)
Last logged: 10:02:59 AM

Setup failed for custom integration MagiQtouch: Unable to import component: cannot import name 'resolve_checksum_context' from 'botocore.client' (/usr/local/lib/python3.10/site-packages/botocore/client.py)

Working without error notification following another restart..

epetousis commented 2 years ago

Yeah, that botocore error's a weird error that I'm yet to figure out. It comes and goes for me as well, but as you observed generally a restart makes it go away.

raym777 commented 2 years ago

Updated to the latest build 2 days ago and sync looks really good now. HVAC modes look spot on now too!

Only "issue" I've encountered is that the setpoint seems to default to the max_temp whenever the system is shut off. The temp is programmed in my case to 22 degrees but always defaults to 27 when off. It doesn't automatically update when the system is back on either.

Other observations:

Adjusting the setpoint in HA appears to have no effect if the system is in a pre-programmed schedule. This probably makes sense. If the system is in "override" mode however, then the temp can be adjusted through this integration but as there's currently no distinction b/w these 2 modes of operation in HA, it may cause confusion for some.

If I encounter anything else over the next few days I'll post back here.

Really appreciate getting this so functional now!

epetousis commented 2 years ago

Only "issue" I've encountered is that the setpoint seems to default to the max_temp whenever the system is shut off. The temp is programmed in my case to 22 degrees but always defaults to 27 when off. It doesn't automatically update when the system is back on either.

Interesting one, do you find that when this happens, the temperature on the thermostat is also 27, or is it out of sync entirely?

Adjusting the setpoint in HA appears to have no effect if the system is in a pre-programmed schedule. This probably makes sense. If the system is in "override" mode however, then the temp can be adjusted through this integration but as there's currently no distinction b/w these 2 modes of operation in HA, it may cause confusion for some.

Yet to take a look into program mode - it looks like this should be possible to do from the integration based off of what the API is returning, but haven't written anything in particular to integrate with it.

raym777 commented 2 years ago

Yeah, it's entirely out of sync with the thermostat, which shows a setpoint of 22. But again, when in program mode, the setpoint changes in HA appear to have no effect - which I think is correct. Since I'm in this mode 99% of the time, might have something to do with that.

Perhaps if you do get a chance to take a look at this, I would suggest that any setpoint change whilst in a program mode should flick the system into the in-built override mode. Changes to setpoint appear to work OK when in override.

DeltaTangoLima commented 2 years ago

For what it's worth, my setpoint syncs perfectly across all three (touch panel, Seeley app, and HA), no matter where I adjust it.

Edit: sorry - scratch that. Just realised the talk about setpoint syncing was when it was operating in pre-programmed mode. I only use HA or touch panel to manage climate, so haven't come across this issue.

KaiboshOz commented 2 years ago

Ref to @epetousis fork

Another error immediately after upgrade similar to the one mentioned earlier in this thread (https://github.com/andrewleech/ha_magiqtouch/issues/1#issuecomment-1227875027) Admittedly I didn't bother to check the error message and am just assuming that the error was similar since the circumstances are identical - notification that it was with MagiQtouch integration and it hadn't loaded.. But as before, a reboot fixed things..

Not a big deal since it's pretty obvious right after an upgrade and easy to just reboot again.. Just posting here as an FYI since it's happened twice, both during HA core update (on HASSOS)..

dphroon commented 2 years ago

Ref to @epetousis fork

Another error immediately after upgrade similar to the one mentioned earlier in this thread (#1 (comment)) Admittedly I didn't bother to check the error message and am just assuming that the error was similar since the circumstances are identical - notification that it was with MagiQtouch integration and it hadn't loaded.. But as before, a reboot fixed things..

Not a big deal since it's pretty obvious right after an upgrade and easy to just reboot again.. Just posting here as an FYI since it's happened twice, both during HA core update (on HASSOS)..

Same here. Reboot fixed it.

Not sure if it's related or not though.

Google home app was reporting the device was offline just prior to doing the upgrade.

mrhteriyaki commented 2 years ago

I can recall having some info sync issues back when the mobile update earlier this year occured. I'm pretty sure it was the changes to AWS_CLIENT_ID and AWS_POOL_ID values that got it working for me. (see here) if you want to try the newer values.

The older app sent an mqtt request at startup to trigger some sort of status update from the unit. I found leaving the app open for long enough it would also show an out of sync temperature value from the wall panel.