Closed Roving-Ronin closed 10 months ago
One other thing I forgot, the 'Cost' meters that are auto generated also need to have a default number of decimal places added into the integration. Finding that by default they are being created with 17 decimal places (i.e. 0.30109860000017600 ) instead of 2 / 0.00.
Hello @Roving-Ronin,
template_sensor
in between:
template:
- sensor:
- name: Electricity Export Rate
state: "{{ states('input_number.electricity_export_rate') }}"
unit_of_measurement: USD/kWh
device_class: monetary
You can take a look at the configuration I use for testing purpose: https://github.com/zeronounours/HA-custom-component-energy-meter/blob/main/tests/server/includes/package.yaml
For instance, here is my configuration:
# configuration.yaml
energy_meter:
heating_daily_energy:
source: sensor.all_heating_energy
price_entity: sensor.energy_price_real_value_usd_kwh
cycle: daily
tariffs:
- day
- night
# dashboard
cards:
- type: entities
title: Energy usage
entities:
- type: custom:energy-entity-row
entity: sensor.all_heating_energy
name: Heaters consumption
- type: custom:energy-entity-row
entity: sensor.heaters_energy_energy_price_real_value_usd_kwh_cost
name: Heaters cost
- type: 'custom:fold-entity-row'
head:
label: Tariff details
type: section
padding: 0
entities:
- type: custom:energy-entity-row
entity: sensor.heaters_daily_energy_day
name: Heaters (Day)
- type: custom:energy-entity-row
entity: sensor.heaters_daily_energy_night
name: Heaters (Night)
- type: custom:energy-entity-row
entity: sensor.all_heating_energy
name: Heaters (Total)
I can add an option to also create a template sensor which would add them all.
I'll answer your following questions later (I don't have enough time right now)
I'll update documentation with your example to change tariff.
For now, I'll leave this integration as HACS default integration. I doubt it might be integrated within HA core as its only a kind of wrapper around builtin components.
If this integration becomes popular, I might reconsider it.
Hi @zeronounours,
Could you please confirm a few configuration issues?
1) If using the 'price_entity' option, is it supposed to support using an input or only a sensor ? i.e. Using the following configuration, attempting to call an input into which I can enter the current electricity per kWh export rate, it remains at $0.00, when the inverters/meter are counting exports.
I note though if I use 'price: 0.07' instead of calling the input_number, it works.
2) When using the tariffs option, the integration automatically creates sensors for each tariff. i.e. energy_meter_imported_daily will create 3 sensors to track the kWh, for example:
and 3 more sensors, to track the cost, for example:
But there is no sensor that shows the total kWh and cost of the above 3 sets of sensors. i.e. If you wanted to see the total kWh or cost$ for imported power for the day/month/year, you would have to manually add up the peak+shoulder+offpeak (kWh or Cost$ sensors) for that period. Is this the correct function of your integration? If so, is there a way to add amend it so using tariffs will still give a 'sum of all tarrif sensors' sensor?
3) I note that your integration, when using tariffs, also creates 'select' entities that need to be updated to tell the energy_meter sensors if/when a tariff has changed between peak/shoulder/offpeak for instance. If these select entities are not updated you end up with only the first tariff defined being activated and the being the only sensors counting kWh or cost$ for a tarrif period.
For newer users of HA, it would be worth including documentation explaining that users with tariffs will need to include an automation that (assuming the tariffs are based upon time periods) will check the time and then update the select entity to the correct peak/shoulder/offpeak tariff.
For example, using these energy_meters:
Would require the following automation to be added, to update based upon the following tariff periods:
4) Will you be seeking to have this energy_meter included in HA as a 'default' sensor/option, same as utility_meter currently is ?
Thanks.