Thanks! Can’t understand why I missed the home assistant sensor.
Seems to be working fine. I can set the state in HA and I see that the value is read by the esp.
Now I guess I have to write a custom spi device https://esphome.io/custom/spi.html
Should it be included with:
esphome:
includes:
- my_custom_spi_device.h
How can I use the state value in the custom spi code?
I have a arduino sketch like this. I can set any value between 1-255 and it works.
#include <SPI.h>
byte address = 0x00;
int CS= D8;
void setup()
{
pinMode (CS, OUTPUT);
SPI.begin();
digitalPotWrite(150)
}
void loop()
{
}
int digitalPotWrite(int value)
{
digitalWrite(CS, LOW);
SPI.transfer(address);
SPI.transfer(value);
digitalWrite(CS, HIGH);
}
How can I rewrite this for esphome and replace the value “150” with the value from home assistant?
I know that I have to recalculate the temperature to a proper wiper value between 1-255 but first I need to find out how to get the custom spi component to work.
BR/Nicklas