hesselonline / wallbox

MIT License
21 stars 8 forks source link

Quasar status types not included #7

Open simeon-simsoft opened 3 years ago

simeon-simsoft commented 3 years ago

Hi,

This component is very useful, thanks for your hard work. I have a Quasar which is bi-directional. This brings more status types that aren't considered in the current code, specifically around the behaviour of the pause function. These include:

connected: waiting for next schedule discharging

I would be happy to collaborate on changes to support this charger model.

Regards

hesselonline commented 3 years ago

hi, I think this indeed only impacts the pause function at the moment. Currently you can 'pause' it when it is 'charging'. You can unpause/resume when it is not 'charging' or 'ready' or 'error' or 'offline'. We can add your states to these conditions, is discharging something that can be paused? And what would you propose for the 'waiting for schedule' status? And are there anymore? If you give me a list of different statuses and the proposed functionality for each I will see what I can do!

simeon-simsoft commented 3 years ago

Hi,

I made some provisional changes to the code locally to get this working but need to test a bit further.. what is see is the switch flicking back to the previous state for a few seconds after switching it, and then flicking back to the new state I have requested.. I just need to look through the different status messages being passed at that point to see why.

@property

def icon(self):

    """Return the icon of the switch."""

    if self.coordinator.data == "charging":

        return "mdi:motion-play-outline"

    if self.coordinator.data == "connected" or self.coordinator.data == "connected: waiting for next schedule":

        return "mdi:motion-pause-outline"

    return "mdi:power-plug-off-outline"

@property

def is_on(self):

    """Return the status of the switch."""

    return self.coordinator.data.lower() not in [

        "offline",

        "error",

        "ready",

        "charging",

        "discharging",

    ]

@property

def available(self):

    """Return the availability of the switch."""

    return self.coordinator.data.lower() not in ["offline", "error", "ready"]

def turn_on(self, **kwargs):

    """Turn switch on."""

    _LOGGER.debug("switch on state = " + self.coordinator.data.lower())

    if self.coordinator.data.lower() == "charging" or self.coordinator.data.lower() == "discharging":

        self.pause_charger(True)

    else:

        _LOGGER.debug("Not charging, cannot pause, doing nothing")

def turn_off(self, **kwargs):

    """Turn switch off."""

    _LOGGER.debug("switch off state = " + self.coordinator.data.lower())

    if self.coordinator.data.lower() not in [

        "offline",

        "error",

        "ready",

        "charging",

        "discharging",

    ]:

        self.pause_charger(False)

    else:

        _LOGGER.debug("Status is not 'connected', cannot unpause, doing nothing")

Regards

Sim

From: hesselonline @.> Sent: 15 June 2021 18:37 To: hesselonline/wallbox @.> Cc: simeon-simsoft @.>; Author @.> Subject: Re: [hesselonline/wallbox] Quasar status types not included (#7)

hi, I think this indeed only impacts the pause function at the moment. Currently you can 'pause' it when it is 'charging'. You can unpause/resume when it is not 'charging' or 'ready' or 'error' or 'offline'. We can add your states to these conditions, is discharging something that can be paused? And what would you propose for the 'waiting for schedule' status? And are there anymore? If you give me a list of different statuses and the proposed functionality for each I will see what I can do!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/hesselonline/wallbox/issues/7#issuecomment-861700306 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AOVQVCV4XUM5HW3NDUC4GI3TS6FSDANCNFSM46VN3UPQ . https://github.com/notifications/beacon/AOVQVCTI4FHRL7BSCVRFXFLTS6FSDA5CNFSM46VN3UP2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOGNOIBUQ.gif

simeon-simsoft commented 2 years ago

hello, sorry this thread ran cold.. I just wondered if you were still up for adding the necessary changes to make your excellent component in HA work with the Quasar for discharging? I am running my own modifications based on your code but would love to go back to the native version you have produced.

Cheers Sim

hesselonline commented 2 years ago

Hi, basically I don't have a real good fix yet. Sorry for that, Will let you know if I think of something

simeon-simsoft commented 2 years ago

I'm happy to share my code for you to integrate, I'm not really sure how to go about pushing the required changes direct to HA but maybe it's time to learn!!

Sent from my Galaxy

-------- Original message -------- From: hesselonline @.> Date: 29/06/2022 18:55 (GMT+00:00) To: hesselonline/wallbox @.> Cc: simeon-simsoft @.>, Author @.> Subject: Re: [hesselonline/wallbox] Quasar status types not included (#7)


From : hesselonline @. To : hesselonline/wallbox @. Cc : simeon-simsoft @., Author @. Date : Wednesday, June 29 2022 18:55:17

Hi, basically I don't have a real good fix yet. Sorry for that, Will let you know if I think of something

— Reply to this email directly, view it on GitHub https://github.com/hesselonline/wallbox/issues/7#issuecomment-117030744 1 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AOVQVCVOXGRZSQW4TXONU 33VRSEYLANCNFSM46VN3UPQ . You are receiving this because you authored the thread. https://github.com/notifications/beacon/AOVQVCQX67PIDYSV7HN66LTVRSEYLA5 CNFSM46VN3UP2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZG OIXAXS4I.gif Message ID: @.***>