Help with project for Firewood Calculation

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.
20

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. :smiley:
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 :frowning:

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 :wink:
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?

According to this, I cant merge the two lines created. I have to do it manually.

Nevermind, I will get over it :smiley:

Now, I want to have a trend sensor sampling the kitchen thermometer. I want to detect if the fireplace is warming the house or not. The purpose of this is to automatically turn off the ā€œfireplace booleanā€, so HA will know that the fireplace is off.
To elaborate, we usually feed some firewood before we go to bed, so the fireplace will stay on for a couple of hours. That means that the fireplace will turn off at sometime at night, so I cant really press a button in HA to change the state of the fireplace. It has to be automatically done.
So, I thought a trend sensor would do the job.
The problem is that the kitchen thermometer is having ups and downs:
20
How would I correctly configure the trend sensor? Or is maybe another way to know if the fireplace is on, or off? At this point, I would like to mention, that wiring the fireplace with temp sensors, is a no-go for now. Maybe in the future.

Sorry somehow missed your other question. I would spool all the data together until I get one line, then output with comma separated values.

As for trend, youā€™d want to build the sensor just like the bottom example. You need to choose a gradient that you want to use. So, how many degrees is this going to drop over an hour? Take that number divide it by 3600 (number of seconds in an hour) and use that as the gradient. Then set your samples to the number of hours you want to use *3600.

I fixed the trend, and it looks like it is working properly. Thank you for the info. It just needs some tweaking.

Now another problem I have is with the statistics sensor.

- platform: statistics
  entity_id: sensor.kitchen_temperature
  name: stat_kitchen
  max_age:
    hours: 20

The max value of the statistics sensor says it is 18.5 degrees:

While the thermometer says the max was 19.6:
20

What is wrong here?

itā€™s probably related to your sample size. I havenā€™t fully dove into that component ever, so iā€™d just have to consult the docs

1 Like

I am using this project for over a month now and it looks like it works fine. I am not sure if it is completed yet, but time will tel.
I have a tablet near the fireplace, where I enter the weight of the firewood, and I have this button to add to the total firewood used for the day.
The problem is that sometimes this button is pressed twice accidentally and adds more firewood than it was supposed to add. Is there any solution to that? Maybe an undo button, or something like to make sure it wont add more than once per time?
For now, I have to enter the states and edit the value manually.

Use the button-card with the confirmation option. Press once, confirm yes.

1 Like

What? I 've never seen this before! Thank you once again!
Is the confirmation option new(ish), or am I just blind?

Pretty sure itā€™s new. Last few versions or so.