CharlesGillanders / homeassistant-alphaESS

Monitor your energy generation, storage, and usage data using the official API from Alpha ESS.
MIT License
101 stars 22 forks source link

AlphaESS Set Battery Charge disable #108

Open LordBube opened 8 months ago

LordBube commented 8 months ago

Hey there, Sometimes I use the "Set battery Charge"-Service at night to charge my battery when the electricity price is really low and when I can anticipate that I will use more electricity the following day. I do that through NodeRed but with the home assistant node and calling the service in the node. Charging the battery works well and I use the following code:

service: alphaess.setbatterycharge
data:
  enabled: true
  cp1start: "02:00"
  cp1end: "05:00"
  cp2start: "00:00"
  cp2end: "00:00"
  chargestopsoc: 100
  serial: XXXXXXXXXXXX (I insert my serial here)

If I understand the code correctly, I need to set "enabled" to false to turn it off. Correct? If so, this does not seem to work. It is still on in the app and also on cloud.alphaess.com. It also charges the battery the following night if I do not turn it off.

Can someone please look into this or point me in the right direction.

Big thanks by the way to @CharlesGillanders for the awesome integration!!!

CharlesGillanders commented 8 months ago

Would you mind trying to use the initial letter capitalised as "False" to disable charging - that's the case that python expects.

LordBube commented 8 months ago

Thank you for your quick response. Unfortunately, it is still not working after changing it to False :(

wallus commented 3 months ago

I am also having some related problems. I am trying to change the setbatterycharge times in an automation, but I have found that sometimes it does not work. For example, if 'enabled: false', then it won't change it to 'enabled: true' and as per the example below, if 'enable: true', then it won't change the times to new values. I think it works about half the time.

This is my automation code.

  service: setbatterycharge
  service_data:
    serial: XXXXXXXXXXXXXXX (my serial hidden)
    enabled: true
    cp1start: '12:00'
    cp1end: '15:00'
    cp2start: '00:00'
    cp2end: '00:00'
    chargestopsoc: 100

Notes:

achie188 commented 2 months ago

I am having the same issue here. I'm not 100% sure, but it looks like once it is enabled that it cannot be changed. For example if I manually turn it off, then it seems to be able to be turned on through home assistant, but then any further changes don't work. For example, I experimented with leaving it enabled, but changing the times so it wouldn't charge, but nothing changed. But if I turned it off again (manually) then the new changes would pass through again.

Poshy163 commented 2 months ago

Seems to be a upstream issue? a issue has been made here https://github.com/alphaess-developer/alphacloud_open_api/issues/83

achie188 commented 2 months ago

Good spot, thanks. Seems to be working now, but haven't seen anything communicated about a fix! Hopefully it continues.

Thanks all