Displaying estimated moisture content of hardwood in HA frontend

Hey there HA Community!

First of all I absolutely love the whole Home Assistant project!
I was lucky to be able to play with KNX about 20 years ago and got onto the home automation train pretty early.
After being frustrated seeing the whole home automation industry being more and more enclosed into their own ecosystems I pretty much went out of it.
Now being in my late 30’s I somehow came across Home Assistant and WOW - from here on it all started to make sense again!!

After getting HA running in my private home a couple of months ago and spending days and nights slowly crawling deeper into the rabbithole it was clear to me I also want to implement HA into the little cabinetry wood working business I am running.

So here comes a very specific problem I am working on right now.

When storing wood in a specific environment (basically temperature and rel. humidity related) there is going to arise a specific wood moisture content inside hardwood.

Now there is not a specific formula to calculate the moisture content for hardwood but there is some diagrams that were developed by researchers.
I did the work already using the diagram to create a matrix table to be able to figure out the corresponding wood moisture content depending on the current temperatur in °C and the rel. humidity in %.

My data goes from 10°C to 40°C and from 25% rH to 90% rH in increments of 1.
I picked those boundaries since the climate inside the workshop and storage space is most likely within those values.
So for now there is a total of 31 * 66 = 2046 values for wood moisture content that I can specify from the reading of a temperature sensor and a humidity sensor.

Now the difficult part is how the heck is it possible to have home assistant tell me the corresponding wood moisture content depending on those sensor readings.

I have been going through all possible helpers but since there is no physical formula that I could use to calculate the moisture content I will need a solution that is able to read the moisture content value from the matrix table I can provide.

So, I wonder if there is any way to feed my data (2046 values) from the matrix table into home assistant and have HA do the work, picking the right value depending on temp and rH and display it to me (or maybe do automations from there).

I know that must be a somehow weird topic, but I have the feeling HA could be able to do this job and I just need the right hint into the right direction.

For me and my coworkers it would be just amazing to be able to see if the climate is right for our hardwood or if we would need to adjust.

Is there any Ideas what direction I could go to find something getting me there?

thank you already and im looking forward for any inspiration!

Johannes

Something like this:

state: >
  {% set lookup_table =  [[10, 2,3,4, ...,5], 
                          ...
                          [-5, 8, 9, ...42]] %} {# 31 columns by 66 rows #}
  {% set temp = states('sensor.temperature')|int() - 10 %}
  {% set rh = states('sensor.humidity')|int() - 25 %}
  {{ lookup_table[rh][temp] }}

Data entry is going to be fun. Are you sure there is no formula you can generate from the data?

You should constrain your values with the availability template as well:

availability: "{{ states('sensor.temperature')|int(0) >= 10 and states('sensor.humidity')|int(0) >= 25 }}"

A note on the matrix (temp ox x-axis, rh on y-axis):

[ [31 data points], 
  [31 data points],
 ... 
  [31 data points] ]

 # 66 rows in total 

hey tom!

thank you for the hint! since I am not familiar with coding at all it was difficult to be able to google search or forum search for what I needed since I dont know the wording and phrases I should use to find solutions for my issue.

your code-snippet helped a lot!

With your direction, google, chatgpt and excel to create the syntax for all the “rows” I somehow got it working today already!!

Thank you so much! I knew it would be an easy task for HA but I just didnt know where to start looking for a solution!

I’m excited where the “HA rabbit hole” will get me in the upcoming future! :slightly_smiling_face:

1 Like