hif2k1 / battery_sim

Home assistant home battery simulator - allows you to model how much energy you would save with a home battery
124 stars 14 forks source link

Feature request: support for multiple custom batteries #36

Closed vandenberghev closed 2 years ago

vandenberghev commented 2 years ago

I'd like simulate multiple custom batteries to determine which one suits my home best. So I configured multiple custom: entries in yaml, but only the last one is used. Having multiple (unlimited?) custom entries would be very nice to have.

hif2k1 commented 2 years ago

Can you post your yaml. Did you give them different names?

vandenberghev commented 2 years ago

I don't have the original yaml anymore, but I believe I first tried something like:

 custom7kWh:
   name: Fake 7kWh Battery
   import_sensor: sensor.xxx
   export_sensor: sensor.yyy
   size_kwh: 7.0
   max_discharge_rate_kw: 3.0
   max_charge_rate_kw: 3.0
   efficiency: 0.9
 custom10kWh:
   name: Fake 10kWh Battery
   import_sensor: sensor.xxx
   export_sensor: sensor.yyy
   size_kwh: 10.0
   max_discharge_rate_kw: 3.0
   max_charge_rate_kw: 3.0
   efficiency: 0.9

Etc. But those did not get picked up by HASS at all, so I changed the entries to:

 custom:
   name: Fake 7kWh Battery
   ...
 custom:
   name: Fake 10kWh Battery
   ...

And only the last one got picked up by HASS.

hif2k1 commented 2 years ago

Ok, thanks for posting this. The first snippet is the correct layout, but you've used capital letters in the key: "custom10kWh". Try changing it to "custom_ten_kwh" or something like that with only lower case. In the second you have created multiple batteries with the key: custom so the last one will overwrite the previous ones. Hope this works.

Alternatively you can create batteries in the UI which is the way home assistant wants us to go in the future. If you go to settings > Devices and Services > Add Integration and then search for battery sim.

vandenberghev commented 2 years ago

Yeah, it appears Home Assistant just did not like the caps in the YAML keys... I tried again with all lower case, that seems to work 👍 Thanks for the help.