Code Monkey home page Code Monkey logo

myair's Introduction

This project has been integrated into Home Assistant Core now, see https://www.home-assistant.io/integrations/advantage_air/

MyAir & e-zone Integration

A home assistant integration for Advantage Air "MyAir" and "e-zone" airconditioning control systems, which adds Climate, Motion, and Vent entities into Home Assistant

Config

Look for the "MyAir & e-zone" integration under Configuration / Integrations, then set the URL address of your Tablet.

Entities

Climate

A climate entity will be created per AC unit. Additional climate entities will be created per zone only if they are temperature controlled, as reported by the API.

Cover

A cover entity will be created for each zone that is not temperature controlled, allowing you to adjust the opening level from 0% to 100% in 5% increments.

Sensor

A sensor entity will be created for the Air Filter, showing if it needs to be replaced. Two sensor entity will be created for the 'time to on' and 'time to off' features. Use the myair.time_to service to change these. A sensor entity will be created for each zone that is temperature controlled to show how open the damper is. A sensor entity will be created for each zone that has a wireless temperature/motion sensors that reports its wireless RSSI.

Binary Sensor

A binary sensor entity will be created for each zone that has a motion sensor.

Services

A service named "myair.time_to" can be used to change the value of the sensor.xxx_time_to_on/off sensors.

myair's People

Contributors

bre77 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

myair's Issues

Feature request: Timer

Hi, hope you have been well.

I might have missed it but the current integration doesnt pull in the timer on the unit "countDownToOff" and "countDownToOn". Any chance of adding this?

As an aside- the freshairstatus (For the fresh air return) might also be auseful addition (I am planning to add this to my install next year) so more a forward looking item?

Thanks

unique_id is not truely unique

Currently unique_ids are created using the values from the aircons and zones elements in the JSON response. For most (all?) MyAir/e-zone installations that results in unique_ids like:

  • ac1
  • ac1-z01
  • ac1-z01-vent

However that doesn't meet the HA requirements for unique_ids. This is a problem for me in particular as I have two separate MyAir systems and two wall tablets, and when I attempt to add the second unit HA fails to add any new devices/entities as they would have duplicate IDs, e.g.:

2020-08-22 15:38:55 ERROR (MainThread) [homeassistant.components.sensor] Platform myair does not generate unique IDs. ID ac1-z01-vent already exists - ignoring sensor.guest_bed_vent

I think the best solution would be to incorporate the rid into every unique_id. The rid is already captured and stored in the device object. I don't have access to the MyAir API docs but I assume the rid is an ID unique across all MyAir systems.

I've hacked this into each unique_id method in my local installation and it seems to work, e.g. for class MyAirAC:

    def unique_id(self):
        return f"{self.coordinator.data['system'].get('rid','0')}-{self.acx}"

However I'm not certain a rid is guaranteed to exist for every MyAir/e-zone device or if there is something more appropriate.

The downside to changing this now is that once updated any existing installations will orphan all previous devices/entities and recreate them. Automations, etc, that reference the old would need fixing. I think this could avoided if the user first removes the integration, restarts, upgrades in HACS, restarts and adds the integration again. Although the unique_ids will change, the Entity IDs would be recreated as before. This would need testing to confirm.

P.S. - thanks Bre77 for the awesome work!

blacklisted

Not using your integration but got this in my logs:

Logger: custom_components.hacs
Source: custom_components/hacs/operational/factory.py:34 
Integration: HACS (documentation, issues) 
First occurred: 1.01.48 (1 occurrences) 
Last logged: 1.01.48

Bre77/myair - Repository is in the blacklist.

Motion sensors detected when not present

When adding the integration, it finds a motion sensor in each zone, yet I have none installed. Creates 4 binary_sensor entities as below:

binary_sensor.bedrooms_motion
binary_sensor.living_motion
binary_sensor.master_suite_motion
binary_sensor.theatre_motion

As you can see below, motionConfig is 0, which I would assume means motion sensor not present.

getSystemData below:

