Sure. Under the energy_sources
array, I put this:
{
"type": "gas",
"stat_energy_from": "sensor.gas_meter_rtl",
"entity_energy_price": null,
"number_energy_price": null,
"stat_cost": null
}
I’m avoiding adding prices yet until I know the UI will properly match and recognize $/ft3 rather than $/m3
This is my sensor
coming from my cheap software defined radio picking up the gas meter using hertzg/rtl_433 based on merbanan/rtl_433.
- platform: mqtt
state_topic: rtl_433/SCM_/12345678
name: "Gas Meter"
unique_id: gas_meter_rtl
unit_of_measurement: ft³
device_class: gas
state_class: total_increasing
value_template: "{{ value_json.Consumption }}"
json_attributes_template: "{{ value_json | tojson }}"
json_attributes_topic: rtl_433/SCM_/12345678
My full energy config file
{
"version": 1,
"key": "energy",
"data": {
"energy_sources": [
{
"type": "grid",
"flow_from": [
{
"stat_energy_from": "sensor.energy_meter_main_consumption_daily_energy",
"stat_cost": null,
"entity_energy_from": "sensor.energy_meter_main_consumption_daily_energy",
"entity_energy_price": "sensor.utility_electricity_cost",
"number_energy_price": null
},
{
"stat_energy_from": "sensor.energy_meter_subpanel_total_kwh",
"stat_cost": null,
"entity_energy_from": "sensor.energy_meter_subpanel_total_kwh",
"entity_energy_price": "sensor.utility_electricity_cost",
"number_energy_price": null
}
],
"flow_to": [
{
"stat_energy_to": "sensor.energy_meter_main_return_daily_energy",
"stat_compensation": null,
"entity_energy_to": "sensor.energy_meter_main_return_daily_energy",
"entity_energy_price": "sensor.solar_return_price",
"number_energy_price": null
}
],
"cost_adjustment_day": 0.0
},
{
"type": "gas",
"stat_energy_from": "sensor.gas_meter_rtl",
"entity_energy_price": null,
"number_energy_price": null,
"stat_cost": null
}
],
"device_consumption": []
}
}
My sensor.gas_meter_rtl
is in ft3 so it doesn’t show the correct units in the UI yet.
If you have a problem (like I did) where you changed units on a sensor after you created the sensor, you can either delete the data from the database statistics and long term history using the links below to help:
- Database - Home Assistant
- Long- and short-term statistics | Home Assistant Data Science Portal
Orrrrr, the easier way is to just create a new sensor that always had the correct units to begin with (or else the long term statistics will stop recording).
Here my dashboard is still showing in m3 even though the unit is ft3 and the numbers are in ft3 (just with the wrong units here). But again, this is probably because we’re forcing it into the config when it isn’t ready to support showing ft3.
If I had to speculate, they might add a “gas” units to the config kinda like how they do with “currency” (or they’ll just default to ft3 when using imperial units).
I hope that helps!