Virtual ON/OFF switch to select wire-pilot mode

Hi all,

I’m new to HA… I’m stuck with something probably very easy.

I have Qubino wire-pilot modules (recognized as lamps with dimmer but this is normal and it works). The 6 orders are wired to digital values 20 => Frost protection, 40 => ECO, 255 => Comfort, etc.

I would like to use them in a thermostat but the thermostat only takes the ON / OFF switches.

My question is therefore the following: how to create an ON / OFF “virtual switch” (used in the thermostat) which behaves as ON => 255 (comfort mode) and OFF => 20 (frost protection mode)?

To be perhaps a little clearer: it’s like wanting to change the brightness of a bulb with a virtual two-state switch. Switch OFF => brightness at 20%, switch at ON => brightness at 100%.

Sorry for my bad english. Thx for your help.

Problem solved with :

And :

climate:
  - platform: qubino_wire_pilot
    name: zmnhjd1_light_converter_salle_de_bain
    heater: light.zwave_controleur_fil_pilote_salle_de_bain
 - platform: generic_thermostat
    name: thermostat_salle_de_bain
    heater: switch.switch_radiateur_salle_de_bain

switch:
  - platform: template
    switches:
      switch_radiateur_salle_de_bain:
        turn_on:
          - service: climate.set_preset_mode
            target:
              entity_id: climate.zmnhjd1_light_converter_salle_de_bain
            data:
              preset_mode: "comfort"
        turn_off:
          - service: climate.set_preset_mode
            target:
              entity_id: climate.zmnhjd1_light_converter_salle_de_bain
            data:
              preset_mode: "off"

I can now use this switch with the generic_thermostat.