Help with project for Firewood Calculation

I am trying to figure out how to do this project, but I am having trouble. I tried some things, but the final result was not what I wanted. If you guys help me out with this, I will put the complete project in Share your Projects category for others to see.

The purpose of the project:
My main heating is a fireplace with a watertank that heats the water every time I start the fire. The water is going through radiators in every room to achieve the maximum heating possible. There is no thermostat (duh), because you cant turn on or off the fire on-demand, unless of course if you stop feeding wood.
I already have an excel that I am writing down some values that will make me understand how I can use the fireplace more efficiently.
What time I started the fire, what was the outside and inside temperature at that time, how many hours was the fireplace on, what was the maximum temperature reached and what was the outside temperature at that time. And most important, how many firewood did I use (in kilos).

What I am trying to do:
I am trying to automate as much info as I can in HA.
I am thinking of a button to indicate I started the fire and automatically record the inside and outside temperature as well as the time.
Then I can have a button with a number dial, that will add the weight of the firewood I put in the fire. That particular thing can happen 5-10 times per day so the numbers can be from 5 to 15 kilos each time and can reach a total of 70, so I need the calculator to add the numbers I enter.
During the day and when the fireplace is on it will record the maximum temperature reached in the house and the current temperature outside.
When the fireplace is off, everything will be recorded into a file (preferably an excel or csv - can it be?) and will reset a new day.

This might look easy for some of you, but I am struggling with this and I would be grateful if you could help me out!
Also, if you have any suggestions regarding my thoughts or my procedures, I am all ears!
Thanks a lot!

This sounds very similar to what Iâ€™m trying to do with my heating system. Mine uses an oil-fired boiler, but there are similarities.

One of my first projects was to take a Visonic MCT-340 Door/Window/Temperature sensor and replace the reed switch with a pair of wires to a relay which closes when the burner fires. The goal was to know how long the burner was actually running (burning fuel) instead of just how long the the thermostat was calling for heat. Obviously that wonâ€™t work for a fireplace, butâ€¦

Hereâ€™s one thing I learned which may help: The MCT-340 also has a temperature sensor. Since itâ€™s down there above the boiler, it gets pretty warm (around 80F, 27C) when the boiler is running, even just in standby mode. I see no reason the same type of thing, without the modification for the burner, wouldnâ€™t work above your fireplace to indicate when thereâ€™s a fire going. Just put it somewhere it wonâ€™t actually burn, like under the mantle if you have one, or on the outside of the fireplace opening. When the temperature is above some value, the fire is lit!

The other part of this project is recording the run-time of the burner and all the heating zones. Similar to what you want to do with your fire duration and wood used measurements. Iâ€™ve got this about half working. I use a history_stats template sensor to keep count of how long each device is running each day. I use an automation to run a file notify to output this to a flat file each day. This process has been running flawlessly for months for my boiler data, and one zone valve, but Iâ€™ve hit a bit of a snag with the other two zone valves. Same code, just doesnâ€™t work. The good news is this is forcing me to re-learn what I did, and actually understand it this time, so at some point Iâ€™ll be able to offer a detailed write-up of how to make it all work.

Iâ€™m not so sure about how to enter the weight of the wood. Or even if weight is what you want. Wood can be wetter or dryer, which Iâ€™d think would affect the weight. As for entering it, I donâ€™t see HA as the best tool for that. Just keeping a spreadsheet on a smart phone, or Google Docs, seems like it would be easier. I havenâ€™t seen any data-entry cards in Lovelace, but maybe itâ€™s there and I donâ€™t know it.

2 Likes

So you have a thermostat on the water tank?

Pretty much you want to get a correlation for degree increase to kiloâ€™s added.

soâ€¦

Youâ€™ll need 1 input_number. For entering kilograms.
Youâ€™ll need 1 counter for the kilograms. Or (more accurate) use the custom variable component and store the kilos.
Youâ€™ll need 1 sensor that tracks the inside temperature. You can track the outside too butâ€¦ why, it doesnâ€™t help for the correlation between the tank/inside temp. Now if itâ€™s different rates of consumption based on the outside temp, then yes, track it. Either way, tracking it wonâ€™t hurt so, you should probably just track it.
Youâ€™ll need 1 automation. This automation stores the sensor temperatures, the current time, and the current amount of killograms used in a single or separate text file. It can all go to the same file or you can make separate files.
Youâ€™ll need 3 scripts:

start script will: reset kilogram counter to zero and turn on the automation.
stop script will: turn off the automation.
add kilogram script will add to the counter/variable.

With all that you should get the data you need, which is:

date/time, inside temp, outside temp, and current ammount of kilograms used.

Between all that you should be able to bring that into excel and build an equation from that to determine how many kilograms you need to use to get the desired result.

Something like this might take months of data, maybe even a yearâ€™s worth of data to get a full understanding of what you need.

2 Likes

@CaptTom That is very informative! Thank you for your time!
I am also using history stat sensors to track temperatures.
Yea, I am already using spreadsheets to track my stats. I thought I would give it a try with HA.

@petro
No I dont have a thermostat in the tank. I think I gave you the wrong idea here. Excuse me for that.
I mean I am tracking the temp in and out of the HOUSE!
I dont pretty much care about correlation, at least for now.
I was using a counter and 2 automations to increase or decrease the counter number (for the weight), but now I think I will try the input number and see how it goes.

What I havent still tried is to write the stats in a file. I will give it a go, today probably.

I am already tracking all the above, but I am doing this manually, so I already have my spreadsheets for 3 years now.

Well, thank you both for your suggestions! I will be back shortly!

I was only saying that because you could get it to a point where home assistant tells you how many logs to put on, when to put them on, and when the temp will reach your target.

1 Like

I never thought of that! That would be pretty awesome! If I make this project work as expected, I think your suggestion will be next!

I am having trouble in a specific calculation and now I am stuck. Please bare with me.

I have the input_numbers but I need a calculation to be done:
During the day I might feed the fireplace ~10 times.
Every time I am picking up wood, I scale them and I know the exact weight of the batch I am gonna throw in the fireplace.
How am I supposed to do that math in HA?
To clarify:

At 13:00 i will throw 15kg and I have to update HA to know how much I threw.
At 16:00 I will probably throw 10kg, but I also have to update HA. This is where I am having trouble. How do I add the total amount I used today?

As I said before, You need a counter or a variable to store the information and add to it as you go. Personally, I think a variable is easier to use. But itâ€™s up to you. You could even just simply have another input_number. All you need to do is take the current value and add to it.

``````service: input_number.set_value
data_template:
entity_id: input_number.current
value: >
{% set current = states('input_number.current') | float %}
{% set add = states('input_number.added') | float %}
{{ current + add }}
``````
1 Like

Done! Thank you once again.

I bumped into a problem:
Having a slider for the input number, is not very convenient in tablets or even worse, mobile phones.
So I have this slider (stepping at 0.1) but to fine tune the numbers I added two buttons to add or subtract points ( I am using automations for that). But it looks like it doesnt work as expected.

Thereâ€™s a version where you can change it into a up down number box that you can type into. Think the property is `mode: box` and you configure it on the input_number itself.

@CaptTom @petro and @argykaraz Great project and well worth tracking all this information.
As I am doing something not unlike this (manual entry of metrics) and your discussion has raised some very interesting issues that had me thinking of some possibilities I would like to askâ€¦is it possible to either have a spreadsheet automatically update to the new value of

ORâ€¦would it be possible to have the input_number update in responce to the change in value of the spreadsheet?

Either way would be useful for both this project and mine to be honest?

Wowâ€¦Imagineâ€¦Automated heating control using a log loader on the fireplace!
Itâ€™s doable I reckon!

UPDATE: @argykaraz do you monitor the water temperature close to the fire?
I think that would be very useful to track?

Cheers and Iâ€™ll be keeping up with this discussion for sure!

Yes, I tried box mode too.
Ok, here is the real problemâ€¦ Itâ€™s the wifeâ€¦ Sorry to say that but it is true.
Having box mode, she will have to click on the textbox, wait for the keypad to pop, type the exact number (she has to use the comma too!) and then click the back button for the keypad to hide, and then press the script button where it will add the number.
But having a slider mode, she has to drag the slider and just press + or - to adjust acordingly.
I dont mind using box mode for me, but for her that would be soooo user unfriendly.
Help me out here Petro! Please

I am now having another problem. I am exporting a csv with all the values that I want.
The thing is, that I will be writing values 2 times per day. Once when I start the fire and once I stop (probably at night), so I want to export the starting temperatures (at start) and total firewood weight (at the end).
When I am exporting, I noticed that the line is changing every time. Is it possible to add values on the same line of the csv? The cells I am adding are empty on the second export.

@wellsy The pump I am using to transfer the water from the tank to the radiators, has a thermometer in the tank. I was thinking to replace that thermometer with my own DIY and integrate it into HA. Not nowâ€¦ But sometime
But I dont see any reason to track the temperature inside the fireplace. Is there any particular reason to do that? Would it help?

Knowing the temperature at the source will give you a good idea of the energy input. That will help with knowing there is enough wood in the fire.

Knowing the water temperature at the radiators would be handy as wellâ€¦input side and output side even better I think?

1 Like

post your config for all your buttons and scripts.

1 Like
Input_number.yaml
``````woodtotal:
min: 0
max: 300
step: 0.1
mode: slider
woodcurrent:
min: 3
max: 40
step: 0.1
mode: slider
``````
Scripts.yaml
``````fire_add_kilos:
sequence:
service: input_number.set_value
data_template:
entity_id: input_number.woodtotal
value: >
{% set current = states('input_number.woodtotal') | float %}
{% set add = states('input_number.woodcurrent') | float %}
{{ current + add -3 }}
``````

The -3 is the weight of the carrybag for the firewood. When I am scaling I just want to enter the number I see and HA will do the math.

Notify.yaml
``````- platform: file
name: fireplace
filename: /home/homeassistant/.homeassistant/www/fireplace.csv
``````
Automations.yaml

These are the automations to add the values in the CSV.

``````- alias: '[FIRE] Record stats fire-on'
trigger:
- platform: state
entity_id: binary_sensor.fireplace
from: 'off'
to: 'on'
condition: []
action:
- service: notify.fireplace
data:
message: "{{states.sensor.date.state}};;{{states.sensor.kitchen_temperature.state|replace('.',',')}};{{states.sensor.office_temperature.state|replace('.',',')}};{{states.sensor.master_temperature.state|replace('.',',')}};{{states.sensor.balcony_temperature.state|replace('.',',')}};;;;{{states.sensor.time.state}}"

- alias: '[FIRE] Record stats fire-off 1'
trigger:
- platform: state
entity_id: binary_sensor.fireplace
from: 'on'
to: 'off'
condition: []
action:
- service: notify.fireplace
data:
message: ";{{states.input_number.woodtotal.state|replace('.',',')}};;;;;{{states.sensor.stat_kitchen.attributes.max_value|replace('.',',')}};{{states.sensor.stat_office.attributes.max_value|replace('.',',')}};{{states.sensor.stat_master.attributes.max_value|replace('.',',')}};;{{states.sensor.time.state}};{{states.sensor.ores_leitourgias_tzakiou.attributes.value|replace('.',',')}}"
- service: input_number.set_value
data:
entity_id: input_number.woodcurrent
value: '3'
- service: input_number.set_value
data:
entity_id: input_number.woodtotal
value: '0'
``````

And these are the Automations for the + and - buttons on the interface

``````- alias: '[FIRE] WOOD add'
trigger: []
condition: []
action:
- service: input_number.increment
entity_id: input_number.woodcurrent

- alias: '[FIRE] WOOD subtract'
trigger: []
condition: []
action:
- service: input_number.decrement
entity_id: input_number.woodcurrent
``````

Thats all I thinkâ€¦ Tell me if I am missing something.

The increments shouldnâ€™t be automations, they should be scripts. And if youâ€™re using a entity_button in lovelace, you donâ€™t even need a script. Just use a single service call.

``````type: entity-button
icon: mdi:plus-circle
tap_action:
action: call-service
service: input_number.increment
service_data:
entity_id: input_number.woodcurrent
``````
``````type: entity-button
icon: mdi:minus-circle
tap_action:
action: call-service
service: input_number.decrement
service_data:
entity_id: input_number.woodcurrent
``````

Other than that, it should all work. Whatâ€™s not working exactly?

1 Like

If you check the screenshot, you can see the number in the slider being 15.29999999999999 when it should be 15.3.
When I add one more point, it becomes 15.39999999999998
The same thing happens when I use the entity_button to call the service

Oh thatâ€™s just epsilon error. Only way to remove that on the card level. If you want, you can make a template sensor that fixes the issue but it wonâ€™t be displayed in the UI the way you want it when using the built in cards. You should probably write up an issue to against lovelace.

1 Like

Ok, I will. I had to make sure it is a bug.
How about my other issue?