How to transfer data from uart

hi all
can someone tell me what is wrong with my code ?

esp dont put values in templates , rawstring is ok
my code:

uart:
  baud_rate: 9600
  tx_pin: GPIO17 
  rx_pin: GPIO16
  debug:
    direction: RX
    dummy_receiver: true
    after:
      delimiter: "\n\r"
    sequence:
      - lambda: |-
          UARTDebug::log_string(direction, bytes);
          std::string str(bytes.begin(), bytes.end());
          id(rawString).publish_state(str.c_str()); 
          float sensors_values0 =0;
          float sensors_values1 =0;
          float sensors_values2 =0;
          if (sscanf(str.c_str(), "%f;%f;%f", &sensors_values0, &sensors_values1, &sensors_values2) == 3 ) {
              id(tempA1).publish_state(sensors_values0);            
              id(tempA2).publish_state(sensors_values1);
              id(tempA3).publish_state(sensors_values2);
          }         

sensor:
  - platform: template
    name: "A1"
    id: "tempA1"
  - platform: template
    name: "A2"
    id: "tempA2"
  - platform: template
    name: "A3"
    id: "tempA3"

thanks

The sscanf format string %f is for base10 numeric floating point values. The first value in your input “AA” can’t be converted. If it is a hexadecimal value then you can use %x.

thank you , it works fine .

does it change a lot if first value in input is “SR”

second problem : how in lambda check if first input is “AA” or “SR”

%s will read in a string. If you only have the two options “AA” or “SR” you could do two sscanf() statements with “AA;%f;%f” and “SR;%f;%f”