Can't convert 'X.X' to binary state!

Hi. I’m trying to display on the LCD screen the values ​​from the temperature sensor, which works with another esp board.

After going through a bunch of information I realized that it is done somehow like this…

binary_sensor:
  - platform: homeassistant
    id: tempstate
    entity_id: sensor.esp_temp2_2_bmp280
    internal: true
display:
  - platform: lcd_pcf8574
    dimensions: 16x2
    address: 0x27
    id: mydisplay
    lambda: |-
      it.strftime(0, 0, "%H:%M %d.%m.%Y", id(my_time).now());
      it.printf(0, 1, "%.1f", id(tempstate).state);

But when I compile I get the message (not always, it can compile without errors)

warning: format '%f' expects argument of type 'double', but argument 5 has type 'int' [-Wformat=]

And then I see the following in the log:

[W][homeassistant.binary_sensor:017]: Can't convert '2.2' to binary state!

And the place of the value I see only 0.0

This is a temperature sensor: not a

Binary sensors only have two states, on and off.

Try this:

sensor:
  - platform: homeassistant
    id: tempstate
    entity_id: sensor.esp_temp2_2_bmp280
    internal: true

thanks, that helped

1 Like