{"aircons":{"ac1":{"info":{"aaAutoFanModeEnabled":true,"activationCodeStatus":"noCode","airconErrorCode":"","cbFWRevMajor":6,"cbFWRevMinor":2,"cbType":0,"climateControlModeIsRunning":false,"constant1":4,"constant2":0,"constant3":0,"countDownToOff":0,"countDownToOn":0,"fan":"low","filterCleanStatus":0,"freshAirStatus":"none","mode":"vent","myAutoModeCurrentSetMode":"vent","myAutoModeIsRunning":false,"myZone":0,"name":"AC","noOfConstants":1,"noOfZones":4,"quietNightModeEnabled":false,"quietNightModeIsRunning":false,"rfSysID":2,"setTemp":24.0,"state":"off","uid":"001ec0d334c7","unitType":17},"zones":{"z01":{"error":0,"maxDamper":100,"measuredTemp":0.0,"minDamper":0,"motion":0,"motionConfig":0,"name":"MASTER SUITE","number":1,"rssi":0,"setTemp":24.0,"state":"open","value":55,"type":0,"tempSensorClash":false},"z02":{"error":0,"maxDamper":100,"measuredTemp":0.0,"minDamper":0,"motion":0,"motionConfig":0,"name":"BEDROOMS","number":2,"rssi":0,"setTemp":24.0,"state":"close","value":10,"type":0,"tempSensorClash":false},"z03":{"error":0,"maxDamper":100,"measuredTemp":0.0,"minDamper":0,"motion":0,"motionConfig":0,"name":"THEATRE","number":3,"rssi":0,"setTemp":24.0,"state":"close","value":10,"type":0,"tempSensorClash":false},"z04":{"error":0,"maxDamper":100,"measuredTemp":0.0,"minDamper":0,"motion":0,"motionConfig":0,"name":"LIVING","number":4,"rssi":0,"setTemp":24.0,"state":"open","value":10,"type":0,"tempSensorClash":false}}}},"myAddOns":{"hueBridges":{},"hueBridgesOrder":[]},"myLights":{"groups":{},"groupsOrder":[],"lights":{},"system":{"sunsetTime":"06:20 PM"}},"myMonitors":{"monitors":{},"monitorsOrder":[]},"myScenes":{"scenes":{"s0":{"aircons":{"ac1":{"info":{"fan":"low","freshAirStatus":"none","mode":"heat","myZone":0,"name":"AC","setTemp":22.0,"state":"off","uid":"001ec0d334c7"},"zones":{"z01":{"motionConfig":0,"number":1,"setTemp":24.0,"state":"open","value":15,"tempSensorClash":false},"z02":{"motionConfig":0,"number":2,"setTemp":24.0,"state":"close","value":20,"tempSensorClash":false},"z03":{"motionConfig":0,"number":3,"setTemp":24.0,"state":"close","value":20,"tempSensorClash":false},"z04":{"motionConfig":0,"number":4,"setTemp":24.0,"state":"open","value":65,"tempSensorClash":false}}}},"id":"s0","lights":{},"monitors":{},"name":"MyUndo","summary":"Days this scene will run:\nnone\n\nMyAir:\nAircon: off","things":{}}},"scenesOrder":[]},"mySensors":{"sensors":{},"sensorsOrder":[]},"myThings":{"groups":{},"groupsOrder":[],"system":{},"things":{}},"system":{"aaServiceRev":"14.116","allTspErrorCodes":{},"country":"Australia","dealerPhoneNumber":"1300850191","deviceIds":["2288rIn3K8XEocR0wMytrqwUiNR2","6B0fQ8w0CvaamsH3Od5x9jyxz963","uOOTS0n81iUluI6h7MsGd0wIYqQ2","5ZFTC2GmlrSyfJQgmwln49V7sKk1","GB5iVebh5Igk9UgUbX3rTo0vbkG3"],"deviceIdsV2":{"2288rIn3K8XEocR0wMytrqwUiNR2":"eZ-NgQI4U5w:APA91bGUsEfSu8kahICB7KQ35ITfFgBjper8mbvA6V85NpqZc3_fxDkYLoFJqYoEHlG5PAIoISAjoKGLd6ICWzEnZ3avMGGMidVtm_j-j8M2mvtYfxnbfccOfPlyL7IUlQUAs5GbPAza","5ZFTC2GmlrSyfJQgmwln49V7sKk1":"f8ka_ZFM0ag:APA91bFQAicGacLIcovF_730LzfI9MIeiwnhO7N0iGjgyFMR5-rYp2sS1pOtwt9jxOUnGhPYRxy8F0bfIpvmjyixdT6WOyOQx-zh-Q7JSl8-HKDrRJJb9xvL-j1khO_G4_9-jYnDMjmO","GB5iVebh5Igk9UgUbX3rTo0vbkG3":"et2_M2oCk2Q:APA91bFFTmlivD-_6DRllLm_uApQtMn8DMflVw_38U4XqXrIYkBTd4clo060wJ8eFECsrrrOJnHt7EbTBnI2MVthihN1X5w7luYeGqkix1nsvgUDFrJvhjiuUuTpZGyFQ-g6H8vThwGd","6B0fQ8w0CvaamsH3Od5x9jyxz963":"cabhJcprfYM:APA91bFrZMkT-iMRz3YXaanGiOQAbOgliYsgyCOuiHVJlJPMtkkM1iyujmnuOnH6b2NhgHsmPMsxYrCP1ZC68VrV9t22E8QivA3fkf5buYXYr8edYBzCNVsLfGjCBFpFcvNN8dP5jCy8","uOOTS0n81iUluI6h7MsGd0wIYqQ2":"cH5avH_CRA8:APA91bFoekF5vO9d3hQFic-eHhDukbqcNGC1ZCa5VYeCSOLFVgBH18U25UPuZZHylVcBFEY2kTTFxMzDfVxHOtQJA7gzd1AvGqdF0nQJdTnx_WNsc_se_NEvKdEAi_ajaFBAsbEp8nO7"},"drawLightsTab":false,"drawThingsTab":false,"garageDoorReminderWaitTime":2,"hasAircons":true,"hasLights":false,"hasSensors":false,"hasThings":false,"hasThingsBOG":false,"hasThingsLight":false,"latitude":-32.3222184,"logoPIN":"1234","longitude":115.82851529999999,"mid":"001ec0d334c7","myAppRev":"15.810","name":"MyPlace","needsUpdate":false,"noOfAircons":1,"noOfSnapshots":0,"postCode":"6171","rid":"k6KuJf5vHjYEF5KAdWefIDAKq8i2","showMeasuredTemp":true,"sysType":"MyAir5","tspErrorCode":"noError","tspIp":"192.168.1.4","tspModel":"MyAir5","versions":{}},"snapshots":{}}

