nordicopen / easee_hass

Custom component for Easee EV charger integration with Home Assistant
207 stars 34 forks source link

Feature request. #38

Closed Hellowlol closed 3 years ago

Hellowlol commented 3 years ago

I would like to have a service that exposes the access.

This way i can use a device tracker in ha that disabled rfid access when the car is parked next to the charger and reenable this with the cars isnt parked there.

I dont know if this is possible atm, i assumed that it would be possible to just add

    async def require_rfid_access(allowed: bool):
        """ Set charger dynamic current """
        json = {"authorizationRequired": allowed}
        return await easee.post(f"/api/chargers/{charger.id}/settings", json=json)

    await require_rfid_access(True)

    async def set_access(accesslevel: int):
        """"1: Open for all
              2: Access to all users with Easee account.
              3: Access to whitelisted users
         """"
        return await easee.put(f"/api/chargers/{charger.id}/access/", json=accesslevel)

But it dont seem to change anything in the easee cloud.

Edit: Pressing the button in the app seems to change the access to Access to all users with a Easee account (the data is sends is 2)

set_access seems to work but the car isnt home atm so i need to check that this works as intented.

Hellowlol commented 3 years ago

Seems to work ok. Ill send PR for this.

Hellowlol commented 3 years ago

Closing this as pr is sent