nielsfaber / scheduler-component Goto Github PK
View Code? Open in Web Editor NEWCustom component for HA that enables the creation of scheduler entities
License: GNU General Public License v3.0
Custom component for HA that enables the creation of scheduler entities
License: GNU General Public License v3.0
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
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
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?
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.
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'
Helpers, specifically input_boolean to show up as switches.
Would also be good to have automations and scripts available to be scheduled.
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?
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
Please remove this issue.
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.
Hi
I can make lights go off at sunrise.
How can I make lights go on at sunset?
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.
when i try to add "https://github.com/nielsfaber/scheduler-component" to HACS i am getting this error
"Repostitory structure for v2.0.0 is not compliant"
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.
No errors in the logs upon loading the component, but the scheduler services are not created.
Home Assistant Core 0.117.6
Hi @nielsfaber
opening the issue here rather in the card repo because I do not think this is UI related.
I'm using climate group to group several eTRV together, it works very well in normal lovelace climate card, but the scheduler does nothing and I do not see errors in log :/
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 ?
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
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
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
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.
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.
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.
Is this something feasible with the current architecture and something you would be interested in?
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.
Stuff like
if "time" in entry and "event" in entry["time"]:
could be made into
if "event" in entry.get("time", ""):
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!
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
Recommended topics:
hacs
integration
scheduler
custom-component
home-assistant
homeassistant
python
You can help maintain standardized code quality by doing this:
wemake-python-styleguide
, flake8
, flake8-html
, isort
, black
with pippython3 -m flake8 --format html --htmldir report --inline-quotes double .
View the HTML report in scheduler-component/report
.
Then fix issues and send a PR.
Hi,
I just updated the schedule integration as well as the schedule card.
Result:
To be honest... absolutely useless at this point. Yes, I cleaned the cache, yes I restarted HA 2 times... Nothing. What happened?
Any idea?
Check out this checklist:
https://developers.home-assistant.io/docs/creating_component_code_review/
What's the next step based on it? Tests or another thing?
When a light gets turned on or off, it doesn't show that it was tuned on or off by a schedule when you filter by entity. Is there any way to fix that?
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":
Version Information: HA 0.118.5, Scheduler component v2.1.1 (installed via HACS)
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
Install via Hacs on HA .118.1, no service appear. So schedular card can't add schedule because service is not found.
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
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
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.
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!!
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
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.
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 |
Slider works with Chrome but not edge browser.
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
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']
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.
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.
Step to reproduce:
After system run the schedule is turned on. Maybe it is not a bug? Am I missed something?
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.