Input_slider, switch and rf433

Hi everybodie !

I’m beggining with HA and I have some trouble with a simple (?) fonction…

For my swimming pool, I want to put an input_slider from 1 to 10 who configure the pump operating time. That, it’s okay. I make an input_boolean who stock status of the pump, that it’s okay too. But now, I went when I turn on my switch, it read the value from input_slider and switch off after this period. After that, I use Raspberry PI RF switch to switch on/off a remote power socket.

I sought from template but I don’t know if I can use this for my problem…

Someone could help me ? (Sorry for my english…)

Suggest you post the underlying code used to create the switch and whatever automation code is being used so someone can help you trace the issue.

Thank you for your reply.

I have made some change but nothing work…

Here is a part of my configuration.yaml:

input_slider:
  pompeheure:
    name: Temps pompe piscine
    initial: 3
    min: 0
    max: 12
    step: 1

Here a part of my switchs.yaml:

- platform: rpi_rf
  gpio: 17
  switches:
    pompe:
      code_on: 4462019
      code_off: 4462028
      pulselength: 186

My sensors.yaml:

- platform: template
  sensors:
    temps_pompe:
      friendly_name: 'Duree'
      unit_of_measurement: "heures"
      value_template: '{{ states.input_slider.pompeheure.state }}'

My groups.yaml:

Piscine:
  - sensor.temps_pompe
  - input_slider.pompeheure
  - switch.pompe

And to finish, my automations.yaml. I’ve tried this one :

- alias: 'Pump Off after x hours'
  trigger:
    platforme: state
    entity_id: switch.pompe
    from: 'off'
    to: 'on'
    for:
      hours: state.input_slider.pompeheure.state
  action:
    service: switch.turn_off
    entity_id: switch.pompe

And this one :

- alias: 'Pump Off after x hours'
  trigger:
    platforme: state
    entity_id: switch.pompe
 condition:
    - condition: template
      value_template: '{{ trigger.for > state.input_slider.pompeheure.state and state($
  action:
    service: switch.turn_off
    data:
      entity_id: switch.pompe

But my swith.pompe don’t turn_off after input_slider.pompeheure hours…

Could you help me please ?

Im also interested in this. Have been trying to get input_sliders to work together with a switch for quite some time

Hi !

I’m not at home, so I can’t send you my code. I’ve changed to some input_select with this post :