hif2k1 / battery_sim

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

Use statistics sensors that are not created by recorder integration #101

Closed marcin478 closed 11 months ago

marcin478 commented 11 months ago

I'm using Tauron-AMIplus Home Assistant integration for Energy dashboard. This integration provides hourly statistics for consumed and generated energy. Unfortunately those sensors are not visible in the Battery Simulation integration as import/export sensor/meter.

I assume this is because Statistic ID name is different:

Name Statistic id Statistics unit Source Issue
Tauron AMIplus 123322415500468123 consumption tauron_importer:123322415500468123_consumption kWh tauron_importer No issue
Tauron AMIplus 123322415500468123 generation tauron_importer:123322415500468123_generation kWh tauron_importer No issue

Those statistics can be used by Statistics Graph card or Energy dashboard, but not in the Battery Simulation: User input malformed: Entity tauron_importer:123322415500468123_consumption is neither a valid entity ID nor a valid UUID for dictionary value @ data['import_sensor']

marcin478 commented 11 months ago

After further analysis I noticed that those sensors does not have any State or Attributes and that is why they do not match with the sensor rule EntitySelector(EntitySelectorConfig(device_class=SensorDeviceClass.ENERGY)).

They are not created by sensors but directly imported into Statistics by Taurin-AMIplus integration.

hif2k1 commented 11 months ago

Ah, yes that is an issue. You can still use the YAML setup in your home assistant config as that doesn't limit the sensors you can select. Alternatively you could use the GUI (graphical) setup that you have been trying to use and select any other sensor that shows up and then edit the conig file afterwards. It's called core.configentries and is in the hidden .storage directory in your home assistant config directory.

On Mon, 16 Oct 2023 at 20:47, marcin478 @.***> wrote:

After further analysis I noticed that those sensors does not have any State or Attributes and that is why they do not match with the sensor rule EntitySelector(EntitySelectorConfig(device_class=SensorDeviceClass.ENERGY)) .

They are not created by sensors but directly imported into Statistics by Taurin-AMIplus integration.

— Reply to this email directly, view it on GitHub https://github.com/hif2k1/battery_sim/issues/101#issuecomment-1765164706, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFAIZGNS2OQXLFRJ6NQQRDDX7WFM7AVCNFSM6AAAAAA6CV7ZJCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONRVGE3DINZQGY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

marcin478 commented 11 months ago

Thanks for the ideas! Both are good. Initially I was planning to fork the project and remove the constrain in the code.

hif2k1 commented 11 months ago

Ok, sure. I think I'd like to keep it as is in the main branch because for most users it makes setup much easier.

Thanks,

Hamish

On Tue, 17 Oct 2023 at 08:57, marcin478 @.***> wrote:

Thanks for the ideas! Both are good. Initially I was planning to fork the project and remove the constrain in the code.

— Reply to this email directly, view it on GitHub https://github.com/hif2k1/battery_sim/issues/101#issuecomment-1765872703, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFAIZGK52XKSRBZO2FF5VUTX7Y25PAVCNFSM6AAAAAA6CV7ZJCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONRVHA3TENZQGM . You are receiving this because you commented.Message ID: @.***>

marcin478 commented 11 months ago

Unfortunately both options will not work: Invalid config for [battery_sim]: Entity ID tauron_importer:123322415500468123_consumption is an invalid entity ID for dictionary value @ data['battery_sim']['tesla_powerwall']['import_sensor']. Got 'tauron_importer:123322415500468123_consumption' Entity ID tauron_importer:123322415500468123_generation is an invalid entity ID for dictionary value @ data['battery_sim']['tesla_powerwall']['export_sensor']. Got 'tauron_importer:123322415500468123_generation'. (See /config/configuration.yaml, line 35).