I am struggling with the learning curve with monitoring / configuring my AC unit using its RESTful interface. Having spent some time sniffing the traffic between the vendors phone app and their web API, I now understand how to interpret the AC’s status and how to change settings. I would now like to add some state information to HA and then add some controls. However, I am stuck on the best approach for doing so.
I have created a RESTful sensor:
- platform: rest
name: InnovaAC
resource: http://cloud/api/v/1/status
headers:
X-serial:
X-UID:
X-Requested-With: XMLHttpRequest
Content-Type: application/json
User-Agent: HomeAssistantRESTsensor
json_attributes:
- RESULT
value_template: '{{ value_json.value }}'
If I then put this: “{{ states.sensor.innovaac.attributes }}” into the HA template editor, I can see the following returned:
{'RESULT': {'sp': 23, 'wm': 1, 'ps': 0, 'fs': 0, 'fr': 0, 'cm': 0, 'a': [], 't': 24, 'cp': 0, 'of': 0, 'nm': 0, 'ns': 0, 'ncc': 232, 'ccv': 1, 'uptime': 147380, 'majorVersion': 1, 'minorVersion': 0, 'buildVersion': 36, 'heatingDisabled': 0, 'coolingDisabled': 0, 'hotelMode': 0, 'kl': 0, 'heatingResistance': 0}, 'friendly_name': 'InnovaAC'}
What I need to figure out is how to capture some of these values. For example, ‘sp’ is the temperature set point. But I can’t get this data point.
Once that (hopefully) simple element is working, I then need to take a value like ‘cm’ and if it is 0 have a state of “Manual” and if 1 have “Scheduling”. ‘wm’ has 6 different possible values.
Any and all pointers gratefully received at this point!
The full returned JSON from the call is:
{"success":true,"sw":{"V":"1.0.36"},"UID":"00:00:00:00:00:00","setup":{"serial":"00000000","name":"Shed"},"net":{"ip":"0.0.0.0","sub":"","gw":""},"RESULT":{"sp":23,"wm":1,"ps":0,"fs":0,"fr":0,"cm":0,"a":[],"t":24,"cp":0,"of":0,"nm":0,"ns":0,"ncc":232,"ccv":1,"uptime":147690,"majorVersion":1,"minorVersion":0,"buildVersion":36,"heatingDisabled":0,"coolingDisabled":0,"hotelMode":0,"kl":0,"heatingResistance":0},"time":{"d":"07","m":"09","y":"2018","h":"15","i":"56"}}