This work !
So I can to read in Home Assistant voltage from NTC sensor !
Now, I want to transduce voltage in temperature by this formula (in Arduino code):
I’m sorry but i don’t understand…I would make a function in Home Assistant. This function will have constants e calculus like arduino code.
How i Can to do ?
Is it possible to make a python function to call in configuration.yaml ?
I loadded firmata in Arduino.
I can to read voltage with this configuration.yaml
# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:
firmata:
- serial_port: /dev/serial/by-id/usb-Arduino__www.arduino.cc__0043_85037313835351415100-if00
serial_baud_rate: 57600
sensors:
- name: ntc
pin: A0
pin_mode: ANALOG
differential: 5
template:
sensor:
- name: Temperatura NTC
state: "{{ (states('sensor.my_sensor')) | float * 2 }}"
unit_of_measurement: '°C'
# Text to speech
tts:
- platform: google_translate
group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
Now, I must to tranduce voltage in temperature, with mathematical function, like in Arduino code.
I have tried to use template, but is more complicated because I have any constants in mathematical formula.
I need a function. Can i to use python code to transduce voltage in temperature ?