Skip to content

Commit 348ebe1

Browse files
authored
Adds create_daily action to Habitica integration (#140684)
Add create_daily action
1 parent d20fc30 commit 348ebe1

File tree

6 files changed

+319
-22
lines changed

6 files changed

+319
-22
lines changed

homeassistant/components/habitica/const.py

+1
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
SERVICE_UPDATE_TODO = "update_todo"
8080
SERVICE_CREATE_TODO = "create_todo"
8181
SERVICE_UPDATE_DAILY = "update_daily"
82+
SERVICE_CREATE_DAILY = "create_daily"
8283

8384
DEVELOPER_ID = "4c4ca53f-c059-4ffa-966e-9d29dd405daf"
8485
X_CLIENT = f"{DEVELOPER_ID} - {APPLICATION_NAME} {__version__}"

homeassistant/components/habitica/icons.json

+8
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,14 @@
270270
"repeat_weekly_options": "mdi:calendar-refresh",
271271
"repeat_monthly_options": "mdi:calendar-refresh"
272272
}
273+
},
274+
"create_daily": {
275+
"service": "mdi:calendar-month",
276+
"sections": {
277+
"developer_options": "mdi:test-tube",
278+
"repeat_weekly_options": "mdi:calendar-refresh",
279+
"repeat_monthly_options": "mdi:calendar-refresh"
280+
}
273281
}
274282
}
275283
}

homeassistant/components/habitica/services.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@
8484
SERVICE_API_CALL,
8585
SERVICE_CANCEL_QUEST,
8686
SERVICE_CAST_SKILL,
87+
SERVICE_CREATE_DAILY,
8788
SERVICE_CREATE_HABIT,
8889
SERVICE_CREATE_REWARD,
8990
SERVICE_CREATE_TODO,
@@ -243,6 +244,7 @@
243244
SERVICE_UPDATE_TODO: TaskType.TODO,
244245
SERVICE_CREATE_TODO: TaskType.TODO,
245246
SERVICE_UPDATE_DAILY: TaskType.DAILY,
247+
SERVICE_CREATE_DAILY: TaskType.DAILY,
246248
}
247249

248250

