How to convert a numeric sensor to on off

How can I copy a sensor with a numerical value into a new sensor, but if the numerical value is greater than 0, the new sensor should be ON if the numerical value = 0, the sensor should be OFF.

Thank you

Hi @Torte

Please take a look at the Threshold Sensor

1 Like

Looks like simple binary_sensor:

  - platform: template
    id: ZZZ
    name: 'ZZZ'
    publish_initial_state: True
    lambda: return (id(XXX).state > 0);

Can write in lambda whatever You want, like check if state exists ever (id(XXX).has_state()).

Thank you, works perfect.
i searched about an hour but that was easy :slight_smile: