Simplest automation connecting a Schedule Helper to a control socket

Hi,
This is going to be my first automation.

  • I have a household water-pump which supplies tank-water to the house when there is water in the tank. It is a bit too noisy to run at night - makes a thump when it starts then makes a pumping noise.

  • I have a ‘TRADFRI control outlet’ which is integrated as an MQTT device. I have this controlling the power to the pump. It is called ‘Water Pump Power Control’. It is working fine.

  • I have made a Schedule Helper which is ‘on’ when I want the pump to be enabled. It is called ‘Water Pump Schedule’. It runs - but controls nothing.

I want to create the simplest Automation which turns the control socket ‘on’ when the schedule is on, and off when the schedule is off.

I can’t find any simple examples of how to build this automation, and very little using Schedule Helpers.

  1. Can this be created in simple for using the Automation GUI?
  2. Is building it in YAML different and/or simpler?

Thanks…

I would personally do 2 automations one to turn the pump on and one to turn it off

If you need help I can send you a screenshot or yaml code

I was wondering about idioms. If I needed to separate on from off - or was it like a binding in zigbee2mqtt?

Is the GUI the direct rendering of the YAML? - If that’s the case, just the YAML would be fine. Otherwise I would be interested in both.

Thanks much :slight_smile:

I will try to replay ASAP but i’m also just new to home assistant :+1:

Thanks - I am hoping the answer will help others too…
Take your time. I’ve got the controls switch hooked to a ‘RODRET wireless dimmer/power switch’ and my dashboard. I’m just CRAVING AUTOMATION!

I also like automations

I tried adding an automation from the device GUI. Will wait for traces…

alias: Water Pump Sheduled on
description: From Schedule Helper power on the pump
trigger:
  - platform: state
    entity_id:
      - schedule.water_pump_schedule
    attribute: next_event
    from: "off"
    to: "on"
condition: []
action:
  - type: turn_on
    device_id: 62e6f397f853a9446e26302acc68184c
    entity_id: 03dbe02f160a89b2a4e81303e1185f4a
    domain: switch
mode: single

You might get a problem if you use switch instead of on/off because let’s say you turn it off or on using the switch it will change stats and the next time it turns on it will actually turn off

This information might be wrong I’m not very good using yaml code

Here is a example of the code and screenshot

alias: New automation
description: “”
trigger:

  • platform: time
    at: “00:00:00”
    condition: []
    action:
  • type: turn_off
    device_id: 4623c0a7ee5b6c411bec6d7ca1373651
    entity_id: 68148bd19eac33a4810a2140b12d8731
    domain: light

You will need to change stuff like the name and time

Ok Thanks - I need to understand domains then. Still looking for how to connect a Schedule Helper to a Control Socket. Ica see your solution without a Schedule Helper is simpler and more direct - probably the right way.

I’ll see what happens. Maybe I’ll make up another control socket and a lamp for testing…

Will report back.

Cheers

What you might also want to us are blueprints there are a lot of really useful blueprints

alias: Water Pump Scheduled
description: From Schedule Helper power on/off the pump
trigger:
  - platform: state
    entity_id:
      - schedule.water_pump_schedule
condition: []
action:
  - service: 'switch.turn_{{ trigger.to_state.state }}'
    target: 
      entity_id: 03dbe02f160a89b2a4e81303e1185f4a
mode: single

Similar example:

1 Like

Direct mapping of state? Looks like what I was hoping could be done.
Worked perfectly Last-night. :sunglasses:

Reference

State Objects
Templating - States
Use templates to decide which service to call

1 Like

I was able to put this together in the UI using Add Building Block to add the Choose cases.
This does not require any template code.

alias: HRV schedule
description: Turn on the HRV at night and off during the day based upon a Schedule helper
trigger:
  - platform: state
    entity_id:
      - schedule.schedule_hrv
condition: []
action:
  - choose:
      - conditions:
          - condition: state
            entity_id: schedule.schedule_hrv
            state: "on"
        sequence:
          - type: turn_on
            device_id: a32da1afc2a088e334109ca55eac9ac4
            entity_id: e3db2d12f85527c59b466cc51fbe20cd
            domain: switch
      - conditions:
          - condition: state
            entity_id: schedule.schedule_hrv
            state: "off"
        sequence:
          - type: turn_off
            device_id: a32da1afc2a088e334109ca55eac9ac4
            entity_id: e3db2d12f85527c59b466cc51fbe20cd
            domain: switch
mode: single
1 Like