@@ -913,7 +915,12 @@ async def create_tag(tag_name: str) -> UUID:
913915
schema=SERVICE_UPDATE_TASK_SCHEMA,
914916
supports_response=SupportsResponse.ONLY,
915917
)
916-
for service in (SERVICE_CREATE_HABIT, SERVICE_CREATE_REWARD, SERVICE_CREATE_TODO):
918+
for service in (
919+
SERVICE_CREATE_DAILY,
920+
SERVICE_CREATE_HABIT,
921+
SERVICE_CREATE_REWARD,
922+
SERVICE_CREATE_TODO,
923+
):
917924
hass.services.async_register(
918925
DOMAIN,
919926
service,

homeassistant/components/habitica/services.yaml

+22-7
Original file line numberDiff line numberDiff line change
@@ -347,11 +347,11 @@ update_daily:
347347
notes: *notes
348348
checklist_options: *checklist_options
349349
priority: *priority
350-
start_date:
350+
start_date: &start_date
351351
required: false
352352
selector:
353353
date:
354-
frequency:
354+
frequency: &frequency_daily
355355
required: false
356356
selector:
357357
select:
@@ -362,15 +362,15 @@ update_daily:
362362
- "yearly"
363363
translation_key: "frequency"
364364
mode: dropdown
365-
every_x:
365+
every_x: &every_x
366366
required: false
367367
selector:
368368
number:
369369
min: 0
370370
step: 1
371371
unit_of_measurement: "🔃"
372372
mode: box
373-
repeat_weekly_options:
373+
repeat_weekly_options: &repeat_weekly_options
374374
collapsed: true
375375
fields:
376376
repeat:
@@ -388,7 +388,7 @@ update_daily:
388388
mode: list
389389
translation_key: repeat
390390
multiple: true
391-
repeat_monthly_options:
391+
repeat_monthly_options: &repeat_monthly_options
392392
collapsed: true
393393
fields:
394394
repeat_monthly:
@@ -403,7 +403,7 @@ update_daily:
403403
reminder_options:
404404
collapsed: true
405405
fields:
406-
reminder:
406+
reminder: &reminder_daily
407407
required: false
408408
selector:
409409
text:
@@ -420,7 +420,7 @@ update_daily:
420420
developer_options:
421421
collapsed: true
422422
fields:
423-
streak:
423+
streak: &streak
424424
required: false
425425
selector:
426426
number:
@@ -429,3 +429,18 @@ update_daily:
429429
unit_of_measurement: "▶▶"
430430
mode: box
431431
alias: *alias
432+
create_daily:
433+
fields:
434+
config_entry: *config_entry
435+
name: *name
436+
notes: *notes
437+
add_checklist_item: *add_checklist_item
438+
priority: *priority
439+
start_date: *start_date
440+
frequency: *frequency_daily
441+
every_x: *every_x
442+
repeat_weekly_options: *repeat_weekly_options
443+
repeat_monthly_options: *repeat_monthly_options
444+
reminder: *reminder_daily
445+
tag: *tag
446+
developer_options: *developer_options

homeassistant/components/habitica/strings.json

+97-13
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,19 @@
5252
"reminder_options_description": "Add, remove or clear reminders of a Habitica task.",
5353
"date_name": "Due date",
5454
"date_description": "The to-do's due date.",
55-
"repeat_name": "Repeat on"
55+
"repeat_name": "Repeat on",
56+
"start_date_name": "Start date",
57+
"start_date_description": "Defines when the daily task becomes active and specifies the exact weekday or day of the month it repeats on.",
58+
"frequency_daily_name": "Repeat interval",
59+
"frequency_daily_description": "The repetition interval of a daily.",
60+
"every_x_name": "Repeat every X",
61+
"every_x_description": "The number of intervals (days, weeks, months, or years) after which the daily repeats, based on the chosen repetition interval. A value of 0 makes the daily inactive ('Grey Daily').",
62+
"repeat_weekly_description": "The days of the week the daily repeats.",
63+
"repeat_monthly_description": "Whether a monthly recurring task repeats on the same calendar day each month or on the same weekday and week of the month, based on the start date.",
64+
"repeat_weekly_options_name": "Weekly repeat days",
65+
"repeat_weekly_options_description": "Options related to weekly repetition, applicable when the repetition interval is set to weekly.",
66+
"repeat_monthly_options_name": "Monthly repeat day",
67+
"repeat_monthly_options_description": "Options related to monthly repetition, applicable when the repetition interval is set to monthly."
5668
},
5769
"config": {
5870
"abort": {
@@ -1076,24 +1088,24 @@
10761088
"description": "[%key:component::habitica::common::priority_description%]"
10771089
},
10781090
"start_date": {
1079-
"name": "Start date",
1080-
"description": "Defines when the daily task becomes active and specifies the exact weekday or day of the month it repeats on."
1091+
"name": "[%key:component::habitica::common::start_date_name%]",
1092+
"description": "[%key:component::habitica::common::start_date_description%]"
10811093
},
10821094
"frequency": {
1083-
"name": "Repeat interval",
1084-
"description": "The repetition interval of a daily."
1095+
"name": "[%key:component::habitica::common::frequency_daily_name%]",
1096+
"description": "[%key:component::habitica::common::frequency_daily_description%]"
10851097
},
10861098
"every_x": {
1087-
"name": "Repeat every X",
1088-
"description": "The number of intervals (days, weeks, months, or years) after which the daily repeats, based on the chosen repetition interval. A value of 0 makes the daily inactive ('Grey Daily')."
1099+
"name": "[%key:component::habitica::common::every_x_name%]",
1100+
"description": "[%key:component::habitica::common::every_x_description%]"
10891101
},
10901102
"repeat": {
10911103
"name": "[%key:component::habitica::common::repeat_name%]",
1092-
"description": "The days of the week the daily repeats."
1104+
"description": "[%key:component::habitica::common::repeat_weekly_description%]"
10931105
},
10941106
"repeat_monthly": {
10951107
"name": "[%key:component::habitica::common::repeat_name%]",
1096-
"description": "Whether a monthly recurring task repeats on the same calendar day each month or on the same weekday and week of the month, based on the start date."
1108+
"description": "[%key:component::habitica::common::repeat_monthly_description%]"
10971109
},
10981110
"add_checklist_item": {
10991111
"name": "[%key:component::habitica::common::add_checklist_item_name%]",
@@ -1134,12 +1146,12 @@
11341146
"description": "[%key:component::habitica::common::checklist_options_description%]"
11351147
},
11361148
"repeat_weekly_options": {
1137-
"name": "Weekly repeat days",
1138-
"description": "Options related to weekly repetition, applicable when the repetition interval is set to weekly."
1149+
"name": "[%key:component::habitica::common::repeat_weekly_options_name%]",
1150+
"description": "[%key:component::habitica::common::repeat_weekly_options_description%]"
11391151
},
11401152
"repeat_monthly_options": {
1141-
"name": "Monthly repeat day",
1142-
"description": "Options related to monthly repetition, applicable when the repetition interval is set to monthly."
1153+
"name": "[%key:component::habitica::common::repeat_monthly_options_name%]",
1154+
"description": "[%key:component::habitica::common::repeat_monthly_options_description%]"
11431155
},
11441156
"tag_options": {
11451157
"name": "[%key:component::habitica::common::tag_options_name%]",
@@ -1154,6 +1166,78 @@
11541166
"description": "[%key:component::habitica::common::reminder_options_description%]"
11551167
}
11561168
}
1169+
},
1170+
"create_daily": {
1171+
"name": "Create a daily",
1172+
"description": "Adds a new daily.",
1173+
"fields": {
1174+
"config_entry": {
1175+
"name": "[%key:component::habitica::common::config_entry_name%]",
1176+
"description": "[%key:component::habitica::common::config_entry_description%]"
1177+
},
1178+
"name": {
1179+
"name": "[%key:component::habitica::common::task_name%]",
1180+
"description": "[%key:component::habitica::common::name_description%]"
1181+
},
1182+
"notes": {
1183+
"name": "[%key:component::habitica::common::notes_name%]",
1184+
"description": "[%key:component::habitica::common::notes_description%]"
1185+
},
1186+
"tag": {
1187+
"name": "[%key:component::habitica::common::tag_options_name%]",
1188+
"description": "[%key:component::habitica::common::tag_description%]"
1189+
},
1190+
"alias": {
1191+
"name": "[%key:component::habitica::common::alias_name%]",
1192+
"description": "[%key:component::habitica::common::alias_description%]"
1193+
},
1194+
"priority": {
1195+
"name": "[%key:component::habitica::common::priority_name%]",
1196+
"description": "[%key:component::habitica::common::priority_description%]"
1197+
},
1198+
"start_date": {
1199+
"name": "[%key:component::habitica::common::start_date_name%]",
1200+
"description": "[%key:component::habitica::common::start_date_description%]"
1201+
},
1202+
"frequency": {
1203+
"name": "[%key:component::habitica::common::frequency_daily_name%]",
1204+
"description": "[%key:component::habitica::common::frequency_daily_description%]"
1205+
},
1206+
"every_x": {
1207+
"name": "[%key:component::habitica::common::every_x_name%]",
1208+
"description": "[%key:component::habitica::common::every_x_description%]"
1209+
},
1210+
"repeat": {
1211+
"name": "[%key:component::habitica::common::repeat_name%]",
1212+
"description": "[%key:component::habitica::common::repeat_weekly_description%]"
1213+
},
1214+
"repeat_monthly": {
1215+
"name": "[%key:component::habitica::common::repeat_name%]",
1216+
"description": "[%key:component::habitica::common::repeat_monthly_description%]"
1217+
},
1218+
"add_checklist_item": {
1219+
"name": "[%key:component::habitica::common::checklist_options_name%]",
1220+
"description": "[%key:component::habitica::common::add_checklist_item_description%]"
1221+
},
1222+
"reminder": {
1223+
"name": "[%key:component::habitica::common::reminder_options_name%]",
1224+
"description": "[%key:component::habitica::common::reminder_description%]"
1225+
}
1226+
},
1227+
"sections": {
1228+
"repeat_weekly_options": {
1229+
"name": "[%key:component::habitica::common::repeat_weekly_options_name%]",
1230+
"description": "[%key:component::habitica::common::repeat_weekly_options_description%]"
1231+
},
1232+
"repeat_monthly_options": {
1233+
"name": "[%key:component::habitica::common::repeat_monthly_options_name%]",
1234+
"description": "[%key:component::habitica::common::repeat_monthly_options_description%]"
1235+
},
1236+
"developer_options": {
1237+
"name": "[%key:component::habitica::common::developer_options_name%]",
1238+
"description": "[%key:component::habitica::common::developer_options_description%]"
1239+
}
1240+
}
11571241
}
11581242
},
11591243
"selector": {

0 commit comments

Comments
 (0)