davidusb-geek / emhass

emhass: Energy Management for Home Assistant, is a Python module designed to optimize your home energy interfacing with Home Assistant.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Option to specify Unit of Measure for var_PV and var_load

BJReplay opened this issue · comments

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

  • Create a template sensor based off the native kW sensor that converts the reading (load or PV production) from kW to Watts as required by EMHASS

Expected behavior

  • Ideally the history of the kW sensor would be available for EMHASS to use, but that's not the way HA works.
  • If EMHASS allowed you to specify the Unit of Measure for var_PV and var_load where existing sensors were in kW, it would avoid this issue.

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

  • Home Assistant Core

Your hardware

  • OS: Linux (Ubuntu)

EMHASS installation type

  • Docker

Additional context
Add any other context about the problem here.

Addressed an answer to this here #251