Giter Site home page Giter Site logo

nielsfaber / scheduler-component Goto Github PK

View Code? Open in Web Editor NEW
579.0 11.0 38.0 396 KB

Custom component for HA that enables the creation of scheduler entities

License: GNU General Public License v3.0

Python 100.00%
hacs integration custom-component homeassistant python scheduler

scheduler-component's Introduction

scheduler-component

hacs_badge

Introduction

This is a custom component for Home Assistant, that is used for controlling your existing devices based on time. It works nicely together with the Lovelace scheduler card.

A scheduler entity defines an action at a certain time, for example 'turn on my lamp at 21:00 every day'. Any entity in HA can be used for making a scheduler entity, together with any service that is available in HA.

Installation

Step 1: Download files

Option 1: Via HACS

Make sure you have HACS installed. If you don't, run wget -O - https://get.hacs.xyz | bash - in HA.
Choose Integrations under HACS. Click the '+' button on the bottom of the page, search for "scheduler component", choose it, and click install in HACS.

Option 2: Manual

Clone this repository or download the source code as a zip file and add/merge the custom_components/ folder with its contents in your configuration directory.

Step 2: Restart HA

In order for the newly added integration to be loaded, HA needs to be restarted.

Step 3: Add integration to HA (<--- this is a step that a lot of people forget)

In HA, go to Configuration > Integrations. In the bottom right corner, click on the big button with a '+'.

If the component is properly installed, you should be able to find 'Scheduler' in the list. You might need to clear you browser cache for the integration to show up.

Select it, and the scheduler integration is ready for use.

Step 4: Add the scheduler-card

Follow instructions on Lovelace scheduler card to setup the card that allows you to configure scheduler entities.

Updating

  1. Update the files:
    • Using HACS: In the HACS panel, there should be an notification when a new version is available. Follow the instructions within HACS to update the installation files.
    • Manually: Download the latest release as a zip file and extract it into the custom_components folder in your HA installation, overwriting the previous installation.
  2. Restart HA to load the changes.

To see which version is installed: In HA, go to Configuration -> Integrations. In the Scheduler integration card, you should see a link with '1 device', click it. In the table click the 'Scheduler' device, and you should see the Device info. The 'firmware version' represents the installed version number.

Uninstalling

  1. Remove scheduler from HA: In HA go to Configuration -> Integrations. Find the card for scheduler integration, click the button with the 3 dots, and click 'Delete'.
  2. Remove the files:
  • When installed with HACS: In the HACS panel go to integrations and look for Scheduler component. Click the button with the 3 dots and click 'Uninstall'.
  • When installed manually: In the custom_components directory, remove the 'scheduler' folder.
  1. Restart HA to make all traces of the component disappear.

Backup

The configuration of your schedules is stored in the .storage folder in the HA configuration directory, in a file called scheduler.storage.

If you create a snapshot through HA supervisor, this file should automatically be backed up. Else, make sure to include this file in your backup.

The entities in HA are created from the scheduler.storage file upon (re)starting HA.

Scheduler entities

Entities that are part of the scheduler integrations will have entity id following according to pattern switch.schedule_<token>, where <token> is a randomly generated 6 digit code.

You can treat these entities in the same way as other switch entities in HA, meaning that you could place them in any Lovelace card for quick access.

States

A scheduler entity can have the following states:

State Description
off Schedule is disabled. A disabled schedule will not keep track of time, and will not execute any actions.
on Schedule has internal timer running and is waiting for the timer to expire. The attribute next_trigger provides the moment of expiration
triggered Timer is finished and the action is executed. Entity will wait for 1 minute and then reset the timer.
unknown Something went wrong, the schedule is not running.

Services

Since schedules follow the switch platform, you can use the switch.turn_on and switch.turn_off services to enable and disable schedules.

In addition, the following services are available. Note that this component is meant to be used together with the Lovelace scheduler card, which handles some of the data validation.

scheduler.add

Add a new scheduler entity.

