Closed MisterTFM closed 2 years ago
Hi, the gas cost has been working for me since 2022.9.1. One thing that I noticed was different between my cost entity and yours was that I have "unit_of_measurement: $/ft³" vs your "unit_of_measurement: USD/ft³". Not sure if it is the issue but might be worth trying if you haven't already.
I created an input_number with the same attributes as above, waiting a few hours to see if it works to compute gas cost.
Also noted when trying to use a static cost and entity cost, it still expects price per cubic meters:
After several hours, still no Gas Consumption cost being displayed:
@MisterTFM Please share the state + attributes of the following entities from the states developer tool:
@MisterTFM please share a log with the settings below which shows what happens when there are at least 3 updates of the gas consumption sensor.
logger:
default: warning
logs:
homeassistant.core: debug
@MisterTFM Please share the state + attributes of the following entities from the states developer tool:
- The gas sensor
- The price entity
- The auto generated cost sensor
Gas Sensor:
Price Entity:
Not sure what you mean by "auto generated cost sensor" ??
Also noted when trying to use a static cost and entity cost, it still expects price per cubic meters
Thanks for bringing that up, it's fixed in https://github.com/home-assistant/frontend/pull/13824
Not sure what you mean by "auto generated cost sensor"
When you enable cost calculation for gas or electricity, that's managed by a sensor which is automatically created by Home Assistant. That sensor should get the entity_id of your gas consumption sensor, suffixed with _cost
, so sensor.gas_energy_from_utility_meter_cu_feet_cost
.
sensor.gas_energy_from_utility_meter_cu_feet_cost
There is no entity with "_cost" when viewing in Developers Tools:
I have the Energy card configured as:
Gas Cost entity:
@MisterTFM please share a log with the settings below which shows what happens when there are at least 3 updates of the gas consumption sensor.
logger: default: warning logs: homeassistant.core: debug
Haven't seen any references or Errors when viewing logs in regards to gas consumption.
Haven't seen any references or Errors when viewing logs
Right, so please enable debug log as requested and share a log which shows what happens when your gas sensor is updated
You can contact me on discord, emontnemery#6618, if you don't want to share the log here.
There is no entity with "_cost" when viewing in Developers Tools
Did you search only exactly for sensor.gas_energy_from_utility_meter_cu_feet_cost
or did you try something more fuzzy; maybe just search for "energy" and for "cost".
Do you have any custom components installed? If you do, could you please disable them just to make sure they're not interfering?
Please also share the file .storage/energy
Haven't seen any references or Errors when viewing logs
Right, so please enable debug log as requested and share a log which shows what happens when your gas sensor is updated
You can contact me on discord, emontnemery#6618, if you don't want to share the log here.
This log was cleared when I rebooted this morning around 9:00 am: Home Assistant Core - Log - 9-21-2022.txt
This graph from the energy card showing Gas Consumption and when it occurs:
There is no entity with "_cost" when viewing in Developers Tools
Did you search only exactly for
sensor.gas_energy_from_utility_meter_cu_feet_cost
or did you try something more fuzzy; maybe just search for "energy" and for "cost".
I searched on "energy", "cost" and "gas" and combinations, and see no auto generated entities in reference to "sensor.gas_energy_from_utility_meter_cu_feet_cost"
Please also share the file
.storage/energy
energy-9-21-2022.txt
Do you have any custom components installed? If you do, could you please disable them just to make sure they're not interfering?
How can I disable any "custom_components" ?
Thanks for sharing .storage/energy
, I think the mystery is solved now and a workaround is to manually edit it.
In the file, there's this section:
{
"type": "gas",
"stat_energy_from": "sensor.gas_energy_from_utility_meter_cu_feet",
"stat_cost": null,
"entity_energy_from": null,
"entity_energy_price": "input_number.gas_cost",
"number_energy_price": null
}
Cost tracking should work if you change it like this:
{
"type": "gas",
"stat_energy_from": "sensor.gas_energy_from_utility_meter_cu_feet",
"stat_cost": null,
"entity_energy_from": "sensor.gas_energy_from_utility_meter_cu_feet",
"entity_energy_price": "input_number.gas_cost",
"number_energy_price": null
}
After the edit, restart Home Assistant.
Note: Please be careful when editing the file, make a backup copy of it before editing.
Instead of manually editing the file, try removing the gas consumption item:
Then add it again, with the same settings. The .storage/energy
should now be as expected and cost tracking should work.
I first tried deleting the gas consumption entity, then added it again and entered a static price, then rebooted HA:
{ "type": "gas", "stat_energy_from": "sensor.gas_energy_from_utility_meter_cu_feet", "stat_cost": null, "entity_energy_from": "sensor.gas_energy_from_utility_meter_cu_feet", "entity_energy_price": null, "number_energy_price": 0.025 }
Gas Consumption Cost is now calculated correctly !!!!!!!!!!!!!!!!!!!
NEXT, I will try using an entity that contains the Gas Cost:
{
"type": "gas",
"stat_energy_from": "sensor.gas_energy_from_utility_meter_cu_feet",
"stat_cost": null,
"entity_energy_from": "sensor.gas_energy_from_utility_meter_cu_feet",
"entity_energy_price": "sensor.calculated_gas_cu_ft_cost",
"number_energy_price": null
}
Will have to wait an hour before gas consumption is registered again on graph, will report back findings. My goal is to use a entity that has a calculated cost from my paper gas bill.
###################################################
So, any explanation as to why the energy.txt file format was wrong, and how will 2022.9.X updates correct this in the future?
Gas Consumption cost being calculated now using an "entity with current price".
@emontnemery Thanks for all your help !!!!!!!!!!!!
The problem
Upgraded HA to 2022.9.4, set an entity with current price (USD\ FT³), but Energy Card does not show calculated cost.
Accumulated Gas Use is correctly display in Energy Dashboard.
Gas Consumption Sensor has the following attributes: state_class: total_increasing unit_of_measurement: ft³ device_class: gas icon: mdi:fire friendly_name: Gas Energy from Utility Meter Cubic Feet
Entity with Current Price has the following attributes: unit_of_measurement: USD/ft³ device_class: monetary icon: mdi:fire friendly_name: Calculated Gas cu-ft Cost
What version of Home Assistant Core has the issue?
2022.9.4
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant OS
Integration causing the issue
Energy Card
Link to integration documentation on our website
No response
Diagnostics information
No response
Example YAML snippet
No response
Anything in the logs that might be useful for us?
No response
Additional information
No response