samsinnamon / airtouch4pyapi

An api allowing control of AC state (temperature, on/off, mode) of an Airtouch 4 controller locally over TCP
MIT License
27 stars 14 forks source link

example #11

Closed herbi3 closed 1 year ago

herbi3 commented 2 years ago

this isn't an issue, I didn't know how else to get in contact.

Do you have an example script available? I really just want to get the temperature from each sensor per zone

Stephen2615 commented 2 years ago

I second that.

jcsteh commented 2 years ago
import airtouch4pyapi
airtouch = airtouch4pyapi.AirTouch("192.168.1.44") # Replace with your AirTouch IP address
await airtouch.UpdateInfo()
# Print the name and temperature of each group (AKA zone).
for group in airtouch.groups.values():
    print("{group.GroupNumber} {group.GroupName} {group.Temperature}").format(group=group))

The info for AC units is in airtouch.acs, while the info for groups (zones) is in airtouch.groups. You can reference these by number; e.g. airtouch.groups[0], airtouch.acs[0]. If you want to know what attributes there are, you can try this out in an interactive Python shell: python -m asyncio Once you've run UpdateInfo, you can do something like: dir(airtouch.acs[0]) to see what attributes an AC unit has.

Stephen2615 commented 1 year ago

@jcsteh,

Thanks for providing that information. It works like a charm. Sometimes the name doesn't appear but it is no big deal.

jcsteh commented 1 year ago

Yeah, this is definitely occasionally unreliable. I tried fixing some bugs I spotted in the Python package, but it still wasn't entirely reliable, so I think there are likely some bugs in the AirTouch firmware as well. My suggestion for now is to call UpdateInfo, and if the info you want isn't there, retry with a small delay.

Stephen2615 commented 1 year ago

Thanks for the work you did. It is good enough just for what I want.

Sent from Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 for Windows

From: James @.> Sent: Sunday, 25 September 2022 12:11 PM To: @.> Cc: @.>; @.> Subject: Re: [LonePurpleWolf/airtouch4pyapi] example (Issue #11)

Yeah, this is definitely occasionally unreliable. I tried fixing some bugs I spotted in the Python package, but it still wasn't entirely reliable, so I think there are likely some bugs in the AirTouch firmware as well. My suggestion for now is to call UpdateInfo, and if the info you want isn't there, retry with a small delay.

— Reply to this email directly, view it on GitHubhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FLonePurpleWolf%2Fairtouch4pyapi%2Fissues%2F11%23issuecomment-1257100914&data=05%7C01%7C%7C06a526d2ab2346b7777908da9e9b3e00%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637996686843033445%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=7rmxVgirWcPe22FSznKritb%2B1CCE7JCSJXbqBQ0W2x8%3D&reserved=0, or unsubscribehttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAKLZXCS25EUUKJNKFS5CPTLV76YEVANCNFSM53UAA5VA&data=05%7C01%7C%7C06a526d2ab2346b7777908da9e9b3e00%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637996686843033445%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=A4BNHeu4CP5tYGpcnvp1QlsQv%2Fr67MUKTwAm9THyYBQ%3D&reserved=0. You are receiving this because you commented.Message ID: @.***>

noobydp commented 1 year ago

My airtouch unit was regularly uncontactable both in the app and with this (and similar) integrations.

I figured out I needed to set the wifi channel and channel width to a fixed setting instead of Auto on my router. (I can't remember what channel width value worked)

After making them fixed values the airtouch has been solid and responsive 99% of the time.

cemilbrowne commented 1 year ago

Team, I've also added a demo.py in my latest push which might help get names etc.

samsinnamon commented 1 year ago

there is an example usage in 'Usage' and 'Notes' sections of the README. There is also @cemilbrowne's demo script as mentioned - if anyone wants to add to doco please feel free to PR, closing this one for now