field Type Optional/required Description Remarks
weekdays list optional Days (of the week) on which the schedule should be executed Valid values are: mon, tue, wed, thu, fri, sat, sun, daily, workday weekend.
Defaults to daily.
start_date date optional Starting date at which the schedule should trigger Valid format is yyyy-mm-dd.
end_date date optional Final date for which the schedule should trigger Valid format is yyyy-mm-dd.
If end_date is in the past, schedule will not trigger again.
timeslots list required List of times/time intervals with the actions that should be executed See Timeslot for more info.
repeat_type string optional Control repeat behaviour after triggering. Valid values are:
  • repeat: (default value) schedule will loop after triggering
  • single: schedule will delete itself after triggering
  • pause: schedule will turn off after triggering, can be reset by turning on
name string optional Friendly name for the schedule entity. The name will also be used for the entity_id of the schedule.
Default value is Schedule #abcdef where abcdef=random generated sequence.

scheduler.edit

Update the configuration of an existing scheduler entity. Overwrites the old value.

The service parameters are the same as for scheduler.add, except that the entity_id needs to be provided of the schedule which needs to be modified.

Note that only the parameters that should be changed have to be provided, if a parameter is not provided, the previous value will be kept.

scheduler.remove

Remove a scheduler entity.

field Type Optional/required Description Remarks
entity_id string required Entity ID of the scheduler entity e.g. switch.schedule_123456

scheduler.copy

Duplicate a scheduler entity.

field Type Optional/required Description Remarks
entity_id string required Entity ID of the existing scheduler entity e.g. switch.schedule_123456
name string optional Friendly name for the created schedule entity. The name will also be used for the entity_id of the schedule.
Default value is Schedule #abcdef where abcdef=random generated sequence.

scheduler.run_action

Manually trigger a schedule.

field Type Optional/required Description Remarks
entity_id string required Entity ID of the scheduler entity e.g. switch.schedule_123456
time string optional Time for which to trigger the schedule. If a schedule only has a single timeslot, this timeslot will always be triggered.
For schedules with a multiple timeslots:
  • If no time is provided: the schedule overlapping the current time (now) is triggered.
  • If time is provided: the schedule overlapping the provided time is triggered.
skip_conditions boolean optional Whether the conditions of the schedule should be skipped or not.

Data format

Timeslot

A timeslot defines the timepoints on which a schedule is triggered, together with the actions that need to be executed. Optionally also conditions can be specified that need to be validated before the actions may be fired.

Name Type Optional/required Description Remarks
start string required Time (in 24 hours format) on which the schedule should trigger Should be in the range 00:00-23:59.
Each timeslot should have a unique value.
Input may also be relative to sun: e.g. sunrise+01:00 or sunset-00:00.
stop string optional Time (in 24 hours format) on which the timeslot ends Only required when defining timeslots.
Should be in the range 00:01-00:00 (start of next day).
The stop time must be at least one minute after start time.
conditions list optional Conditions that should be validated before the action(s) may be executed See Condition for more info.
condition_type string optional Logic to apply when validating multiple conditions Valid values are:
  • and: All conditions must be met
  • or: One or more of the conditions must be met
track_conditions boolean optional Watch condition entities for changes, repeat the actions once conditions become valid
actions list required Actions to execute when the start time is reached. See Action for more info.

Note:

To guarantee compatibility with the scheduler-card, the following conditions need to be met:

  1. A schedule must exist of either:
  • A single timeslot with only start time
  • A list timeslots which ALL have start and stop time, which are non overlapping and are not relative to sun.
  1. Conditions must be the same for all timeslots.

  2. Actions list may only consist of a single service/service_data combination (multiple actions may only have different entity_id).

Condition

A condition is used for defining a rule that needs to be validated, before the scheduled action(s) may be executed. Conditions are currently limited to checking the state of entities.

Name Type Optional/required Description Remarks
entity_id string required Entity to which the condition applies e.g. binary_sensor.my_window
value string required Value to compare the entity state to e.g. on
match_type string required Logic to apply for the comparison Valid values are:
  • is: entity state must match value
  • not: entity state must not match value
  • below: entity state must be below value (applicable to numerical values only)
  • above: entity state must be above value (applicable to numerical values only)

Action

An action is a combination of a HA service with entity_id. See Developer Tools -> Services in HA for available actions and info on valid parameters.

Name Type Optional/required Description Remarks
entity_id string required Entity to which the action needs to be executed e.g.: light.my_lamp
service string required HA service that needs to be executed on the entity e.g.: light.turn_on
service_data dict optional Extra parameters to use in the service call. e.g.: {brightness: 200}

scheduler-component's People

Contributors

0xflotus avatar bdr99 avatar calisro avatar github-actions[bot] avatar isaacbreuer avatar jaynis avatar jpbede avatar ktibow avatar lmagyar avatar mattcrn avatar maxdomo avatar nielsfaber avatar raman325 avatar slimninja avatar wrt54g avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

scheduler-component's Issues

After restart HA automation is turned on

Step to reproduce:

  1. Set schedule and turn it off
  2. Turn off host: Supervisor -> System -> Host system SHUTDOWN
  3. Run system again

After system run the schedule is turned on. Maybe it is not a bug? Am I missed something?

Sun Times

Hi
I can make lights go off at sunrise.
How can I make lights go on at sunset?

New entities do not appear to choose

Maybe it's a bit silly but I can't find how to update the newly installed components.
I explain.
I had 2 climate control units and three lights, I installed a heater and two more lamps and the new ones do not appear to me to be able to choose them.
I have integrated these new entities in the climate.yaml and ligth.yaml files, but after restarting HA they do not appear in scheduler-component integration.
What am I doing wrong?

Brightness Light when "ON"

Hi,

I think it's not really an issues but more a new condition.

I want to move the brightness from a light when she is "ON" all day.

I don't know how I can do this, I can set Light "on" and brightness but I can't select the "Light ON" at condition.

Scheduled-component can do this ?

It's a really awesome good component !

And in French, the component for Light say "Alumer" but it's "Allumer" when ON

state becomes invalid when entity is not loaded yet

During discovery, the scheduler.* entities are loaded and their configuration is checked.
Part of this check is that the entity that is used, actually exists.
Due to race condition of the discovery of entities, this may result in incorrect invalid result.

Lost setting after update

Hi,
I just updated the schedule integration as well as the schedule card.

Result:

  • all my settings I did beforehand (which worked perfectly til now) are lost
  • I cannot setup new schedule. After "saving" nothing happens. No entries.

To be honest... absolutely useless at this point. Yes, I cleaned the cache, yes I restarted HA 2 times... Nothing. What happened?
Any idea?

Sun based actions

Hi. I think this work is really good, the card is aolmost perfect.

It would be even better if you could set sunrise and sunset as the trigger for the actions, not olny times. Even more, you could configure a light to turn on when sun sets and turn off at 23:00.

Thanks again for yor work!!

Disable all/some scheduled actions, vacation mode

Hi, couldn't find anything related so I thought I'll open this feature request.

I'm on vacation in the foreseeable future and would like to disable/suspend all/some of the schedules I planned.

I've tried writing something in ha to achieve this but couldn't find a place to hook in. I've tried to disable/stop all schedules with a single switch but that didn't work.

So, it would be nice to have a on/off switch for each (and/or all) scheduled item.

Thanks for the great work, loving it so far ;)

BR

Feature request: Recurring schedules

Hi Niel,

Great job on the scheduler so far! I would like to request a feature that allows to set recurring schedules within the same schedule job.

Use case: I have a fan that I want to turn on every every 2 hours and turn it off every 2 hours (alternating between the two, so that it's on for an hour and off for an hour). This would require me to set and manage 24 different schedules.

Feature request: one-time schedules service

Using the scheduler component service, I can easily program a task to be executed at a certain time; for example with this simple code:

    - service: scheduler.add
      data:
        actions:
          - service: turn_off
            entity: switch.sirena
        entries:
          - time: '{{ states(''input_datetime.caldera_manual_hora'') }}'
            actions:
              - 0

However, I cannot make this a one-time event, it is always scheduled to be executed each day. I though could write a script and call the scheduler.remove service as part of the action, but I cannot know which entity_id to use.

Thanks!

Feature Request: One time schedule.

Just to weight on whether this is doable or if someone has ever requested it before.

Much like alarms on the clock app of most phones allows you to set up an alarm only for tomorrow, that won't repeat until you explicitly enable it again, I think it could be useful to allow to schedule something for a one-time event.

See screenshot of the clock app in Android.
alarm-for-tomorrow

The idea would be to add another option to the card that would say either Once or One time that will create a scheduler and will automatically switch it off after is run.
scheduler-card-proposal
If the user selects "Once" and sets the time to 21:00 and when it's 18:00, it will run in 3 hours. If It's 22:00 it will fire in 23 hours.
scheduled-for-tomorrow-noon

scheduled-but-disabled

Is this something feasible with the current architecture and something you would be interested in?

Add topics

Recommended topics:
hacs
integration
scheduler
custom-component
home-assistant
homeassistant
python

Suggestion: Add multiple devices / schedules

Really nice scheduler. Hope it evolves quickly and becomes part of the core home assistant features.

Please add the ability to have multiple schedules. Maybe add / separate new devices for each schedule. The ability to have different schedules on different lovelace pages.

eg.

  • outdoor page can have schedule for outdoor lighting
  • basement page can have schedule for different automations
  • alarm page can have schedule for auto arming at specific times

24h options when picking time

Not an issue, just a feature request or a suggestion.

Currently if I want to set something at 00:30 I have to set it at 12:30am which is confusing to me. I know some people prefer am/pm, but also a lot of people prefer 24h notation.

Service does not show in HA

Install via Hacs on HA .118.1, no service appear. So schedular card can't add schedule because service is not found.

Generic thermostat issue with Heat/Turn Off

Hello,
I have issue setup scheduler to switch between Heat and Turn Off
Posting screenshots below.
Generic Thermostat, which is working fine, but Scheduler only set_temperature for hvac_mode: heat to 23, without switching mode with set_hvac_mode: heat
Is this normal behavior and how can I use Scheduler to just turn off and turn back on General Thermostat ?

  • service: set_hvac_mode
    entity: climate.stove
    hvac_mode: 'off'
  • service: set_temperature // Shouldn't this also set_hvac_mode to heat, not only changing temperature ?
    entity: climate.stove
    hvac_mode: heat
    temperature: 23

Thanks in advance.

PS. Otherwise, everything else is OK, i'm using your Scheduler with another MaxCube thermostat and works find, triggering OK, the problem is General Thermostat does not have Auto or On mode, just Heat and Turn Off
Screenshot from 2020-10-30 20-01-57
Screenshot from 2020-10-30 20-01-34
Screenshot from 2020-10-30 20-02-31

Potential code issue in v2.1.0: 'Unable to prepare setup for platform scheduler.switch'

Hey there, I think I might have come across a code issue in v2.1.0. When attempting to add a new schedule with your scheduler-card I was seeing the attempt fail with the error "Unable to prepare setup for platform scheduler.switch. No module named 'homeassistant.helpers.trigger'". I traced this back to the include statement on line 17 of custom_components/scheduler/switch.py:

from homeassistant.helpers.trigger import async_initialize_triggers

I'm new to HA and pretty garbage at python, so naturally I just commented the line out hoping the issue would disappear. Amazingly, it actually did. My lights have been following my schedules correctly for the past day. But I'm not sure if this error was because my HA is misconfigured or simply because the wrong file was being called for the import.

scheduler-component v2.1.0
scheduler-card v1.7.0
HACS v1.6.0 / frontend v202009091732
home assistant 0.114.4

Generic Thermostat Schedule

Hi, I am quite new to the HA scene.

My problem is very simple... I was trying to add a schedule for a "generic thermostat" entity.
When | create a schedule for turning on the thermostat via the Scheduler Card , this is what is created
image
as you can see, the "on" action (A1) is a "set_temperature" which doesn't actually "turn_on" the thermostat, neither it does "set_hvac_mode" to heat.
I don't know if this worked correctly in previous versions of HA (I'm using version 0.117.4)...

A "workaround" I could apply to the issue is changing A1 to a "turn_on" or a "set_hvac_mode", but I would lose the possibility to set the temperature via the (super cool, btw) Scheduler Card.

If the "set_temperature" behavior doesn't change, is there a way around?
Also I don't now if this applies to a physical thermostat, since I don't have one (not a smart one, at least)

Maaaaany thanks

Schedule not triggered with condition (binary sensor)

Screenshot 2020-11-26 at 09 33 39
Screenshot 2020-11-26 at 09 33 29
Screenshot 2020-11-26 at 09 32 17

Error found in the log:

Logger: homeassistant.components.websocket_api.http.connection
Source: helpers/script.py:926 
Integration: Home Assistant WebSocket API (documentation, issues) 
First occurred: 8:19:42 AM (3 occurrences) 
Last logged: 9:35:33 AM

[139988190400368] Error handling message: Unknown error
[139988070203552] Error handling message: Unknown error
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 18, in _handle_async_response
    await func(hass, connection, msg)
  File "/usr/src/homeassistant/homeassistant/components/search/__init__.py", line 49, in websocket_search_related
    msg["id"], searcher.async_search(msg["item_type"], msg["item_id"])
  File "/usr/src/homeassistant/homeassistant/components/search/__init__.py", line 89, in async_search
    getattr(self, f"_resolve_{search_type}")(search_id)
  File "/usr/src/homeassistant/homeassistant/components/search/__init__.py", line 167, in _resolve_entity
    for entity in automation.automations_with_entity(self.hass, entity_id):
  File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 141, in automations_with_entity
    return [
  File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 144, in <listcomp>
    if entity_id in automation_entity.referenced_entities
  File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 327, in referenced_entities
    referenced = self.action_script.referenced_entities
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 926, in referenced_entities
    referenced.add(entity_id)
TypeError: unhashable type: 'dict'

Improve code quality

You can help maintain standardized code quality by doing this:

  • Make sure Python is installed
  • Remove flake8 extensions that might interfere or use a venv
  • Install wemake-python-styleguide, flake8, flake8-html, isort, black with pip
  • Clone scheduler-component and cd it
  • Run this command: python3 -m flake8 --format html --htmldir report --inline-quotes double .

View the HTML report in scheduler-component/report.
Then fix issues and send a PR.

scheduler/add Service not found

Hi
I'm running HASS 0.117.5 in Docker and just installed Scheduler and the Lovelace card.

When I try to add a schedule I get the error that scheduler/add Service not found.

I've checked the issues here and have ensured I have enabled the sun integration. I cannot see the scheduler integration under configuration->integrations, but I can see it under HACS->Integrations.

I do see the following message in my HASS log file:
2020-11-11 10:57:11 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for scheduler which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.

Any ideas?
Thanks

service not found

Hi,
Have the component installed, but got the message can not call scheduler/add service, not found
Get this after editing scheluler card.
What am i doing wring?

thanks

Error doing job: Task exception was never retrieved - Scheduler never perform the action

I am using HASS v0.117.6
I just performed a fresh install, to reproduce in a minimal environment, then installed latest HACS (v1.6.2) and installed both scheduler integration and card.

I want to control some input_select only.

When the timer is performing the action (changing the input_select), it faced this issue.
I tried it with a schema and an option and faced the same issue. The input_select is never updated due to this issue.


Issue :

2020-11-13 17:57:00 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/config/custom_components/scheduler/switch.py", line 279, in async_timer_finished
    # execute the action
  File "/config/custom_components/scheduler/switch.py", line 318, in async_execute_command
  File "/config/custom_components/scheduler/switch.py", line 361, in async_queue_action
    if res:
  File "/config/custom_components/scheduler/switch.py", line 401, in async_execute_action
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 91, in async_call_from_config
    await hass.services.async_call(*parms, blocking, context)
  File "/usr/src/homeassistant/homeassistant/core.py", line 1402, in async_call
    processed_data = handler.schema(service_data)
  File "/usr/local/lib/python3.8/site-packages/voluptuous/validators.py", line 218, in __call__
    return self._exec((Schema(val) for val in self.validators), v)
  File "/usr/local/lib/python3.8/site-packages/voluptuous/validators.py", line 340, in _exec
    raise e if self.msg is None else AllInvalid(self.msg, path=path)
  File "/usr/local/lib/python3.8/site-packages/voluptuous/validators.py", line 336, in _exec
    v = func(v)
  File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 272, in __call__
    return self._compiled([], data)
  File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 817, in validate_callable
    return schema(data)
  File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 272, in __call__
    return self._compiled([], data)
  File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 594, in validate_dict
    return base_validate(path, iteritems(data), out)
  File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 432, in validate_mapping
    raise er.MultipleInvalid(errors)
voluptuous.error.MultipleInvalid: extra keys not allowed @ data['mode']

lovelace scheduler blank page

Using the current latest of component and card and still recceive a blank page when adding a new schedule
see below error

scheduler-card.js:286 Uncaught (in promise) TypeError: Cannot read property 'attributes' of undefined
    at Ii (scheduler-card.js:286)
    at scheduler-card.js:286
    at Array.map (<anonymous>)
    at Ii (scheduler-card.js:286)
    at Ri (scheduler-card.js:286)
    at Bi (scheduler-card.js:286)
    at scheduler-card.js:445
    at Array.filter (<anonymous>)
    at HTMLElement.getGroups (scheduler-card.js:445)
    at HTMLElement.render (scheduler-card.js:445)
Ii @ scheduler-card.js:286
(anonymous) @ scheduler-card.js:286
Ii @ scheduler-card.js:286
Ri @ scheduler-card.js:286
Bi @ scheduler-card.js:286
(anonymous) @ scheduler-card.js:445
getGroups @ scheduler-card.js:445
render @ scheduler-card.js:445
update @ scheduler-card.js:187
performUpdate @ scheduler-card.js:148
_enqueueUpdate @ scheduler-card.js:148
async function (async)
_enqueueUpdate @ scheduler-card.js:148
requestUpdateInternal @ scheduler-card.js:148
initialize @ scheduler-card.js:148
initialize @ scheduler-card.js:187
F @ scheduler-card.js:148
se @ scheduler-card.js:187
os @ scheduler-card.js:445
_clone @ scheduler-card.js:56
__commitTemplateResult @ scheduler-card.js:82
commit @ scheduler-card.js:82
(anonymous) @ scheduler-card.js:187
se.render @ scheduler-card.js:187
update @ scheduler-card.js:187
performUpdate @ scheduler-card.js:148
_enqueueUpdate @ scheduler-card.js:148
async function (async)
_enqueueUpdate @ scheduler-card.js:148
requestUpdateInternal @ scheduler-card.js:148
set @ scheduler-card.js:148
_addItemClick @ scheduler-card.js:1536
handleEvent @ scheduler-card.js:82
A.__boundHandleEvent @ scheduler-card.js:82
newItemClick @ scheduler-card.js:404
handleEvent @ scheduler-card.js:82
A.__boundHandleEvent @ scheduler-card.js:82

Only switches sown on edit mode.

hi Niels, i update today and notice i can't add more than switches (and only a few of them). I don't have any custom config, is the stock setting. I'm adding a screenshot to this.

image

Feature Request: Random Time Offset

Hi Neil,
I must admit your solution is perfect in simplicity. Congratulations on the concept!

I was wondering if you could consider as useful implementing "random time offset" for the trigger of the action. It could work in a way that something is triggered "around planned time" - with a random offset of e.g. +-2h. Such a feature could be useful as "security feature" - for turning on and off the lights simulating a presence in home/apartment, as randomness would prevent realizing that lights are turned on and off by scheduled automation.
What do you think?

Thank you again for this awesome component.

Items trigger twice

Scheduler actions seem to trigger twice: At the specified time and then again one minute later.

I have a simple scheduler item, which turns a bunch of christmas lights (a light group) on and off at specific times during the day.
When I decide that I don't want it to turn on/off yet and hit the light switch manually, the second action at [configured time+1minute] will undo that a few seconds later.

Example schedule:

"entity_id": "switch.schedule_92739c",
"state": "waiting",
"attributes": {
    "entries": [
        "15DT0600T0830A0",
        "15DT0830T1600A1",
        "15DT1600T2200A0",
        "15DT2200T0000A1"
    ],
    "actions": [
        {   
            "service": "switch.turn_on",
            "entity": "group.weihnachtsbeleuchtung"
        },  
        {   
            "service": "switch.turn_off",
            "entity": "group.weihnachtsbeleuchtung"
        }
    ],
    "next_trigger": "2020-12-07T16:00:00+01:00",
    "friendly_name": "Weihnachtsbeleuchtung Wochentags",
    "icon": "mdi:calendar-clock"
},
"last_changed": "2020-12-07T07:31:00.009555+00:00",
"last_updated": "2020-12-07T07:31:00.009555+00:00",

And this is how it looks "in action":
Screenshot from 2020-12-07 08-46-20

Version Information: HA 0.118.5, Scheduler component v2.1.1 (installed via HACS)

no action triggered

Hi,
thanks for sharing this great project !
I just installed the Scheduler with hacs and everything seems to work fine. I defined a rule to switch a light on at 22:00 every day and saved it via Add Item. So far so good. But nothing happens at 22:00. I had a look on the nexttrigger attribut and was confused as this doesn‘t corresponds to 22:00 this day (21:30 next day??)
Any Ideas? Any chance to debug? Would love to integrate the scheduler..
Best(en Gruß),
Michael

Include other domain types.

Helpers, specifically input_boolean to show up as switches.

Would also be good to have automations and scripts available to be scheduled.

Add hacktoberfest label

Hacktoberfest has started, which means for free, this repo and the card's repo too can get a bit more traffic by adding the hacktoberfest and the hacktoberfest2020 topic.

extra keys not allowed @ data['mode'] on schema update

I am using HASS v0.117.6
I just performed a fresh install, to reproduce in a minimal environment, then installed latest HACS (v1.6.2) and installed both scheduler integration and card.

I want to control some input_select only.

I am using schema instead of option. I can create some entries, set every scheme I want, but as soon as I want to edit a schema I am facing this issue.
I can edit options (to add a condition or change the name) without issue
I can change the type from scheme to condition without issue

This issue occurs only when I try to edit the time of modes I want to set.

I am not sure if this is an issue of the scheduler component or scheduler card.


Issue message :

2020-11-13 17:38:41 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.2892112608] extra keys not allowed @ data['mode']
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 135, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1448, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1483, in _execute_service
    await handler.job.target(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 573, in handle_service
    await service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 482, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 664, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 519, in _handle_entity_call
    await result
  File "/config/custom_components/scheduler/switch.py", line 458, in async_service_edit
    await self.async_abort_queued_actions()
  File "/config/custom_components/scheduler/switch.py", line 246, in async_start_timer
    _LOGGER.debug("We are starting in a timeslot. Proceed with actions.")
  File "/config/custom_components/scheduler/switch.py", line 318, in async_execute_command
  File "/config/custom_components/scheduler/switch.py", line 361, in async_queue_action
    if res:
  File "/config/custom_components/scheduler/switch.py", line 401, in async_execute_action
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 91, in async_call_from_config
    await hass.services.async_call(*parms, blocking, context)
  File "/usr/src/homeassistant/homeassistant/core.py", line 1402, in async_call
    processed_data = handler.schema(service_data)
  File "/usr/local/lib/python3.8/site-packages/voluptuous/validators.py", line 218, in __call__
    return self._exec((Schema(val) for val in self.validators), v)
  File "/usr/local/lib/python3.8/site-packages/voluptuous/validators.py", line 340, in _exec
    raise e if self.msg is None else AllInvalid(self.msg, path=path)
  File "/usr/local/lib/python3.8/site-packages/voluptuous/validators.py", line 336, in _exec
    v = func(v)
  File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 272, in __call__
    return self._compiled([], data)
  File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 817, in validate_callable
    return schema(data)
  File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 272, in __call__
    return self._compiled([], data)
  File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 594, in validate_dict
    return base_validate(path, iteritems(data), out)
  File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 432, in validate_mapping
    raise er.MultipleInvalid(errors)
voluptuous.error.MultipleInvalid: extra keys not allowed @ data['mode']

Environment :

$ ha info 
arch: armv7
channel: stable
docker: 19.03.12
features:
- reboot
- shutdown
- services
- network
- hostname
- hassos
hassos: "4.16"
homeassistant: 0.117.6
hostname: homeassistant
logging: info
machine: raspberrypi4
operating_system: HassOS 4.16
supervisor: 2020.11.0
supported: true
supported_arch:
- armv7
- armhf
timezone: Europe/Paris

I can't install the addon. Help please.

Hello I need help please.
I installed this addon with HACS and the component does not appear in the integration. I restarted HA. Then I tried it manually and still I don't see the Scheduler integration In HA Configuration> Integrations

I can't understand what's going on.

My machine

arch aarch64
chassis embedded
dev false
docker true
docker_version 19.03.12
hassio true
host_os HassOS 5.5
installation_type Home Assistant OS
os_name Linux
os_version 5.4.74-v8
python_version 3.8.6
supervisor 2020.11.0
timezone Europe/Lisbon
version 0.117.6
virtualenv false

Existing schedule does not accept new time

want to share what may be a bug, unless i’m overlooking something.
Once you create a schedule, if you go back later and change the time, it doesn’t change.
It will only respect the originally created time input.

Sort entities inside card

Hi. I think it wolud be great to change the way timers are sorted inside the card.

By now, my timers are sorted this way:

in first place the turn on actions
in second place, the turn off actions
it doesn´t matter if the envolved entitie is the same or not

I think it would be better to group in first place by entities, and in second place by actions (on or off), so you can have all timers related to a entitie agrouped together

Thanks a lot

Failed to call service scheduler/add

After installing everything as per the guide (HACS > Reboot > Add to Integrations > Add card) the card displays correctly, I can select my entities, pick an action, a time, ... but when clicking on the final save, I get the error 'Faciled to call service scheduler/add. Service does not exists!'

I have already tried to reinstall everything with no luck.

Install via HACS fails to create services

Having installed both the integration and lovelace card via HACS, the following error is reported when trying to add an item:

image

Checking in developer tools and none of the "scheduler.*" services are present on the system.

Using Hassio 0.144.4 on a Raspberry Pi 3B+

Scheduler services do not exist

No errors in the logs upon loading the component, but the scheduler services are not created.

Home Assistant Core 0.117.6

"Unable to connect to Home Assistant"

It took me quite some time to find the culprit but I was encountering an issue where I'd be able to use Home Assistant for about 5-10mins before getting a "Unable to connect to Home Assistant" error message. The fix was to clear my cookies in my browser. I came to realise (after systematic testing and trail and error) that this component caused the issue. Unfortunately I am unable to find any relevant logs to provide any hard evidence however after posting on Reddit and Facebook I've had someone else mention the same issue and resolution by removing this component.

Conditions for binary_sensor

I added some window sensor (binary_sensor on/off) to include directly in yaml and then to schedule conditions. There was no possibility to add that sensor through GUI. I have something like this:

2020-11-27 00:33:58 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/config/custom_components/scheduler/switch.py", line 564, in async_check_entities_available
await cb_func()
File "/config/custom_components/scheduler/switch.py", line 341, in async_handle_device_available
await self.async_execute_action(service_call)
File "/config/custom_components/scheduler/switch.py", line 373, in async_execute_action
condition_entities = self.dataCollection.get_condition_entities_for_entry(
File "/config/custom_components/scheduler/datacollection.py", line 517, in get_condition_entities_for_entry
if not self.conditions or not "conditions" in self.entries[entry]:
TypeError: list indices must be integers or slices, not NoneType

Are binary sensors supported? I would like to determine thermostat schedule trigger only when window is closed - retrigger when closed.

Feature Request: "one-time" actions

The scheduler component and card works great!

But what I miss which HA can't do (it's possible but not in an easy/nice way) are one-time actions, i.e. actions that are executed only once and don't repeat automatically (even Siri/Alexa can't do stuff like this).

e.g. there are situations in which I know that a room that is normally not heated should be heated but only once. So for example "do ... next Wednesday" or "do ... on 12.12.2020 at 13:15 clock"

It would be enough if the action deactivates itself afterwards, an option that the action deletes itself afterwards would be great but not necessary.

Is it possible to integrate such behavior in the scheduler component/card?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.