Lost climate entities

I previously had climate.zonename entities. With the most recent updates they seem to have disappeared.

I do have these entities for the all the valid zones:
cover.zonename_vent
binary_sensor.zonename_motion
sensor.zonename_signal

No errors are being reported. Am I missing something obvious?

I do have the one entity called climate.ac for the master control that works and changes the mode, temperature, on/off etc. Its temperature does control the "myzone" selected zone, but doesn't work in reverse. Mine has been 16C since it was installed. That's a separate issue.

When making a change to system - "Cannot write to closing transport"

When changing a zone temperature, mode etc, the change is correctly sent to the system but the integration fails. Does it try to update immediately after setting?

Temporarily until the next regular poll, all the entities show as unknown. Once the regular poll occurs everything is OK again.

2020-08-11 09:54:33 DEBUG (MainThread) [custom_components.myair] Finished fetching MyAir data in 0.074 seconds
2020-08-11 09:55:03 DEBUG (MainThread) [custom_components.myair] Finished fetching MyAir data in 0.016 seconds
2020-08-11 09:55:33 DEBUG (MainThread) [custom_components.myair] Finished fetching MyAir data in 0.077 seconds
2020-08-11 09:55:57 ERROR (MainThread) [custom_components.myair] Error fetching MyAir data: Error getting MyAir data: Cannot write to closing transport
2020-08-11 09:55:57 DEBUG (MainThread) [custom_components.myair] Finished fetching MyAir data in 0.003 seconds

Unable to add integration from UI via Configuration -> Integrations

I installed this custom integration via HACS, have since had several restarts of HA (current version 0.114.3)

I cannot add the integration via the UI flow, it doesn't show up from the Configuration -> Integrations -> + flow. There is nothing named "MyAir & e-zone" or similar.

Any ideas?

Error in the HA Logs

File "/config/custom_components/myair/sensor.py", line 122, in icon
return ["mdi:fan-off","mdi:fan"][self.coordinator.data['aircons'][self.acx]['zones'][self.zx]['state'] == MYAIR_ZONE_OPEN]
NameError: name 'MYAIR_ZONE_OPEN' is not defined

Integration not detecting climate or sensor

Error log from HASSIO after installing integration:

Logger: homeassistant.components.climate
Source: custom_components/myair/climate.py:174
Integration: Climate (documentation, issues)
First occurred: 18:40:50 (1 occurrences)
Last logged: 18:40:50

Error while setting up myair platform for climate
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 184, in _async_setup_platform
await asyncio.shield(task)
File "/config/custom_components/myair/climate.py", line 54, in async_setup_entry
entities.append(MyAirZone(my, acx, zx))
File "/config/custom_components/myair/climate.py", line 174, in init
self.coordinator = hass.data[DOMAIN]['coordinator']
AttributeError: 'dict' object has no attribute 'data'

Logger: homeassistant.components.climate
Source: custom_components/myair/climate.py:174
Integration: Climate (documentation, issues)
First occurred: 18:40:50 (1 occurrences)
Last logged: 18:40:50

Error while setting up myair platform for climate
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 184, in _async_setup_platform
await asyncio.shield(task)
File "/config/custom_components/myair/climate.py", line 54, in async_setup_entry
entities.append(MyAirZone(my, acx, zx))
File "/config/custom_components/myair/climate.py", line 174, in init
self.coordinator = hass.data[DOMAIN]['coordinator']
AttributeError: 'dict' object has no attribute 'data'

JSON from myair:
{
"aircons": {
"ac1": {
"info": {
"aaAutoFanModeEnabled": true,
"activationCodeStatus": "noCode",
"airconErrorCode": "",
"cbFWRevMajor": 7,
"cbFWRevMinor": 8,
"cbType": 1,
"climateControlModeIsRunning": false,
"constant1": 9,
"constant2": 5,
"constant3": 0,
"countDownToOff": 0,
"countDownToOn": 0,
"fan": "high",
"filterCleanStatus": 0,
"freshAirStatus": "none",
"mode": "heat",
"myAutoModeCurrentSetMode": "heat",
"myAutoModeIsRunning": false,
"myZone": 0,
"name": "AC??",
"noOfConstants": 2,
"noOfZones": 10,
"quietNightModeEnabled": true,
"quietNightModeIsRunning": false,
"rfSysID": 2,
"setTemp": 23,
"state": "off",
"uid": "d88039efb59e",
"unitType": 24
},
"zones": {
"z01": {
"error": 0,
"maxDamper": 100,
"measuredTemp": 0,
"minDamper": 0,
"motion": 0,
"motionConfig": 0,
"name": "Dummy",
"number": 1,
"rssi": 0,
"setTemp": 21,
"state": "close",
"value": 20,
"type": 0,
"tempSensorClash": false
},
"z02": {
"error": 0,
"maxDamper": 100,
"measuredTemp": 16.5,
"minDamper": 0,
"motion": 0,
"motionConfig": 0,
"name": "Kids room",
"number": 2,
"rssi": 38,
"setTemp": 22,
"state": "open",
"value": 100,
"type": 1,
"tempSensorClash": false
},
"z03": {
"error": 0,
"maxDamper": 100,
"measuredTemp": 17.2,
"minDamper": 0,
"motion": 0,
"motionConfig": 0,
"name": "Guest room",
"number": 3,
"rssi": 37,
"setTemp": 22,
"state": "close",
"value": 100,
"type": 1,
"tempSensorClash": false
},
"z04": {
"error": 0,
"maxDamper": 100,
"measuredTemp": 17,
"minDamper": 0,
"motion": 0,
"motionConfig": 0,
"name": "Spare room",
"number": 4,
"rssi": 42,
"setTemp": 22,
"state": "close",
"value": 100,
"type": 1,
"tempSensorClash": false
},
"z05": {
"error": 0,
"maxDamper": 100,
"measuredTemp": 15.2,
"minDamper": 0,
"motion": 0,
"motionConfig": 0,
"name": "TV Room",
"number": 5,
"rssi": 17,
"setTemp": 22,
"state": "close",
"value": 100,
"type": 1,
"tempSensorClash": false
},
"z06": {
"error": 0,
"maxDamper": 100,
"measuredTemp": 16,
"minDamper": 0,
"motion": 0,
"motionConfig": 0,
"name": "EntranceHall",
"number": 6,
"rssi": 44,
"setTemp": 22,
"state": "close",
"value": 100,
"type": 1,
"tempSensorClash": false
},
"z07": {
"error": 0,
"maxDamper": 100,
"measuredTemp": 17.7,
"minDamper": 0,
"motion": 0,
"motionConfig": 0,
"name": "Study",
"number": 7,
"rssi": 49,
"setTemp": 22,
"state": "close",
"value": 100,
"type": 1,
"tempSensorClash": false
},
"z08": {
"error": 0,
"maxDamper": 100,
"measuredTemp": 19.2,
"minDamper": 0,
"motion": 0,
"motionConfig": 0,
"name": "Kitchen",
"number": 8,
"rssi": 41,
"setTemp": 22,
"state": "close",
"value": 100,
"type": 1,
"tempSensorClash": false
},
"z09": {
"error": 0,
"maxDamper": 100,
"measuredTemp": 19.9,
"minDamper": 0,
"motion": 0,
"motionConfig": 0,
"name": "Common Areas",
"number": 9,
"rssi": 51,
"setTemp": 22,
"state": "open",
"value": 100,
"type": 1,
"tempSensorClash": false
},
"z10": {
"error": 0,
"maxDamper": 100,
"measuredTemp": 17.1,
"minDamper": 0,
"motion": 0,
"motionConfig": 0,
"name": "Main bedroom",
"number": 10,
"rssi": 36,
"setTemp": 22,
"state": "open",
"value": 100,
"type": 1,
"tempSensorClash": false
}
}
}
},
"myAddOns": {
"hueBridges": {},
"hueBridgesOrder": []
},
"myLights": {
"groups": {},
"groupsOrder": [],
"lights": {},
"system": {
"sunsetTime": "05:55 PM"
}
},
"myMonitors": {
"monitors": {},
"monitorsOrder": []
},
"myScenes": {
"scenes": {
"s0": {
"aircons": {
"ac1": {
"info": {
"fan": "high",
"freshAirStatus": "none",
"mode": "heat",
"myZone": 0,
"name": "AC??",
"setTemp": 23,
"state": "off",
"uid": "d88039efb59e"
},
"zones": {
"z01": {
"motionConfig": 0,
"number": 1,
"setTemp": 21,
"state": "close",
"value": 20,
"tempSensorClash": false
},
"z02": {
"motionConfig": 0,
"number": 2,
"setTemp": 22,
"state": "open",
"value": 100,
"tempSensorClash": false
},
"z03": {
"motionConfig": 0,
"number": 3,
"setTemp": 22,
"state": "close",
"value": 100,
"tempSensorClash": false
},
"z04": {
"motionConfig": 0,
"number": 4,
"setTemp": 22,
"state": "close",
"value": 100,
"tempSensorClash": false
},
"z05": {
"motionConfig": 0,
"number": 5,
"setTemp": 22,
"state": "close",
"value": 100,
"tempSensorClash": false
},
"z06": {
"motionConfig": 0,
"number": 6,
"setTemp": 22,
"state": "close",
"value": 100,
"tempSensorClash": false
},
"z07": {
"motionConfig": 0,
"number": 7,
"setTemp": 22,
"state": "close",
"value": 100,
"tempSensorClash": false
},
"z08": {
"motionConfig": 0,
"number": 8,
"setTemp": 22,
"state": "close",
"value": 100,
"tempSensorClash": false
},
"z09": {
"motionConfig": 0,
"number": 9,
"setTemp": 22,
"state": "open",
"value": 100,
"tempSensorClash": false
},
"z10": {
"motionConfig": 0,
"number": 10,
"setTemp": 22,
"state": "open",
"value": 100,
"tempSensorClash": false
}
}
}
},
"id": "s0",
"name": "MyUndo",
"summary": "Days this scene will run:\nnone\n\nAircon: off"
},
"s10001": {
"activeDays": 62,
"airconStopTime": 465,
"airconStopTimeEnabled": true,
"aircons": {
"ac1": {
"info": {
"fan": "high",
"freshAirStatus": "none",
"mode": "heat",
"myZone": 0,
"name": "Aircon",
"setTemp": 23,
"state": "on",
"uid": "d88039efb59e"
},
"zones": {
"z01": {
"motionConfig": 0,
"number": 1,
"setTemp": 21,
"state": "close",
"value": 20,
"tempSensorClash": false
},
"z02": {
"motionConfig": 0,
"number": 2,
"setTemp": 22,
"state": "open",
"value": 100,
"tempSensorClash": false
},
"z03": {
"motionConfig": 0,
"number": 3,
"setTemp": 22,
"state": "close",
"value": 100,
"tempSensorClash": false
},
"z04": {
"motionConfig": 0,
"number": 4,
"setTemp": 22,
"state": "close",
"value": 100,
"tempSensorClash": false
},
"z05": {
"motionConfig": 0,
"number": 5,
"setTemp": 22,
"state": "close",
"value": 100,
"tempSensorClash": false
},
"z06": {
"motionConfig": 0,
"number": 6,
"setTemp": 22,
"state": "close",
"value": 100,
"tempSensorClash": false
},
"z07": {
"motionConfig": 0,
"number": 7,
"setTemp": 22,
"state": "close",
"value": 100,
"tempSensorClash": false
},
"z08": {
"motionConfig": 0,
"number": 8,
"setTemp": 22,
"state": "close",
"value": 100,
"tempSensorClash": false
},
"z09": {
"motionConfig": 0,
"number": 9,
"setTemp": 22,
"state": "open",
"value": 100,
"tempSensorClash": false
},
"z10": {
"motionConfig": 0,
"number": 10,
"setTemp": 22,
"state": "open",
"value": 100,
"tempSensorClash": false
}
}
}
},
"id": "s10001",
"lights": {},
"myTimeEnabled": false,
"name": "Morning week",
"startTime": 375,
"summary": "Days this scene will run:\nMonday, Tuesday, Wednesday, Thursday, Friday\n\nAircon: on, mode: heat, fan speed: high, 23°C\nopen zones:\nKids room, Common Areas, Main b/room",
"things": {},
"timerEnabled": true
},
"s10002": {
"activeDays": 65,
"airconStopTime": 480,
"airconStopTimeEnabled": true,
"aircons": {
"ac1": {
"info": {
"fan": "auto",
"freshAirStatus": "none",
"mode": "heat",
"myZone": 0,
"name": "AC??",
"setTemp": 23,
"state": "on",
"uid": "d88039efb59e"
},
"zones": {
"z01": {
"motionConfig": 0,
"number": 1,
"setTemp": 21,
"state": "close",
"value": 20,
"tempSensorClash": false
},
"z02": {
"motionConfig": 0,
"number": 2,
"setTemp": 21,
"state": "close",
"value": 100,
"tempSensorClash": false
},
"z03": {
"motionConfig": 0,
"number": 3,
"setTemp": 22,
"state": "close",
"value": 100,
"tempSensorClash": false
},
"z04": {
"motionConfig": 0,
"number": 4,
"setTemp": 22,
"state": "close",
"value": 100,
"tempSensorClash": false
},
"z05": {
"motionConfig": 0,
"number": 5,
"setTemp": 22,
"state": "open",
"value": 100,
"tempSensorClash": false
},
"z06": {
"motionConfig": 0,
"number": 6,
"setTemp": 22,
"state": "close",
"value": 100,
"tempSensorClash": false
},
"z07": {
"motionConfig": 0,
"number": 7,
"setTemp": 22,
"state": "close",
"value": 100,
"tempSensorClash": false
},
"z08": {
"motionConfig": 0,
"number": 8,
"setTemp": 22,
"state": "open",
"value": 100,
"tempSensorClash": false
},
"z09": {
"motionConfig": 0,
"number": 9,
"setTemp": 22,
"state": "open",
"value": 100,
"tempSensorClash": false
},
"z10": {
"motionConfig": 0,
"number": 10,
"setTemp": 21,
"state": "open",
"value": 100,
"tempSensorClash": false
}
}
}
},
"id": "s10002",
"lights": {},
"myTimeEnabled": false,
"name": "Morning wknd",
"startTime": 390,
"summary": "Days this scene will run:\nSaturday, Sunday\n\nAircon: on, mode: heat, fan speed: auto, 23°C\nopen zones:\nTV Room, Kitchen, Common Areas, Main b/room",
"things": {},
"timerEnabled": false
},
"s10003": {
"activeDays": 0,
"airconStopTime": 1395,
"airconStopTimeEnabled": true,
"aircons": {
"ac1": {
"info": {
"fan": "high",
"freshAirStatus": "none",
"mode": "cool",
"myZone": 0,
"name": "Aircon",
"setTemp": 21,
"state": "on",
"uid": "d88039efb59e"
},
"zones": {
"z01": {
"motionConfig": 0,
"number": 1,
"setTemp": 21,
"state": "close",
"value": 20,
"tempSensorClash": false
},
"z02": {
"motionConfig": 0,
"number": 2,
"setTemp": 22,
"state": "open",
"value": 100,
"tempSensorClash": false
},
"z03": {
"motionConfig": 0,
"number": 3,
"setTemp": 22,
"state": "close",
"value": 100,
"tempSensorClash": false
},
"z04": {
"motionConfig": 0,
"number": 4,
"setTemp": 23,
"state": "close",
"value": 100,
"tempSensorClash": false
},
"z05": {
"motionConfig": 0,
"number": 5,
"setTemp": 24,
"state": "close",
"value": 100,
"tempSensorClash": false
},
"z06": {
"motionConfig": 0,
"number": 6,
"setTemp": 23,
"state": "close",
"value": 100,
"tempSensorClash": false
},
"z07": {
"motionConfig": 0,
"number": 7,
"setTemp": 21,
"state": "close",
"value": 100,
"tempSensorClash": false
},
"z08": {
"motionConfig": 0,
"number": 8,
"setTemp": 23,
"state": "close",
"value": 100,
"tempSensorClash": false
},
"z09": {
"motionConfig": 0,
"number": 9,
"setTemp": 24,
"state": "close",
"value": 100,
"tempSensorClash": false
},
"z10": {
"motionConfig": 0,
"number": 10,
"setTemp": 23,
"state": "open",
"value": 100,
"tempSensorClash": false
}
}
}
},
"id": "s10003",
"lights": {},
"myTimeEnabled": false,
"name": "Night",
"startTime": 1275,
"summary": "Days this scene will run:\nnone\n\nAircon: on, mode: cool, fan speed: high, 21°C\nopen zones:\nKids room, Main b/room",
"things": {},
"timerEnabled": false
}
},
"scenesOrder": [
"s10001",
"s10002",
"s10003"
]
},
"mySensors": {
"sensors": {},
"sensorsOrder": []
},
"myThings": {
"groups": {},
"groupsOrder": [],
"system": {},
"things": {}
},
"system": {
"aaServiceRev": "14.116",
"allTspErrorCodes": {},
"country": "South Africa",
"dealerPhoneNumber": "",
"deviceIds": [removed ],
"deviceIdsV2": {removed },
"drawLightsTab": false,
"drawThingsTab": false,
"garageDoorReminderWaitTime": 2,
"hasAircons": true,
"hasLights": false,
"hasSensors": false,
"hasThings": false,
"hasThingsBOG": false,
"hasThingsLight": false,
"latitude": removed,
"logoPIN": removed,
"longitude": removed,
"mid": removed
"myAppRev": "15.808",
"name": "e-Zone",
"needsUpdate": false,
"noOfAircons": 1,
"noOfSnapshots": 0,
"postCode": removed,
"rid": removed
"showMeasuredTemp": true,
"sysType": "e-zone",
"tspErrorCode": "noError",
"tspIp": "192.168.1.15",
"tspModel": "e-zone2",
"versions": {}
},
"snapshots": {}
}

