Hi,
my gas meter is a SamGas Smart Meter which does not allow continuos readin of the optical port, as it only activated when the button for reading the values on the display is pressed, and only for 2 minutes. It also makes transmission at 169MHz with LoRa, 5 per day, but that would mean intercepting them, but I haven’t found any specification for this.
Then I would like to try to estimate the consumption based on the activation time the consumption read on the meter and the boiler specification.
I installed a flow meter (yf s201) at the water inlet of the gas boiler (condensing boiler for hot water production and heating) which correctly measures the water consumption. I also created a binary sensor that records the state of the sensor.
Now, by doing some test with the meter I can get the gas consumption in m³/min. This test is the same one that eating technicians use to estimate the consumption of gas boilers: open all the hot water taps, take the initil reading and after a minute take the second reading.
could it be convenient to take measurements with defined and longer times?
anyway, since this is an estimate, it could be enough… do you think it is a correct system even if approximate?
now the configuration problem: I can’t figure out how to measure the binary sensor activation time , that is the time it is in the ON state and how to the pass it to the integratin tha will calculate the gas consumption .
Coul you give me a starting point?
And of course some advice on wheter it is a method to try or not …
thanks
Sorry but I’m newbie in yaml and homeassistant, i’m an electronics technicians and not a programmer , I still have trouble understanding how yaml and HA works!
So please if you can try to guide me…
this is the part of esphome file with duty time:
I writed this because without I have and errore during compiling but I don’t know if Is correct…
#DutyTime
- platform: duty_time
id: my_gas_sensor_work_time
name: Gas Sensor Work Time
lambda: "if(id(binary_sensor_flow_meter_onoff).state == true){ return id(my_gas_sensor_work_time);}"
# Restore (optional, default: False)
restore: false
last_time:
name: gas sensor last_time turn on
I started like this and now I can see a diagnostic sensor with the time running during hot water usage and updated every 60 sec, but there’s a problem with of statement.
I’ve tested " == on “, " == ‘on’” , " == true", “== 1” but I receive Always the update of the time every 60 sec as if statement is not present, if I write
return id(my_gas_sensor_work_time);
without the if
what I would like to do is to have an instantaneous value of the time spent actively so that I can then use it in a calculation to measure the gas consumed. Knowing the m³/min consumption of the boiler during the production of hot water, I can estimate how much I am consuming.
I guess the solution is simple but I really don’t know yaml. I wrote a lot in Arduino language (and I had fun ) on esp and something in python, but here the basics are missing … I’ll learn
Thanks for any help
yf s201 is a sensor of esp32 with esphome , but I have create a binary sensor with HA GUI , not directly in esphome file ( I guess you’re referring to
platform: homeassistant
.....
)
so can i remove the lambda? i thought i had to use it because i will need it in the future to be able to skim the measurement. probably my reasoning of how sensors, actions, helpers, etc are used is wrong
I read now that it is not really a binary sensor, even though its entity_id is " binary_sensor.flowmeteronoff" and with this setting I get the “on” and “off” states
Ok, now it’s working
I created a binary sensor in esphome .yaml file and use the new id in duty_time platform. Now I see the total sensor up time and last time turn on