Scheduler card/custom component

Likewise. I have plenty of time triggers and theyā€™ve never missed a beat.

Neat custom integration though. Well done neliss.

1 Like

Many thanks for all feedback so far!
I made some progress with the custom_component, the timekeeping which was done in the Node.js app, is now a part of the custom_component.
The Node.js app was also responsible for storage of the entities (persistence), this is moved to the custom_component as well.

This means that the Node.js app is not longer required.
For the time being the custom_component still relies on retained messages on MQTT for ā€˜discoveringā€™ the entities after restarting HA, but Iā€™m looking into a proper way (such as generated YAML or database storage).

To be continued!

6 Likes

Iā€™m having trouble configuring it, mind sharing a full config dump of your card?

1 Like

Wow! Awesome progress! Looking forward for dropping MQTT as well! Keep up the great work! Once you do it - Iā€™d vote for making this an official HA integration. This functionality is missing for so long, that they need to make it part of HA by default once :slight_smile:

1 Like

Sure thing!
It was rather long for posting here, so i added it to the repo.

A barebones starting config would be:

type: custom:scheduler-card
groups: # groups define the options you can choose from when you make a new entity 
  all_lamps: # gives a group labeled 'all lamps' with all light entities under it
    domains: [light]
  my_filter: #gives a group labeled 'my filter' with only 1 entity under it
    entities: [fan.my_filter]
# note that each entity or domain used in a group, needs to have at least 
# 1 action defined for it (else it would become a stub - could cause crashes)

domains: # add here the settings you want to apply to each entity of a type
  light: # all lights will have a 'turn on' and 'turn off' action
    actions:
      - service: turn_on
      - service: turn_off

entities: # add here specific entities with their actions
  fan.my_filter:
    actions:
      - service: turn_on
        service_data: {speed: high}
      - service: turn_off

You can prettify the visualization of the card by adding name:'my name' or icon:my-mdi-icon properties (you can do this per group, per entity, per domain and per action).

Currently the code is not very forgiving: if you make a typo, the whole card will not show up.
Also the groups/domains/entities configurations are currently mandatory, meaning that you will have to put at least 1 item (so above example is also close to a minimum configuration).

I am aware that it it a bit cumbersome and confusing to configure the card. Keeping it user-friendly is one of the key goals, so you can expect improvements here.

Thanks :slightly_smiling_face:
I would like to drop the MQTT asap as well, but this was the best i could achieve for now. I asked for assistance on the Discord chat (thanks for the tip!), because I need to find out how to create entity persistence (without having to define them in YAML). So far no useful input, but weā€™ll see.

Did you post it on devs_core channel? Discord?

Basically if you create entities HA takes care of their storage automatically. I think what youā€™re looking for is State Attributes.
Iā€™ve seen in your code you already handle it. Then whenever you want to store something in there just call self.async_schedule_update_ha_state(True) and you should be fine.

However if you want to store something (e.g. config data) because you want to keep that between HA restarts then Iā€™m not sure whatā€™s the best way, but I know a common solution is to output such things to a file. Google Calendar and Z_Wave integrations do it. See here: https://github.com/home-assistant/core/blob/d058802325598ab44e319f65525045295781e366/homeassistant/components/google/init.py#L392

The icons are offset for me:


If you canā€™t see it itā€™s the forumā€™s problem, right-click on the image, open in new tab, advanced, proceed.

Woah that looks bad!
Seems like the complete CSS config of the card is being ignored.
I must say i have seen something similar a few times, but it was gone after refreshing.
It is a bit of a cliche, but did you try (force) refreshing the browser?
I tried this card with the default HA theme, do you maybe use an alternative theme?

I force refreshed and itā€™s working now!

Thanks for your work! It looks awesome :slight_smile: and I have been looking for this functionality in HA for quite some time now.
I didnā€™t try it yet thoughā€¦ I am waiting for it to be in a more stable phase and my coding skills are limited.
Any updates since the last comments? Should I give it a try already?
Thanks again :smiley:

Well I still have a pending PR that adds some more stuff internally. I use it and itā€™s great with me, but the card sometimes is buggy.
If it doesnā€™t work, hard-refresh the page.
Make sure you add content to it when you hit save, or itā€™ll hide all of the cards in that view!

1 Like

Hi, great to hear you like to use my scheduler integration!
I can tell you that iā€™m working on a new revision of the custom_component which will probably have quite some breaking changes, meaning that if you install it now, updating it can become a pain in the *ss. So perhaps better to wait a week or so.

The current custom_component is quite basic and uses MQTT topics to store the time schedules.
Over the past days I had some discussions with some of the developers behind HA.
They advised me to use use config entries instead and creating a true integration (which you can set up under ā€˜integrationsā€™ in HA).
It took quite some changes, but I have the basics locally running. The storage is now internal in HA as well and automatically restored upon restart.
The next step is to add some provisions such that a single schedule entity can contain multiple time+actions, such that combined on+off actions or even week programs will be possible.
From there on I will focus on improving the functionalities of the UI (scheduler-card).

I will post an update when things are ready, keep checking for updates :wink:

4 Likes

Phantastic progress! Looking forward to install the integration. I was about to turn away from Home Assistant due to the lack of a decent scheduler. Thanks for taking the efforts to work on such an important component!
BTW, in case you are interested in ideas for a nice UI maybe you want to have a look here: https://community.home-assistant.io/t/week-scheduler-including-really-nice-example-ui/205620

Hi, thanks for supporting this initiative!
An update will be coming to facilitate making bundled schedules (combined start/stop actions and start-stop times).
I am also considering to implement a bar view, such that you can make a weekly schedule.
I looked at your UI and it looks similar to what i have in mind, the biggest consideration is that it needs to be mobile-friendly, i.e. it should be practical on a small screen (maybe in landscape orientation).

The Tado Smart Thermostat has a editor UI that looks quite clear to me:


I like the fact that the blue bar is made shorter, most schedules show an endless bar in the middle while nothing happens during the day.
The challenge will be to make such a view in a universal way, i think it should work for temperature of a thermostat, but also turning on lights (at variable brightness), open/close covers, etc.
If you have more some ideas, let me know :slight_smile:

3 Likes

Update time! :slight_smile:
You can now set up the scheduler as integration:


Working great here, iā€™m curious who will give it a try.

5 Likes

Working fine!

  • I sent in another CI-improving PR
  • Sometimes it seems whenever I select a category, it redirects me back to the overview tab, and I need to reload.
  • Mind adding a custom panel to the sidebar?
  • Also itā€™d be nice if you could add it to the defaults (hacs/default repo)

You can accomplish this on your own with the following steps.

  1. Go to Configuration > Lovelace Dashboards.
  2. Click the Plus button in the lower right corner.
  3. Enter Scheduler for the Title and mdi:calendar for the Icon.
  4. Click the 3 dots in the upper right corner, then select Configure UI.
  5. Turn on Start with an empty dashboard, and click TAKE CONTROL.
  6. Click the Plus in the upper left corner to add your first page to this dashboard.
  7. Enter Scheduler for the Title and mdi:calendar for the Icon.
  8. Click the Plus button in the lower right corner.
  9. Search for ā€œschedulerā€, then click on Custom: Scheduler to add your Scheduler Card to this page!
4 Likes

Integration works fine, my problem is loading the custom card.
I cloned the repo into www folder


I added

resources:
  - url: /local/scheduler-card/scheduler-card.js?v=0
    type: module

image
I try to add card

I also tried extract the *.js files into www/scheduler-card
same result, any thoughts?

Hi Mark,

i think the URL for the card should become:
/local/scheduler-card/dist/scheduler-card.js?v=0

Recently the /dist/ folder was added, i guess this is not up-to-date yet with the documentation, sorry about that!
Please be aware that the ā€œ...ā€ as configuration for the domains / entities / groups you shouldnā€™t take to literally, it would give a huge error if leave it like that :wink:
The idea is that you tell the card which entities and actions you would like to control with schedules.

For a starting point you could try this:

type: custom:scheduler-card
domains:
  light:
    icon: lightbulb
    actions:
      - service: turn_on
        icon: lightbulb-outline
      - service: turn_off
        icon: lightbulb-off-outline

With this little code, all your lights should show up and you will be able to turn them on and off automatically.
Documentation for configuring the card is a BIG work-in-progress still, so (for the time being) please ask if you need some assistance with this.
Good luck!

1 Like