Skip to content

Commit a9efa19

Browse files
Add calendar entity to config flow
1 parent 44546bd commit a9efa19

4 files changed

Lines changed: 23 additions & 0 deletions

File tree

custom_components/calendar_event/config_flow.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
)
1717

1818
from .const import (
19+
CONF_CALENDAR_ENTITY,
1920
CONF_LABEL,
2021
CONF_STATE_LOWER_LIMIT,
2122
CONF_STATE_NOT,
@@ -38,6 +39,9 @@
3839

3940
OPTIONS_SCHEMA_NUMERIC_STATE = vol.Schema(
4041
{
42+
vol.Required(CONF_CALENDAR_ENTITY): selector.EntitySelector(
43+
selector.EntitySelectorConfig(domain="calendar")
44+
),
4145
vol.Required(CONF_LABEL): selector.LabelSelector(),
4246
vol.Optional(CONF_STATE_LOWER_LIMIT): selector.NumberSelector(
4347
selector.NumberSelectorConfig(
@@ -54,6 +58,9 @@
5458

5559
OPTIONS_SCHEMA_STATE = vol.Schema(
5660
{
61+
vol.Required(CONF_CALENDAR_ENTITY): selector.EntitySelector(
62+
selector.EntitySelectorConfig(domain="calendar")
63+
),
5764
vol.Required(CONF_LABEL): selector.LabelSelector(),
5865
vol.Required(CONF_STATE_TO): selector.SelectSelector(
5966
selector.SelectSelectorConfig(
@@ -67,6 +74,9 @@
6774

6875
OPTIONS_SCHEMA_NOT_STATE = vol.Schema(
6976
{
77+
vol.Required(CONF_CALENDAR_ENTITY): selector.EntitySelector(
78+
selector.EntitySelectorConfig(domain="calendar")
79+
),
7080
vol.Required(CONF_LABEL): selector.LabelSelector(),
7181
vol.Required(CONF_STATE_NOT): selector.SelectSelector(
7282
selector.SelectSelectorConfig(

custom_components/calendar_event/const.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
PLATFORMS = [Platform.BINARY_SENSOR]
2525

2626
CONF_LABEL = "label"
27+
CONF_CALENDAR_ENTITY = "calendar_entity"
2728
CONF_STATE_TYPE = "state_type"
2829
CONF_STATE_TO = "state_to"
2930
CONF_STATE_NOT = "state_not"

custom_components/calendar_event/translations/de.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"title": "Label Numeric State",
1818
"description": "Create a binary sensor that is on if any entities value with the label is outside of its normal bounds.",
1919
"data": {
20+
"calendar_entity": "Kalender",
2021
"label": "Label",
2122
"name": "Name",
2223
"state_lower_limit": "Lower bound",
@@ -27,6 +28,7 @@
2728
"title": "Calendar Event",
2829
"description": "Create a binary sensor that is on if any entity with the label has the specified state.",
2930
"data": {
31+
"calendar_entity": "Kalender",
3032
"label": "Label",
3133
"name": "Name",
3234
"state_to": "Is"
@@ -36,6 +38,7 @@
3638
"title": "Label Not State",
3739
"description": "Create a binary sensor that is on if any entity with the label does not have the specified state.",
3840
"data": {
41+
"calendar_entity": "Kalender",
3942
"label": "Label",
4043
"name": "Name",
4144
"state_not": "Not"
@@ -52,6 +55,7 @@
5255
"title": "Label Numeric State",
5356
"description": "Create a binary sensor that is on if any entities value with the label is outside of its normal bounds.",
5457
"data": {
58+
"calendar_entity": "Kalender",
5559
"label": "Label",
5660
"state_lower_limit": "Lower bound",
5761
"state_upper_limit": "Upper bound"
@@ -61,6 +65,7 @@
6165
"title": "Calendar Event",
6266
"description": "Create a binary sensor that is on if any entity with the label has the specified state.",
6367
"data": {
68+
"calendar_entity": "Kalender",
6469
"label": "Label",
6570
"state_to": "Is"
6671
}
@@ -69,6 +74,7 @@
6974
"title": "Label Not State",
7075
"description": "Create a binary sensor that is on if any entity with the label does not have the specified state.",
7176
"data": {
77+
"calendar_entity": "Kalender",
7278
"label": "Label",
7379
"state_not": "Not"
7480
}

custom_components/calendar_event/translations/en.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"title": "Label Numeric State",
1818
"description": "Create a binary sensor that is on if any entities value with the label is outside of its normal bounds.",
1919
"data": {
20+
"calendar_entity": "Calendar",
2021
"label": "Label",
2122
"name": "Name",
2223
"state_lower_limit": "Lower bound",
@@ -27,6 +28,7 @@
2728
"title": "Calendar Event",
2829
"description": "Create a binary sensor that is on if any entity with the label has the specified state.",
2930
"data": {
31+
"calendar_entity": "Calendar",
3032
"label": "Label",
3133
"name": "Name",
3234
"state_to": "Is"
@@ -36,6 +38,7 @@
3638
"title": "Label Not State",
3739
"description": "Create a binary sensor that is on if any entity with the label does not have the specified state.",
3840
"data": {
41+
"calendar_entity": "Calendar",
3942
"label": "Label",
4043
"name": "Name",
4144
"state_not": "Not"
@@ -52,6 +55,7 @@
5255
"title": "Label Numeric State",
5356
"description": "Create a binary sensor that is on if any entities value with the label is outside of its normal bounds.",
5457
"data": {
58+
"calendar_entity": "Calendar",
5559
"label": "Label",
5660
"state_lower_limit": "Lower bound",
5761
"state_upper_limit": "Upper bound"
@@ -61,6 +65,7 @@
6165
"title": "Calendar Event",
6266
"description": "Create a binary sensor that is on if any entity with the label has the specified state.",
6367
"data": {
68+
"calendar_entity": "Calendar",
6469
"label": "Label",
6570
"state_to": "Is"
6671
}
@@ -69,6 +74,7 @@
6974
"title": "Label Not State",
7075
"description": "Create a binary sensor that is on if any entity with the label does not have the specified state.",
7176
"data": {
77+
"calendar_entity": "Calendar",
7278
"label": "Label",
7379
"state_not": "Not"
7480
}

0 commit comments

Comments
 (0)