Howto write float sensor state to uart

I found a solution myself

  on_value:
    - uart.write: !lambda  
                      char buf[128];
                      sprintf(buf, "Temperature: %.1f degrees \n", id(temperature).state);
                      std::string s = buf;
                      return std::vector<unsigned char>( s.begin(), s.end() );
5 Likes