Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 95479

Power socket daily schedule - Schedy?

$
0
0

@axg20202 wrote:

Hi all, Total noob to HA so apologies in advance. I’m running HA on Freenas and have been dabbling with yaml and starting to get somewhere but there is a schedule I want to develop that I can’t find a similar example of, which is surprising given how common a scenario it must be. It’s basically an HA equivalent of one of those digital timer power sockets that can be programmed for days of the week.

I am going to get a Zwave power socket that I want to use to control my coffee machine to come on and off at specific times on given days of the week. I want to have a Mon-Fri on and off time schedule, and then a Sat-Sun on and off schedule. I’d also like to be able to override this at any time with a simple virtual switch.

What’s the simplest method to achieve this?

Rather than coming begging as a new forum member, I’ve at least had a crack at it, using Schedy. The idea is that the schedule can change depending on whether I’m working from home or at the office, and there is a means to overide the schedule by switching it to off or on (constant). I have no idea if the below code is correct though (I adapted it from the Schedy tutorial) and I’ve realised I don’t really know how I integrate it with HA and link it to the switch entity. Can someone help me get it over the line please?

## This goes in schedy_coffee.yaml in AppDaemon’s apps directory:

schedy_coffee:  # This is our app instance name.
  module: hass_apps_loader
  class: SchedyApp

  actor_type: switch

  expression_environment: |
    def schedule_mode():
        return state("input_select.schedule_mode")

  watched_entities:
  - input_select.schedule_mode

  rooms:

    kitchen:
      actors:
        switch.kitchen_1:
      schedule:
      - v: "ON"
        rules:
        - weekdays: 1-5   #Mon-Fri
          rules:
          - rules:
            - x: "Next() if schedule_mode() == 'Normal' else Break()"
            - { start: "06:00", end: "08:00" }
          - rules:
            - x: "Next() if schedule_mode() == 'WFH or on leave' else Break()"
            - { start: "06:30", end: "15:00" }
          - rules:
            - x: "Next() if schedule_mode() == 'Off' else Break()"
            - v: "OFF"
          - rules:
            - x: "Next() if schedule_mode() == 'On (constant)' else Break()"
            - v: "ON"
        - weekdays: 6-7   #Sat-Sun
          rules:
          - rules          
            - x: "Next() if schedule_mode() =! 'Off' else Break()"          
            - { start: "06:30", end: "10:00" }
            - { start: "12:00", end: "15:00" }
          - rules
            - x: "Next() if schedule_mode() == 'On (constant)' else Break()"
            - v: "ON" 
          - v: "OFF"


## This goes in the HA configuration.yaml

input_select:
  schedule_mode:
    name: Coffee machine schedule mode
    options:
    - Normal
    - WFH or on leave
    - Off
    - On (constant)

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 95479

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>