Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds create_daily action to Habitica integration #140684

Merged
merged 1 commit into from
Mar 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions homeassistant/components/habitica/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
SERVICE_UPDATE_TODO = "update_todo"
SERVICE_CREATE_TODO = "create_todo"
SERVICE_UPDATE_DAILY = "update_daily"
SERVICE_CREATE_DAILY = "create_daily"

DEVELOPER_ID = "4c4ca53f-c059-4ffa-966e-9d29dd405daf"
X_CLIENT = f"{DEVELOPER_ID} - {APPLICATION_NAME} {__version__}"
Expand Down
8 changes: 8 additions & 0 deletions homeassistant/components/habitica/icons.json
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,14 @@
"repeat_weekly_options": "mdi:calendar-refresh",
"repeat_monthly_options": "mdi:calendar-refresh"
}
},
"create_daily": {
"service": "mdi:calendar-month",
"sections": {
"developer_options": "mdi:test-tube",
"repeat_weekly_options": "mdi:calendar-refresh",
"repeat_monthly_options": "mdi:calendar-refresh"
}
}
}
}
9 changes: 8 additions & 1 deletion homeassistant/components/habitica/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
SERVICE_API_CALL,
SERVICE_CANCEL_QUEST,
SERVICE_CAST_SKILL,
SERVICE_CREATE_DAILY,
SERVICE_CREATE_HABIT,
SERVICE_CREATE_REWARD,
SERVICE_CREATE_TODO,
Expand Down Expand Up @@ -243,6 +244,7 @@
SERVICE_UPDATE_TODO: TaskType.TODO,
SERVICE_CREATE_TODO: TaskType.TODO,
SERVICE_UPDATE_DAILY: TaskType.DAILY,
SERVICE_CREATE_DAILY: TaskType.DAILY,
}


