Home Assistant Unofficial Reference 2024.12.1
homeassistant.components.habitica.util Namespace Reference

Functions

rrule build_rrule (dict[str, Any] task)
 
list[str] entity_used_in (HomeAssistant hass, str entity_id)
 
dict[str, float] get_attribute_points (dict[str, Any] user, dict[str, Any] content, str attribute)
 
int get_attributes_total (dict[str, Any] user, dict[str, Any] content, str attribute)
 
str get_recurrence_rule (rrule recurrence)
 
datetime.date|None next_due_date (dict[str, Any] task, str last_cron)
 
datetime.date|None to_date (str date)
 

Variables

dictionary FREQUENCY_MAP = {"daily": DAILY, "weekly": WEEKLY, "monthly": MONTHLY, "yearly": YEARLY}
 
dictionary WEEKDAY_MAP = {"m": MO, "t": TU, "w": WE, "th": TH, "f": FR, "s": SA, "su": SU}
 

Detailed Description

Utility functions for Habitica.

Function Documentation

◆ build_rrule()

rrule homeassistant.components.habitica.util.build_rrule ( dict[str, Any]  task)
Build rrule string.

Definition at line 87 of file util.py.

◆ entity_used_in()

list[str] homeassistant.components.habitica.util.entity_used_in ( HomeAssistant  hass,
str  entity_id 
)
Get list of related automations and scripts.

Definition at line 76 of file util.py.

◆ get_attribute_points()

dict[str, float] homeassistant.components.habitica.util.get_attribute_points ( dict[str, Any]  user,
dict[str, Any]  content,
str   attribute 
)
Get modifiers contributing to strength attribute.

Definition at line 145 of file util.py.

◆ get_attributes_total()

int homeassistant.components.habitica.util.get_attributes_total ( dict[str, Any]  user,
dict[str, Any]  content,
str   attribute 
)
Get total attribute points.

Definition at line 185 of file util.py.

◆ get_recurrence_rule()

str homeassistant.components.habitica.util.get_recurrence_rule ( rrule  recurrence)
Extract and return the recurrence rule portion of an RRULE.

This function takes an RRULE representing a task's recurrence pattern,
builds the RRULE string, and extracts the recurrence rule part.

'DTSTART:YYYYMMDDTHHMMSS\nRRULE:FREQ=YEARLY;INTERVAL=2'

Parameters
----------
recurrence : rrule
    An RRULE object.

Returns
-------
str
    The recurrence rule portion of the RRULE string, starting with 'FREQ='.

Example
-------
>>> rule = get_recurrence_rule(task)
>>> print(rule)
'FREQ=YEARLY;INTERVAL=2'

Definition at line 117 of file util.py.

◆ next_due_date()

datetime.date | None homeassistant.components.habitica.util.next_due_date ( dict[str, Any]  task,
str  last_cron 
)
Calculate due date for dailies and yesterdailies.

Definition at line 30 of file util.py.

◆ to_date()

datetime.date | None homeassistant.components.habitica.util.to_date ( str  date)
Convert an iso date to a datetime.date object.

Definition at line 61 of file util.py.

Variable Documentation

◆ FREQUENCY_MAP

dictionary homeassistant.components.habitica.util.FREQUENCY_MAP = {"daily": DAILY, "weekly": WEEKLY, "monthly": MONTHLY, "yearly": YEARLY}

Definition at line 83 of file util.py.

◆ WEEKDAY_MAP

dictionary homeassistant.components.habitica.util.WEEKDAY_MAP = {"m": MO, "t": TU, "w": WE, "th": TH, "f": FR, "s": SA, "su": SU}

Definition at line 84 of file util.py.