davidusb-geek / emhass

emhass: Energy Management for Home Assistant, is a Python module designed to optimize your home energy interfacing with Home Assistant.
MIT License
260 stars 51 forks source link

Option to specify Unit of Measure for var_PV and var_load #252

Closed BJReplay closed 2 months ago

BJReplay commented 2 months ago

Describe the bug Not strictly speaking a bug, but the template provides hints of things to provide to document the issue, so I'm using the bug report template.

I have existing data (approximately 16 months) for load and solar production in kW (and kWh).

I can (and have) set up template sensors to convert kW to W, but they only have data from the moment that I set them up an hour or so ago this afternoon while setting up EMHASS.

The issue is that if I want to (and I do want to) use the machine learning forecaster module, there is no way (that I can see) of training it on my historical data.

To Reproduce Steps to reproduce the behavior

Expected behavior

For example:

# Configuration file for EMHASS
retrieve_hass_conf:
   freq: 30 # The time step to resample retrieved data from hass in minutes
   days_to_retrieve: 365 # We will retrieve data from now and up to days_to_retrieve days
   var_PV: 'sensor.blah_s_powerwall_solar_power' # Photovoltaic produced power sensor 
   var_PV_UoM: kW
   var_load: 'sensor.blah_s_powerwall_load_power' # Household power consumption sensor (deferrable loads should be substracted) 
   var_load_UoM: kW

Screenshots Base Sensor in kW image

New Sensor in W - only shows data from point it was created: image

History Chart showing current month showing source data and template sensor: image

Template Sensor Definition image

List of load related entities (including templated sensor) image

Home Assistant installation type

Your hardware

EMHASS installation type

Additional context Add any other context about the problem here.

davidusb-geek commented 2 months ago

Addressed an answer to this here #251