Expand Down Expand Up @@ -913,7 +915,12 @@ async def create_tag(tag_name: str) -> UUID:
schema=SERVICE_UPDATE_TASK_SCHEMA,
supports_response=SupportsResponse.ONLY,
)
for service in (SERVICE_CREATE_HABIT, SERVICE_CREATE_REWARD, SERVICE_CREATE_TODO):
for service in (
SERVICE_CREATE_DAILY,
SERVICE_CREATE_HABIT,
SERVICE_CREATE_REWARD,
SERVICE_CREATE_TODO,
):
hass.services.async_register(
DOMAIN,
service,
Expand Down
29 changes: 22 additions & 7 deletions homeassistant/components/habitica/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -347,11 +347,11 @@ update_daily:
notes: *notes
checklist_options: *checklist_options
priority: *priority
start_date:
start_date: &start_date
required: false
selector:
date:
frequency:
frequency: &frequency_daily
required: false
selector:
select:
Expand All @@ -362,15 +362,15 @@ update_daily:
- "yearly"
translation_key: "frequency"
mode: dropdown
every_x:
every_x: &every_x
required: false
selector:
number:
min: 0
step: 1
unit_of_measurement: "🔃"
mode: box
repeat_weekly_options:
repeat_weekly_options: &repeat_weekly_options
collapsed: true
fields:
repeat:
Expand All @@ -388,7 +388,7 @@ update_daily:
mode: list
translation_key: repeat
multiple: true
repeat_monthly_options:
repeat_monthly_options: &repeat_monthly_options
collapsed: true
fields:
repeat_monthly:
Expand All @@ -403,7 +403,7 @@ update_daily:
reminder_options:
collapsed: true
fields:
reminder:
reminder: &reminder_daily
required: false
selector:
text:
Expand All @@ -420,7 +420,7 @@ update_daily:
developer_options:
collapsed: true
fields:
streak:
streak: &streak
required: false
selector:
number:
Expand All @@ -429,3 +429,18 @@ update_daily:
unit_of_measurement: "▶▶"
mode: box
alias: *alias
create_daily:
fields:
config_entry: *config_entry
name: *name
notes: *notes
add_checklist_item: *add_checklist_item
priority: *priority
start_date: *start_date
frequency: *frequency_daily
every_x: *every_x
repeat_weekly_options: *repeat_weekly_options
repeat_monthly_options: *repeat_monthly_options
reminder: *reminder_daily
tag: *tag
developer_options: *developer_options
110 changes: 97 additions & 13 deletions homeassistant/components/habitica/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,19 @@
"reminder_options_description": "Add, remove or clear reminders of a Habitica task.",
"date_name": "Due date",
"date_description": "The to-do's due date.",
"repeat_name": "Repeat on"
"repeat_name": "Repeat on",
"start_date_name": "Start date",
"start_date_description": "Defines when the daily task becomes active and specifies the exact weekday or day of the month it repeats on.",
"frequency_daily_name": "Repeat interval",
"frequency_daily_description": "The repetition interval of a daily.",
"every_x_name": "Repeat every X",
"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').",
"repeat_weekly_description": "The days of the week the daily repeats.",
"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.",
"repeat_weekly_options_name": "Weekly repeat days",
"repeat_weekly_options_description": "Options related to weekly repetition, applicable when the repetition interval is set to weekly.",
"repeat_monthly_options_name": "Monthly repeat day",
"repeat_monthly_options_description": "Options related to monthly repetition, applicable when the repetition interval is set to monthly."
},
"config": {
"abort": {
Expand Down Expand Up @@ -1076,24 +1088,24 @@
"description": "[%key:component::habitica::common::priority_description%]"
},
"start_date": {
"name": "Start date",
"description": "Defines when the daily task becomes active and specifies the exact weekday or day of the month it repeats on."
"name": "[%key:component::habitica::common::start_date_name%]",
"description": "[%key:component::habitica::common::start_date_description%]"
},
"frequency": {
"name": "Repeat interval",
"description": "The repetition interval of a daily."
"name": "[%key:component::habitica::common::frequency_daily_name%]",
"description": "[%key:component::habitica::common::frequency_daily_description%]"
},
"every_x": {
"name": "Repeat 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')."
"name": "[%key:component::habitica::common::every_x_name%]",
"description": "[%key:component::habitica::common::every_x_description%]"
},
"repeat": {
"name": "[%key:component::habitica::common::repeat_name%]",
"description": "The days of the week the daily repeats."
"description": "[%key:component::habitica::common::repeat_weekly_description%]"
},
"repeat_monthly": {
"name": "[%key:component::habitica::common::repeat_name%]",
"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."
"description": "[%key:component::habitica::common::repeat_monthly_description%]"
},
"add_checklist_item": {
"name": "[%key:component::habitica::common::add_checklist_item_name%]",
Expand Down Expand Up @@ -1134,12 +1146,12 @@
"description": "[%key:component::habitica::common::checklist_options_description%]"
},
"repeat_weekly_options": {
"name": "Weekly repeat days",
"description": "Options related to weekly repetition, applicable when the repetition interval is set to weekly."
"name": "[%key:component::habitica::common::repeat_weekly_options_name%]",
"description": "[%key:component::habitica::common::repeat_weekly_options_description%]"
},
"repeat_monthly_options": {
"name": "Monthly repeat day",
"description": "Options related to monthly repetition, applicable when the repetition interval is set to monthly."
"name": "[%key:component::habitica::common::repeat_monthly_options_name%]",
"description": "[%key:component::habitica::common::repeat_monthly_options_description%]"
},
"tag_options": {
"name": "[%key:component::habitica::common::tag_options_name%]",
Expand All @@ -1154,6 +1166,78 @@
"description": "[%key:component::habitica::common::reminder_options_description%]"
}
}
},
"create_daily": {
"name": "Create a daily",
"description": "Adds a new daily.",
"fields": {
"config_entry": {
"name": "[%key:component::habitica::common::config_entry_name%]",
"description": "[%key:component::habitica::common::config_entry_description%]"
},
"name": {
"name": "[%key:component::habitica::common::task_name%]",
"description": "[%key:component::habitica::common::name_description%]"
},
"notes": {
"name": "[%key:component::habitica::common::notes_name%]",
"description": "[%key:component::habitica::common::notes_description%]"
},
"tag": {
"name": "[%key:component::habitica::common::tag_options_name%]",
"description": "[%key:component::habitica::common::tag_description%]"
},
"alias": {
"name": "[%key:component::habitica::common::alias_name%]",
"description": "[%key:component::habitica::common::alias_description%]"
},
"priority": {
"name": "[%key:component::habitica::common::priority_name%]",
"description": "[%key:component::habitica::common::priority_description%]"
},
"start_date": {
"name": "[%key:component::habitica::common::start_date_name%]",
"description": "[%key:component::habitica::common::start_date_description%]"
},
"frequency": {
"name": "[%key:component::habitica::common::frequency_daily_name%]",
"description": "[%key:component::habitica::common::frequency_daily_description%]"
},
"every_x": {
"name": "[%key:component::habitica::common::every_x_name%]",
"description": "[%key:component::habitica::common::every_x_description%]"
},
"repeat": {
"name": "[%key:component::habitica::common::repeat_name%]",
"description": "[%key:component::habitica::common::repeat_weekly_description%]"
},
"repeat_monthly": {
"name": "[%key:component::habitica::common::repeat_name%]",
"description": "[%key:component::habitica::common::repeat_monthly_description%]"
},
"add_checklist_item": {
"name": "[%key:component::habitica::common::checklist_options_name%]",
"description": "[%key:component::habitica::common::add_checklist_item_description%]"
},
"reminder": {
"name": "[%key:component::habitica::common::reminder_options_name%]",
"description": "[%key:component::habitica::common::reminder_description%]"
}
},
"sections": {
"repeat_weekly_options": {
"name": "[%key:component::habitica::common::repeat_weekly_options_name%]",
"description": "[%key:component::habitica::common::repeat_weekly_options_description%]"
},
"repeat_monthly_options": {
"name": "[%key:component::habitica::common::repeat_monthly_options_name%]",
"description": "[%key:component::habitica::common::repeat_monthly_options_description%]"
},
"developer_options": {
"name": "[%key:component::habitica::common::developer_options_name%]",
"description": "[%key:component::habitica::common::developer_options_description%]"
}
}
}
},
"selector": {
Expand Down
Loading