Compare value from HA sensor

I’ve a sensor sending me a power value, eg 1024.3 from home assistant:

  - platform: homeassistant
    name: "ESP PV Power summe float"
    entity_id: sensor.pv_power_summe_int
    id: PV_Power_summe_float

When I try to work with it like

      if (id(PV_Power_summe_float) > 2000) {
        it.printf(2, 112, id(font3), green, TextAlign::TOP_LEFT, "High");        
      } else {
        it.printf(2, 112, id(font3), red, TextAlign::TOP_LEFT, "low");        

I receive error while compiling:

ISO C++ forbids comparison between pointer and integer [-fpermissive]

As working with binary and .state is pretty easy I would have assumed something similar, but unfortunately I’ve got stucked here.

Add .state to the if statement

 if (id(PV_Power_summe_float).state > 2000) {

Thanks Jos, that worked. I have testet .state somewhere in the past, looks like I had a typo :thinking: