galletn / iaqualink

Home Assistant Iaqualink Vacuums Robots
8 stars 1 forks source link

Added attributes to capture operational and canister state #3

Closed ppastur closed 1 year ago

ppastur commented 1 year ago

Enhancement suggestion

I also added a few more attributes such as running state and canister empty/ok

I modified sensor.py in the section where the response from the API call is being mapped into attributes (I think) here self._headers = {"Content-Type": "application/json; charset=utf-8", "Connection": "keep-alive", "Accept": "*/*", ``"Authorization" : self._id_token} response = requests.get(url, headers = self._headers) if response.status_code == 200:

and added the following lines; self._canister = data["state"]["reported"]["equipment"]["robot"]["canister"] self._attributes['canister'] = self._canister self._running = data["state"]["reported"]["equipment"]["robot"]["state"] self._attributes['running'] = self._running

Then I created template sensors in the config.yaml to map 0/1 to empty/full or running/Idle

Then in the card, I created badges and animations to show when running/idle or when the canister needs emptying.

https://github.com/flz/iaqualink-py/assets/91765182/950c3478-9fc8-4a1b-b9dd-6977317f75d9

galletn commented 1 year ago

@ppastur can you validate this works? thanks!

ppastur commented 1 year ago

Confirmed, this works.