Attempt to decode JSON with unexpected mimetype: text/plain

Hey thanks for having a go at this. I tried and have some basic JSON parsing etc but don't know python well enough. Anyway I tried on a real system and got this

I can provide the actual JSON (after removing personal details) if you need.

2020-08-10 14:58:43 DEBUG (MainThread) [custom_components.myair] Setting up MyAir
2020-08-10 14:58:46 ERROR (MainThread) [custom_components.myair] Error fetching MyAir data: Error getting MyAir data: 0, message='Attempt to decode JSON with unexpected mimetype: text/plain', url='http://192.168.99.24:2025/getSystemData
2020-08-10 14:58:46 DEBUG (MainThread) [custom_components.myair] Finished fetching MyAir data in 3.244 seconds
2020-08-10 14:58:46 ERROR (MainThread) [homeassistant.setup] Error during setup of component myair
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 193, in _async_setup_component
    result = await asyncio.wait_for(task, SLOW_SETUP_MAX_WAIT)
  File "/usr/local/lib/python3.8/asyncio/tasks.py", line 483, in wait_for
    return fut.result()
  File "/config/custom_components/myair/__init__.py", line 84, in async_setup
    "identifiers": {(DOMAIN, coordinator.data['system']['mid'])},
TypeError: 'NoneType' object is not subscriptable

