AutomationDataset/OneStatePackages/automation-descriptions.json

106 lines
16 KiB
JSON

[
{
"id": "Package Dieta - Notifica Giornaliera Dieta su Telegram",
"result": {
"structured": "TRIGGER: When the time reaches the value set in diet notification time [input_datetime.diet_notification_time] OR When a Telegram command event with command '/diet' is received OR When a Telegram command event with command '/diet_today' is received. CONDITIONS: ((trigger.platform is 'time' AND diet notification switch [input_boolean.diet_notification_switch] is on) OR (trigger.platform is 'event')). ACTIONS: Set variable 'days' mapping weekday names to lowercase. Set variable 'today' to the lowercase English weekday. Set variable 'days_it' mapping English weekdays to Italian. Set variable 'today_it' to the Italian weekday. Set variable 'list' to the yaml_list attribute from weekly diet sensor [sensor.weekly_diet] or an empty list. Set variable 'data' to a formatted Markdown string containing the diet for the current day (breakfast, lunch, dinner, snack) using the Italian weekday name. Select the option corresponding to the current English weekday in diet day selector [input_select.diet_day]. Send a Telegram message to target 1234567890 with the Markdown content from variable 'data' and an inline keyboard with buttons for editing, selecting days, and other commands.",
"natural_language": {
"trigger": "The automation triggers either at a specific scheduled time set in diet notification time [input_datetime.diet_notification_time], or when a Telegram command '/diet' is received, or when a Telegram command '/diet_today' is received.",
"conditions": "If the trigger is the scheduled time, then the diet notification switch [input_boolean.diet_notification_switch] must be turned on. If the trigger is a Telegram command event, no additional condition is required.",
"action": "The automation prepares the daily diet information. It determines the current day in English and Italian, fetches the diet data for that day from the weekly diet sensor [sensor.weekly_diet], and formats it into a message. It then updates the diet day selector [input_select.diet_day] to reflect the current day. Finally, it sends a formatted Markdown message with the day's diet (breakfast, lunch, dinner, snack) to a specified Telegram user, along with an interactive keyboard for managing the diet."
},
"human_like": "Sends a daily diet summary via Telegram, either on a schedule or upon request, and provides buttons to easily edit or view other days.",
"complexity": "medium"
}
},
{
"id": "Package Dieta - Azioni Dieta via Telegram",
"result": {
"structured": "TRIGGER: When a telegram_callback event occurs. CONDITIONS: The callback data starts with '/diet_' OR starts with '/day_'. ACTIONS: Set variables 'command' and 'giorni_it'. Then, execute one of the following sequences based on the command: 1. If command equals '/diet_cancel': Delete the Telegram message and answer the callback query. 2. If command starts with '/day_': Set variable 'day' to the command suffix, set the diet day selector [input_select.diet_day] to that day, wait up to 5 seconds for the selector to match, then fire a new telegram_callback event with data '/diet_today'. 3. If command equals '/diet_today': Set variables for the selected day, its Italian translation, and meal data from weekly diet sensor [sensor.weekly_diet]. Edit the Telegram message to show the diet for the day with an inline keyboard for editing meals, selecting days, resetting, updating, or canceling. Then answer the callback query. 4. If command equals '/diet_edit_breakfast', '/diet_edit_lunch', '/diet_edit_dinner', or '/diet_edit_snack': Run the reset input text diet script [script.reset_input_text_diet], wait 1 second, set diet edit active [input_text.diet_edit_active] to the meal type, and answer the callback query with an instruction message. 5. If command equals '/diet_reset_day': Run the reset input text diet script [script.reset_input_text_diet], wait 1 second, run the reset diet split json script [script.reset_diet_split_json], and answer the callback query with a confirmation message. 6. For any other command (that is not '/diet_today', does not start with '/day_', and is not '/diet_cancel'): Answer the callback query with a prompt to write the meal in the text field.",
"natural_language": {
"trigger": "When a button is pressed on a Telegram message (a callback event is received).",
"conditions": "The data from the pressed button must start with either '/diet_' or '/day_'.",
"action": "The automation first stores the button command and a mapping of English to Italian day names. It then performs different actions based on the exact command. If the command is to cancel, it deletes the message and closes the query. If a day is selected (like '/day_monday'), it updates the diet day selector, waits for the change to take effect, and then triggers a refresh to show that day's diet. If the command is to show today's diet, it fetches the currently selected day, translates it to Italian, retrieves the meal plan for that day from the weekly diet sensor, and updates the Telegram message with a formatted display of breakfast, lunch, dinner, and snack, along with interactive buttons for editing, changing days, resetting, or canceling. If the command is to edit a specific meal (breakfast, lunch, dinner, or snack), it runs a script to reset the input text, sets a text input entity to track which meal is being edited, and sends a prompt asking the user to type the new meal details. If the command is to reset the entire day's meals, it runs scripts to clear the input text and reset the diet data, then confirms the action. For any other valid edit command not covered above, it simply prompts the user to type the meal details in the text field."
},
"human_like": "This automation manages a weekly diet plan via Telegram, allowing users to view, select days, edit meals, and reset the plan through interactive buttons.",
"complexity": "high"
}
},
{
"id": "Package Dieta - Ricezione Testo da Telegram",
"result": {
"structured": "TRIGGER: When a telegram_text event occurs. CONDITIONS: diet edit active [input_text.diet_edit_active] is not empty. ACTIONS: Set variable 'type' to the current value of diet edit active [input_text.diet_edit_active]. Set variable 'text' to the text from the telegram event. Set the value of input_text.diet_{{ type }} to the value of variable 'text'. Execute the save diet split json script [script.save_diet_split_json]. Clear the value of diet edit active [input_text.diet_edit_active]. Send a Telegram message to target 1234567890 with a confirmation message that translates the 'type' variable to a meal name (e.g., Colazione for breakfast) and instructs to press 'Aggiorna'. Wait for 1 second. Delete the last message sent to Telegram chat 1234567890. Delete the last message sent to Telegram chat 1234567890 again.",
"natural_language": {
"trigger": "When a text message is received via Telegram.",
"conditions": "The input text field 'diet edit active' [input_text.diet_edit_active] must contain a value, indicating that a diet entry is being edited.",
"action": "The automation extracts the type of meal being edited from the 'diet edit active' field and the new text from the Telegram message. It then updates the corresponding diet input text field (e.g., input_text.diet_breakfast) with the new text, runs a script to save the updated diet data, and clears the 'diet edit active' field. It sends a confirmation message back to the user on Telegram, waits one second, and then deletes the last two messages sent to the chat."
},
"human_like": "Updates a diet entry based on a received Telegram message and sends a confirmation, cleaning up the chat afterwards.",
"complexity": "medium"
}
},
{
"id": "Package Dieta - Reset dei Campi di Testo",
"result": {
"structured": "TRIGGER: When diet day selector [input_select.diet_day] changes state. CONDITIONS: None. ACTIONS: Execute reset input text diet script [script.reset_input_text_diet].",
"natural_language": {
"trigger": "Whenever the diet day selector [input_select.diet_day] changes its value.",
"conditions": "There are no conditions that must be met.",
"action": "Runs the script named reset input text diet script [script.reset_input_text_diet]."
},
"human_like": "Resets the diet-related text fields whenever the selected diet day is changed.",
"complexity": "low"
}
},
{
"id": "Package Diet - Telegram Daily Diet Notification",
"result": {
"structured": "TRIGGER: When the scheduled time reaches diet notification time [input_datetime.diet_notification_time] OR When a Telegram command event with command '/diet' occurs OR When a Telegram command event with command '/diet_today' occurs. CONDITIONS: ((trigger.platform is 'time' AND diet notification switch [input_boolean.diet_notification_switch] is on) OR (trigger.platform is 'event')). ACTIONS: Set variable 'today' to the current weekday. Retrieve the diet list from weekly diet sensor [sensor.weekly_diet] attribute 'yaml_list'. Format a message with the diet plan for the current day (breakfast, lunch, dinner, snack). Set diet day selector [input_select.diet_day] to the current weekday. Send a formatted Telegram message to target 1234567890 with the diet plan and an inline keyboard for editing and navigation.",
"natural_language": {
"trigger": "The automation triggers either at a specific scheduled time set by diet notification time [input_datetime.diet_notification_time], or when a Telegram command '/diet' is received, or when a Telegram command '/diet_today' is received.",
"conditions": "If the trigger is the scheduled time, then the diet notification switch [input_boolean.diet_notification_switch] must be turned on. If the trigger is a Telegram command event, no additional conditions are required.",
"action": "The automation determines the current day of the week and fetches the diet plan data from the weekly diet sensor [sensor.weekly_diet]. It then composes a formatted message showing the diet for the day (breakfast, lunch, dinner, and snack). It updates the diet day selector [input_select.diet_day] to reflect the current day and sends the message via Telegram to a specific user, including interactive buttons for editing diet items, switching days, and other commands."
},
"human_like": "Sends a daily diet plan via Telegram, either on a schedule or upon request, and allows easy editing of meal entries through an interactive menu.",
"complexity": "medium"
}
},
{
"id": "Package Diet - Telegram Diet Actions",
"result": {
"structured": "TRIGGER: When a telegram_callback event occurs. CONDITIONS: The callback data starts with '/diet_' OR starts with '/day_'. ACTIONS: Store the callback data in a variable 'command'. Then, execute one of the following sequences based on the command: 1. If command equals '/diet_cancel', delete the Telegram message and answer the callback query. 2. If command starts with '/day_', set input_select.diet_day to the extracted day, wait up to 5 seconds for the selection to take effect, then trigger a new telegram_callback event with data '/diet_today'. 3. If command equals '/diet_today', retrieve the current day from input_select.diet_day and the diet data from sensor.weekly_diet, format a message with breakfast, lunch, dinner, and snack details, edit the original Telegram message to show this diet plan with an inline keyboard, and answer the callback query. 4. If command equals '/diet_edit_breakfast', run script.reset_input_text_diet, wait 1 second, set input_text.diet_edit_active to 'breakfast', and answer the callback query with a prompt. 5. If command equals '/diet_edit_lunch', run script.reset_input_text_diet, wait 1 second, set input_text.diet_edit_active to 'lunch', and answer the callback query with a prompt. 6. If command equals '/diet_edit_dinner', run script.reset_input_text_diet, wait 1 second, set input_text.diet_edit_active to 'dinner', and answer the callback query with a prompt. 7. If command equals '/diet_edit_snack', run script.reset_input_text_diet, wait 1 second, set input_text.diet_edit_active to 'snack', and answer the callback query with a prompt. 8. If command equals '/diet_reset_day', run script.reset_input_text_diet, wait 1 second, run script.reset_diet_split_json, and answer the callback query with a confirmation. 9. For any other command that is not '/diet_today', does not start with '/day_', and is not '/diet_cancel', answer the callback query with an instruction.",
"natural_language": {
"trigger": "When a callback is received from a Telegram bot interaction.",
"conditions": "The callback data must begin with either '/diet_' or '/day_'.",
"action": "The automation captures the callback data and performs different actions based on its value. It can cancel the interaction, change the selected diet day, display the diet for the selected day, initiate editing for a specific meal (breakfast, lunch, dinner, or snack), reset the day's meals, or provide a general instruction. It interacts with the diet day selector [input_select.diet_day], the weekly diet sensor [sensor.weekly_diet], and the diet edit active [input_text.diet_edit_active] input, and uses scripts like reset input text diet script [script.reset_input_text_diet] and reset diet split json script [script.reset_diet_split_json]. It also sends responses back to Telegram by editing messages, deleting them, or answering callback queries."
},
"human_like": "Manages a diet plan via Telegram, allowing users to view, select days, edit meals, and reset data through interactive buttons.",
"complexity": "high"
}
},
{
"id": "Package Diet - Telegram Text Reception",
"result": {
"structured": "TRIGGER: When a telegram_text event occurs. CONDITIONS: diet edit active [input_text.diet_edit_active] is not empty. ACTIONS: Set variable 'type' to the current value of diet edit active [input_text.diet_edit_active]. Set variable 'text' to the text from the telegram_text event. Set the value of input_text.diet_{{ type }} to the value of variable 'text'. Execute script save diet split json [script.save_diet_split_json]. Clear the value of diet edit active [input_text.diet_edit_active] by setting it to an empty string. Send a Telegram message to target 1234567890 with the content '✅ [type capitalized] updated. Press Refresh to view the update.'. Wait for 1 second. Delete the last Telegram message sent to chat 1234567890. Delete the last Telegram message sent to chat 1234567890.",
"natural_language": {
"trigger": "When a new text message is received via Telegram.",
"conditions": "The diet edit active [input_text.diet_edit_active] field must contain a value, indicating that a diet editing session is active.",
"action": "The automation first captures the type of diet being edited from the diet edit active field and the text content from the Telegram message. It then updates the corresponding diet input text field with the new text, runs a script to save the diet data, and clears the active edit flag. Finally, it sends a confirmation message to Telegram, waits a moment, and deletes the last two messages in the chat to clean up."
},
"human_like": "Updates a specific diet entry with text received via Telegram and cleans up the chat afterwards.",
"complexity": "medium"
}
},
{
"id": "Package Diet - Reset text fields",
"result": {
"structured": "TRIGGER: When diet day selector [input_select.diet_day] changes state. CONDITIONS: None. ACTIONS: Execute reset input text diet script [script.reset_input_text_diet].",
"natural_language": {
"trigger": "Whenever the diet day selector [input_select.diet_day] changes to a new state.",
"conditions": "There are no conditions that must be met.",
"action": "Runs the reset input text diet script [script.reset_input_text_diet]."
},
"human_like": "Resets diet-related text fields whenever the selected diet day is changed.",
"complexity": "low"
}
}
]