Display status from external sensor and converts it to circle

Hi guys,
I’m using a text_sensor:

text_sensor:

  • platform: mqtt_subscribe
    name: “Data from topic”
    id: mysensor
    topic: stat/luce_allarme_casetta/POWER

to get the status of a switch and I can display this status as ON or OFF using this:

it.printf(90, 40, id(my_font), “Status: %s”, id(mysensor).state.c_str());

Instead to see ON or OFF I would like to show a circle filled or not using something like:

  if (id(mysensor).state.c_str() == "ON") {
    it.filled_circle(90, 55, 5);
  } else {
    it.circle(90, 55, 5);
  }

of course doesn’t work… could someone help me to use the right syntass?

Oh the joy of C-style strings :grin:

if (id(mysensor).state == "ON") {
    it.filled_circle(90, 55, 5);
  } else {
    it.circle(90, 55, 5);
  }

Super! Thank you

I’m stuck again, could you help me please:
I would like to set the temperature using an input_number configured as below:

tsetoffice:
name: Tset
icon: mdi:temperature-celsius
initial: 20
min: 18
max: 21
step: 0.1

How can I show it on the display?
Using text_sensor and platform: mqtt_subscribe?

thank you!

yes using a text sensor and outputting the data on the HA side with an MQTT automation.