I am developing a heater controller and the end goal is to set a numeric state helper to a value
based on an interpolated value from a table.
Is there any easy way of defining a table in home assistant and then picking a value from that based on a sensor value?
I have seen the file sensor
It is not exactly what I want… but I am thinking about something like this (not interpolation just taking closest value)
sensor:
- platform: file
name: Percentage
file_path: /home/user/.homeassistant/sensor.json
value_template: '{{value_json[min(value_json, key=lambda a:abs(a-the_independent_variable))] }}'
unit_of_measurement: "%"
but could I use the “the_independent_variable” in the file sensor definition like this?
json is looking something like this:
{1:23,2:27,4:35, 9:42, 25:65}
Please tell me that there must be a better way?