Hi All,
I have an MQTT gas sensor and I cannot figure out how to have it recognized as a Gas source.
This is what I currently have:
utility_meter:
hourly_gas_usage:
source: sensor.gas_usage_m3
cycle: hourly
daily_gas_usage:
source: sensor.gas_usage_m3
cycle: daily
monthly_gas_usage:
source: sensor.gas_usage_m3
cycle: monthly
sensor gas_usage_m3:
platform: mqtt
state_topic: "readings/9854595/meter_reading"
name: gas_usage_m3
unit_of_measurement: "m³"
device_class: gas
What do I need to change for this to work? I’ve tried all of the solutions I found via searching.
davenaum
(Davenaum)
September 8, 2021, 1:09am
2
I’m trying to figure out the exact same thing using an mqtt based meter reading. Also, assuming we can get these sensors to show up as options, which is best to use, the daily, monthly, current reading?
dgaust
(dgaust)
September 8, 2021, 1:29am
3
Have you added state_class: total_increasing to sensor gas_usage_m3?
davenaum
(Davenaum)
September 8, 2021, 1:56am
4
I just tried adding:
state_class: total_increasing
to my m3 sensor and it’s still not showing up as an option in the Energy Dashboard configuration.
My full sensor config looks like the following (note my meter reads in cubic feet, hence the conversion to m3)
- platform: mqtt
name: gas_meter_m3
unit_of_measurement: "m³"
state_topic: '/rtlamr/101180292/meter_reading'
value_template: '{{ ((value_json.meter_value | float) * 2.8316846592) / 100 }}'
device_class: gas
state_class: total_increasing
Adding “state_class: total_increasing” did not work for me either.
Current reading I believe.
This is my latest attempt but still not recognized as a gas source:
utility_meter:
hourly_gas_usage:
source: sensor.gas_meter
cycle: hourly
daily_gas_usage:
source: sensor.gas_meter
cycle: daily
monthly_gas_usage:
source: sensor.gas_meter
cycle: monthly
sensor gas_meter:
platform: mqtt
name: gas_meter
state_topic: "readings/9854595/meter_reading"
unit_of_measurement: 'm³'
device_class: 'gas'
state_class: total_increasing
I’m out of ideas at this point.
Hi guys,
Out of curiosity which HW are you using?
Looking for something like that
davenaum
(Davenaum)
October 3, 2021, 8:15pm
8
ToS
October 8, 2021, 11:56am
9
I have the same issue’s:
In my sensors.yaml I have this:
- platform: mqtt
name: P1 Gas Usage
unit_of_measurement: 'm³'
state_topic: "sensors/power/p1meter/gas_meter_m³"
value_template: "{{ value|float / 1000 }}"
#device_class: gas
device_class: energy
#state_class: measurement
state_class: total_increasing
icon: mdi:gas-cylinder
But the sensor is not visual in Energy:
But as a sensor entity its is visual with values in the graphic, but not any more as value:
What do I mis or must do to get the sensor working in Energy?
And why is the value unknown but the grapic shows values?
===========================
After several hours, put a backup back and now it’s working strainge
I ran into the same issue. Did anyone find a solution?
wmaker
(Tommy Long)
April 8, 2022, 4:26pm
11
Here is a config that works for me (Note: multiply(1) can be ignored):
- platform: mqtt
unique_id: "15066054" #rng 1-100M
name: Gas Meter
icon: mdi:gauge
state_topic: "gasmeter/outside/value"
unit_of_measurement: 'ft³' #Actual is ccf, but ccf not available in HA.
device_class: 'gas'
state_class: 'total_increasing' #value monotonically increasing
value_template: " {{ ( value | multiply(1)) | round (2) }}"
hareeshmu
(Hareesh M U)
April 27, 2022, 7:33am
12
A template sensor like below may help.
template:
- sensor:
- name: gas_consumption_m3
unique_id: gas_consumption_m3_uid
unit_of_measurement: "m³"
state_class: total_increasing
device_class: gas
state: >
{{ (states('sensor.GAS_SENSOR_ENTITY') | float }}
attributes:
last_reset: "1970-01-01T00:00:00+00:00"
You want to include a value in an energy panel. Energy is given in kWh, but m³ is a volume. You even pay for kWh, not for m³. Unfortunately the m³/kWh ratio changes depending on the delivered natural gas, but roughly calculated you get 10 kWh from 1 m³.
For me it was a factor of 10.909971 in January 2021, 10.931289 from February to September and 10.954545 from September to December.