Use the wall mounted tablet for HA as well as this integration?

First of all, thank you for this component.
I know this is now part of core but just wanted to find out something.

We are building our first house soon and it will be coming with the myAir system. I was planning on using the wall mounted tablet as a HA tablet. But if I am using the tablet to display HA (with fullyKiosk or something) does this integration still work?

Is it just that the myPlace app has to be in the background or does it need to be in the foreground for the integration to work?

Bottom line is - can this integration still work if the tablet is displaying HA or of its being used for something else (YouTube, etc)?

Compatibility for MyAir 1 Controllers

It would be great if you were able to integrate the MyAir 1 controller into this integration.
I have the MyAir 1 wall mounted Android 10 tablet/screen. I tried the current integration but although i enter the correct IP for the system it wont connect.
If you were open to the idea i would be happy to assist you wherever i can and provide the required info since i have the MyAir 1 system.

Code correction in climate.py

line 282 onwards:
if(hvac_mode == HVAC_MODE_OFF):
await self.async_set_data({self.acx:{"zones":{"state":MYAIR_ZONE_CLOSE}}})
else:
await self.async_set_data({self.acx:{"zones":{"state":MYAIR_ZONE_OPEN}}})

should read
if(hvac_mode == HVAC_MODE_OFF):
await self.async_set_data({self.acx:{"zones":self.zx:{{"state":MYAIR_ZONE_CLOSE}}}})
else:
await self.async_set_data({self.acx:{"zones":self.zx:{{"state":MYAIR_ZONE_OPEN}}}})

