Battery automation issues

6 comments started 2024-04-09 last 2024-04-10
Home AutomationHome Assistant
S
#1 Sandy

I am trying to set up automations in HA to charge my battery based on the solcast forecast at the cheapest rates coming in from my octopus Agile tariff. I have GivTCP, Solcast and the bottlecap Dave integration all installed.

Issue:
Currently the battery doesn't seem to charge based on the bottlecap Dave sensor and weirdly it now selects a random time to export to the grid until empty which I have not asked it to do, I want to use that power myself. I've looked at the logs and I can't see anything at the time the export starts that would explain why, no automation firing and nothing in GivTCP other than the usual updates on times

Setup:
I have configured my Solcast API in GivTCP.
The sensor for the bottlecap Dave integration accurately identifies the cheapest rate and fires. I've checked the state in dev tools.
Here is the automation I created to read the cheapest rate and charge the battery. When it is above 99% it stops and goes back to discharge (or at least should, this doesn't work right now)

'alias: Start battery charge at cheapest rate
description: ""
trigger:

  • platform: state
    entity_id:
    • binary_sensor.octopus_energy_target_battery_over_night
      from: "off"
      to: "on"
      condition: []
      action:
  • device_id: 002ed8c01f7e01e577b4760e9883f896
    domain: number
    entity_id: aed2527e0cb1712ae99a6da271eec002
    type: set_value
    value: 100
  • choose:
    • conditions:
      • type: is_battery_level
        condition: device
        device_id: c2d5b9907762e6c266d4a79a0a86a7fb
        entity_id: d6b458012452e5a01263efb2cc928270
        domain: sensor
        above: 99
        sequence:
        • device_id: 002ed8c01f7e01e577b4760e9883f896
          domain: number
          entity_id: aed2527e0cb1712ae99a6da271eec002
          type: set_value
          value: 0
        • type: turn_on
          device_id: 002ed8c01f7e01e577b4760e9883f896
          entity_id: cd1f948df1aad27ab5ac56b584eede2b
          domain: switch
          mode: single'

I did find this thread on here with what looked like exactly what I wanted from @Arg0t but I couldn't get those automations to work. I think because I didn't know how to set the charge slot in GivTCP so tried creating something simpler myself.

If anyone has any ideas I'd be grateful, I'm tearing my hair out here (well I would be if I wasn't bald!)

#3 Hook

I was thinking what the hell is batpred? How come it has 2 names? I've only ever known it as predbat.

S
#4 Sandy

Cdent I have not, thank you this looks good :-) Does this negate the need for GivTCP then? Or are you still using that as well for automations?

I have also just discovered after finishing work that despite it being sunny right now, my battery isn't charging and in fact has been exporting to the grid over charging the battery which is completely opposite to what I want! As this only occored since I started playing with this, I suspect this is something to do with GivTCP as I don't think anything else has access to my inverter.

G
#5 geoffreycoan

Sandy you still need givtcp to control your inverter and solcast to get your solar forecasts, but batpred/predbat will do all the forecasting and controlling of givtcp to charge and discharge your batteries at the best times to reduce your total electricity bill.

Its a powerful tool but there’s lots of documentation and help available.

Is it possible to change your automation to use entity names, e.g. switch.givtcp_xxxxx
You don’t need device id’s at all and at the moment as you have long numeric id’s I personally can’t tell what your automation is actually doing, what its switching on and off.

Hook batpred and predbat are the same thing. I think batpred may have been the original name for it, the code file is actually called batpred but all the documentation now refers to predbat.

S
#6 Sandy

Thanks guys, I have it installed and working. This seems to solve my issues :-D