question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feature Request] Service to set schedule from template

See original GitHub issue

Thanks so much for this integration, it works great.

I have a use case where my sleep schedule can be quite unpredictable, but Home Assistant knows when I set an alarm to wake up, and what time the alarm is set for. As such, I would like to write an automation to automatically set a schedule whenever my wake up alarm changes, with the idea that both the heating and hot water would turn on 30 minutes before.

Unfortunately, because the set schedule services require a file, I would have to write every possible schedule into separate files, and then pick one depending on the alarm time. It would be easier if I could just use the HA templating capabilities to essentially build a schedule inside the automation, and then set it.

Ideally, we would also have some extra keywords, like “All” (for all days, Monday through Sunday), or “Today” (for the weekday that is today, e.g. if today is monday, this would be equivalent to using “Monday”), or “Tomorrow” (for the next day, e.g. if today is monday, this would be equivalent to using “Tuesday”).

Something like this:

service: wiser.assign_schedule
data:
  to_entity_id: climate.wiser_heating
  schedule:
    Weekdays:
    - Time: {{ (as_timestamp(wake_up_time) - 15*60) | timestamp_custom("%H:%M") }}
      Temp: 20
    - Time: 22:30
      Temp: 15
    Weekends:
    - Time: {{ (as_timestamp(wake_up_time) - 15*60) | timestamp_custom("%H:%M") }}
      Temp: 20
    - Time: 22:30
      Temp: 15

Or

service: wiser.assign_schedule
data:
  to_entity_id: climate.wiser_heating
  schedule:
    All:
    - Time: {{ (as_timestamp(wake_up_time) - 15*60) | timestamp_custom("%H:%M") }}
      Temp: 20
    - Time: 22:30
      Temp: 15

The same could be done when HA detects I am going to sleep, the schedule could be dynamically modified accordingly.

Right now, I need to manually automate the schedule myself, controlling the thermostat directly, as an override. I would prefer to just set the Wiser schedules dynamically, and leave everything else to the hub.

Thank you!

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
msp1974commented, Oct 24, 2022

@ruipin I have now released our new v3.2 version that includes this. I did not see your update to the issue regarding having a today or tomorrow option, but I would need to look into this more before we do that. Not sure if that could cause issues. However, if you want to be able to just amend a specific day on a schedule, you could do something like this:

service: wiser.set_schedule_from_string
data:
  entity_id: climate.wiser_lounge
  schedule: |
    {% set days = ['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'] %}
    Type: Heating
    {{ days[now().weekday()] }}:
      - Time: '14:30'
        Temp: 12
      - Time: '18:45'
        Temp: 13

and this will just amend the current day of week (or use some other templating logic to get to a weekday).

Anyway, please try it out and see how you get on. Will leave this issue open to track any problems you find.

1reaction
msp1974commented, Oct 24, 2022

This is a nice idea and was nowhere near as hard as I thought. As such, it will be in next release. I’ll let you know when done if you can please test it for me. You will have to add a Type: Heating etc line also but see docs here, shows how it will work. Also included the All option.

https://github.com/asantaga/wiserHomeAssistantPlatform/blob/Async-API/docs/services.md#set-schedule-from-string

Read more comments on GitHub >

github_iconTop Results From Across the Web

Feature request response email templates - LiveAgent
Feature requests are messages that customers send to inquire about a feature that is not included in your product or service. Receiving feature...
Read more >
How To Manage Feature Requests [Template included]
This guide will teach you everything about feature requests – how to process them, manage them, respond to them, prioritize them – so...
Read more >
Feature request template - Usersnap
No more fancy-footing around! With a new feature request template, your users will tell you exactly what's missing for them to be successful....
Read more >
Feature Requests: How to Track, Prioritize, and Manage - Pipefy
Feature requests are demands for improvement in a company's product. Click to learn how to track and prioritize these requests efficiently!
Read more >
Feature Request Template - GoodDay
GoodDay feature request template has all you need to effectively manage customer feature requests. Various views, multiple request statuses, custom fields, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found