Made the change on my local copy and then works :)

UI elements become unavailable - especially after interacting with UI

Frequently after interacting with the Lovelace UI elements for the Aircon (havent tested services yet, but I suspect the same), the UI options become unavailable:
image

Worth noting, is immediately for a few seconds after interacting with the UI, a getSystemData will only return
{}

This empty result also occurs after interacting with the control tablet or mobile app as well - I suspect the system returns an empty result set whenever any commands are issued
After a second or so, the normal getSystemData complete results are returned.

The unavailable message can persist for quite some time, perhaps 20 seconds or longer.
GetSystemData returns normal full results during this time.

I think this is due to perhaps polling too soon after a change, and then a subsequent delay between retrying the next "full" poll, resulting in appearing unavailable for several seconds longer than needed. Perhaps a slightly longer delay in the poll before reaching the 5 times, will return a good result set.

Core log ERROR's:
2020-10-03 13:28:46 ERROR (MainThread) [custom_components.myair] Timeout fetching MyAir data
2020-10-03 13:59:31 ERROR (MainThread) [custom_components.myair] Error fetching MyAir data: Tried 5 times to get MyAir data
2020-10-03 14:00:38 ERROR (MainThread) [custom_components.myair] Error fetching MyAir data: Tried 5 times to get MyAir data
2020-10-03 14:01:51 ERROR (MainThread) [custom_components.myair] Error fetching MyAir data: Tried 5 times to get MyAir data
2020-10-03 14:06:01 ERROR (MainThread) [custom_components.myair] Timeout fetching MyAir data
2020-10-03 14:07:40 ERROR (MainThread) [custom_components.myair] Error fetching MyAir data: Tried 5 times to get MyAir data
2020-10-03 14:08:13 ERROR (MainThread) [custom_components.myair] Error fetching MyAir data: Tried 5 times to get MyAir data

getSystemData:
{"aircons":{"ac1":{"info":{"aaAutoFanModeEnabled":true,"activationCodeStatus":"noCode","airconErrorCode":"","cbFWRevMajor":6,"cbFWRevMinor":2,"cbType":0,"climateControlModeIsRunning":false,"constant1":4,"constant2":0,"constant3":0,"countDownToOff":0,"countDownToOn":0,"fan":"low","filterCleanStatus":0,"freshAirStatus":"none","mode":"vent","myAutoModeCurrentSetMode":"vent","myAutoModeIsRunning":false,"myZone":0,"name":"AC","noOfConstants":1,"noOfZones":4,"quietNightModeEnabled":false,"quietNightModeIsRunning":false,"rfSysID":2,"setTemp":23.0,"state":"off","uid":"001ec0d334c7","unitType":17},"zones":{"z01":{"error":0,"maxDamper":100,"measuredTemp":0.0,"minDamper":0,"motion":0,"motionConfig":0,"name":"MASTER SUITE","number":1,"rssi":0,"setTemp":24.0,"state":"open","value":100,"type":0,"tempSensorClash":false},"z02":{"error":0,"maxDamper":100,"measuredTemp":0.0,"minDamper":0,"motion":0,"motionConfig":0,"name":"BEDROOMS","number":2,"rssi":0,"setTemp":24.0,"state":"close","value":10,"type":0,"tempSensorClash":false},"z03":{"error":0,"maxDamper":100,"measuredTemp":0.0,"minDamper":0,"motion":0,"motionConfig":0,"name":"THEATRE","number":3,"rssi":0,"setTemp":24.0,"state":"open","value":100,"type":0,"tempSensorClash":false},"z04":{"error":0,"maxDamper":100,"measuredTemp":0.0,"minDamper":0,"motion":0,"motionConfig":0,"name":"LIVING","number":4,"rssi":0,"setTemp":24.0,"state":"open","value":100,"type":0,"tempSensorClash":false}}}},"myAddOns":{"hueBridges":{},"hueBridgesOrder":[]},"myLights":{"groups":{},"groupsOrder":[],"lights":{},"system":{"sunsetTime":"06:20 PM"}},"myMonitors":{"monitors":{},"monitorsOrder":[]},"myScenes":{"scenes":{"s0":{"aircons":{"ac1":{"info":{"fan":"low","freshAirStatus":"none","mode":"heat","myZone":0,"name":"AC","setTemp":22.0,"state":"off","uid":"001ec0d334c7"},"zones":{"z01":{"motionConfig":0,"number":1,"setTemp":24.0,"state":"open","value":15,"tempSensorClash":false},"z02":{"motionConfig":0,"number":2,"setTemp":24.0,"state":"close","value":20,"tempSensorClash":false},"z03":{"motionConfig":0,"number":3,"setTemp":24.0,"state":"close","value":20,"tempSensorClash":false},"z04":{"motionConfig":0,"number":4,"setTemp":24.0,"state":"open","value":65,"tempSensorClash":false}}}},"id":"s0","lights":{},"monitors":{},"name":"MyUndo","summary":"Days this scene will run:\nnone\n\nMyAir:\nAircon: off","things":{}}},"scenesOrder":[]},"mySensors":{"sensors":{},"sensorsOrder":[]},"myThings":{"groups":{},"groupsOrder":[],"system":{},"things":{}},"system":{"aaServiceRev":"14.116","allTspErrorCodes":{},"country":"Australia","dealerPhoneNumber":"1300850191","deviceIds":["2288rIn3K8XEocR0wMytrqwUiNR2","6B0fQ8w0CvaamsH3Od5x9jyxz963","uOOTS0n81iUluI6h7MsGd0wIYqQ2","5ZFTC2GmlrSyfJQgmwln49V7sKk1","GB5iVebh5Igk9UgUbX3rTo0vbkG3"],"deviceIdsV2":{"2288rIn3K8XEocR0wMytrqwUiNR2":"eZ-NgQI4U5w:APA91bGUsEfSu8kahICB7KQ35ITfFgBjper8mbvA6V85NpqZc3_fxDkYLoFJqYoEHlG5PAIoISAjoKGLd6ICWzEnZ3avMGGMidVtm_j-j8M2mvtYfxnbfccOfPlyL7IUlQUAs5GbPAza","5ZFTC2GmlrSyfJQgmwln49V7sKk1":"f8ka_ZFM0ag:APA91bFQAicGacLIcovF_730LzfI9MIeiwnhO7N0iGjgyFMR5-rYp2sS1pOtwt9jxOUnGhPYRxy8F0bfIpvmjyixdT6WOyOQx-zh-Q7JSl8-HKDrRJJb9xvL-j1khO_G4_9-jYnDMjmO","GB5iVebh5Igk9UgUbX3rTo0vbkG3":"et2_M2oCk2Q:APA91bFFTmlivD-_6DRllLm_uApQtMn8DMflVw_38U4XqXrIYkBTd4clo060wJ8eFECsrrrOJnHt7EbTBnI2MVthihN1X5w7luYeGqkix1nsvgUDFrJvhjiuUuTpZGyFQ-g6H8vThwGd","6B0fQ8w0CvaamsH3Od5x9jyxz963":"cabhJcprfYM:APA91bFrZMkT-iMRz3YXaanGiOQAbOgliYsgyCOuiHVJlJPMtkkM1iyujmnuOnH6b2NhgHsmPMsxYrCP1ZC68VrV9t22E8QivA3fkf5buYXYr8edYBzCNVsLfGjCBFpFcvNN8dP5jCy8","uOOTS0n81iUluI6h7MsGd0wIYqQ2":"cH5avH_CRA8:APA91bFoekF5vO9d3hQFic-eHhDukbqcNGC1ZCa5VYeCSOLFVgBH18U25UPuZZHylVcBFEY2kTTFxMzDfVxHOtQJA7gzd1AvGqdF0nQJdTnx_WNsc_se_NEvKdEAi_ajaFBAsbEp8nO7"},"drawLightsTab":false,"drawThingsTab":false,"garageDoorReminderWaitTime":2,"hasAircons":true,"hasLights":false,"hasSensors":false,"hasThings":false,"hasThingsBOG":false,"hasThingsLight":false,"latitude":-32.3222184,"logoPIN":"1234","longitude":115.82851529999999,"mid":"001ec0d334c7","myAppRev":"15.810","name":"MyPlace","needsUpdate":false,"noOfAircons":1,"noOfSnapshots":0,"postCode":"6171","rid":"k6KuJf5vHjYEF5KAdWefIDAKq8i2","showMeasuredTemp":true,"sysType":"MyAir5","tspErrorCode":"noError","tspIp":"192.168.1.4","tspModel":"MyAir5","versions":{}},"snapshots":{}}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.