327 lines
54 KiB
JSON
327 lines
54 KiB
JSON
[
|
|
{
|
|
"id": "ee_read_envoy_battery",
|
|
"result": {
|
|
"structured": "TRIGGER: When Home Assistant starts OR When the automation entity itself [this.entity_id] is on AND remains on for 1 second. CONDITIONS: None. ACTIONS: Repeat the following sequence 60 times: 1. Set variable request_time to the current time. 2. Execute the rest command read envoy batteries rest command [rest_command.read_envoy_batteries], storing the response in variable response, and continue on error. 3. Set variable response_time to the current time and calculate latency as the difference between response_time and request_time. 4. If a debug condition is met, send a persistent notification [notify.persistent_notification] with the response (this action is disabled). 5. Check a condition on the response: IF (response is undefined OR response.status equals 'timeout' OR response.status as integer equals 200) THEN send a persistent notification [notify.persistent_notification] with a timestamp and status, then stop the automation with an error (this stop action is disabled), then delay for 1 minute. ELSE parse the response content to extract battery data, then set EE observed charge [input_number.ee_observed_charge] to the average state of charge, set EE observed batteries [input_text.ee_observed_batteries] to the battery details list, set EE envoy battery reporting time [input_datetime.ee_envoy_battery_reporting_time] to the current time, set EE observed envoy read battery latency [input_number.ee_observed_envoy_read_battery_latency] to the calculated latency in milliseconds, then delay for 2 seconds. After the repeat loop, turn off the automation entity itself [this.entity_id], then turn it back on.",
|
|
"natural_language": {
|
|
"trigger": "The automation runs either when Home Assistant first starts up, or when the automation itself is turned on and remains in the 'on' state for at least one second.",
|
|
"conditions": "There are no conditions that must be met for the actions to proceed.",
|
|
"action": "The automation performs a loop 60 times. In each loop, it records the start time, calls a REST command to read battery data from an Envoy device, and records the end time to calculate the request latency. If the REST command fails or times out, it sends a notification and stops the automation (though this stop is currently disabled). If the command succeeds, it processes the battery data: it calculates the average state of charge and updates the EE observed charge input, stores the raw battery details in EE observed batteries, records the current time in EE envoy battery reporting time, and logs the request latency in EE observed envoy read battery latency. After each successful loop iteration, it waits for two seconds. After completing all 60 loops, the automation turns itself off and then immediately turns itself back on."
|
|
},
|
|
"human_like": "This automation reads battery data from an Envoy device 60 times in a row, updates several sensor values with the results, and then resets itself.",
|
|
"complexity": "high"
|
|
}
|
|
},
|
|
{
|
|
"id": "ee_read_envoy_livedata",
|
|
"result": {
|
|
"structured": "TRIGGER: When Home Assistant starts OR When the automation entity [this.entity_id] is on AND remains on for 1 second. CONDITIONS: None. ACTIONS: Repeat the following sequence 60 times: 1. Set variable 'request_time' to the current time. 2. Execute the rest command read envoy livedata status [rest_command.read_envoy_livedata_status] and store the response. 3. Set variable 'response_time' to the current time, 'just_now' to the formatted time, and 'latency' to the difference between request_time and response_time. 4. If the response is undefined, has status 'timeout', or has a status code of 200, then send a persistent notification [notify.persistent_notification] with a failure message and stop the repeat loop with an error. Otherwise, parse the response content. 5. If the stream connection status 'sc_stream' is 'enabled', then execute the rest command envoy enable livedata stream [rest_command.envoy_enable_livedata_stream], send a notification, and delay for 1 minute. 6. If the stream connection status 'sc_stream' is not 'enabled', then extract solar production, net consumption, battery flow, and home load values from the response, calculate total consumption, and update the following input numbers: EE observed battery flow [input_number.ee_observed_battery_flow], EE observed solar production [input_number.ee_observed_solar_production], EE observed net consumption [input_number.ee_observed_net_consumption], EE observed total consumption [input_number.ee_observed_total_consumption], EE observed home load [input_number.ee_observed_home_load]. Also update the datetime EE envoy pc reporting time [input_datetime.ee_envoy_pc_reporting_time] with the 'just_now' time and the latency number EE observed envoy read livedata latency [input_number.ee_observed_envoy_read_livedata_latency] with the calculated latency. Then delay for 1 second. After the repeat loop, turn off the automation entity [this.entity_id] and then turn it back on.",
|
|
"natural_language": {
|
|
"trigger": "The automation starts either when Home Assistant itself starts up, or when the automation's own entity is switched on and remains on for at least one second.",
|
|
"conditions": "There are no conditions that must be met for the automation to proceed.",
|
|
"action": "The automation performs a loop 60 times. In each loop, it attempts to read live data from an Envoy device by calling a REST command. It records the start time, makes the request, and records the end time to calculate latency. If the request fails (is undefined, times out, or returns a 200 status code, which appears to be a logic error for failure), it sends a persistent notification with an error message and stops the loop. If the request succeeds, it checks if the data stream from the Envoy is enabled. If the stream is enabled, it sends a command to enable the stream (which seems redundant), sends a notification, and waits one minute before the next loop iteration. If the stream is not enabled, it extracts solar production, net grid consumption, battery power flow, and home load data from the response. It calculates the total home consumption and updates several input_number helper entities with these values. It also records the time of the report and the request latency. It then waits one second before the next loop iteration. After completing all 60 loops, the automation turns itself off and then immediately turns itself back on."
|
|
},
|
|
"human_like": "This automation periodically fetches live solar and energy data from an Envoy device, updates dashboard sensors with the latest values, and handles errors or stream enabling if needed.",
|
|
"complexity": "high"
|
|
}
|
|
},
|
|
{
|
|
"id": "ee_read_envoy_relay",
|
|
"result": {
|
|
"structured": "TRIGGER: Every minute (time pattern: minutes divisible by 1). CONDITIONS: None. ACTIONS: Execute the REST command read envoy relay [rest_command.read_envoy_relay] and store the response. Extract the 'mains_oper_state' value from the response content. Set the value of EE observed grid status [input_text.ee_observed_grid_status] to the extracted grid status.",
|
|
"natural_language": {
|
|
"trigger": "The automation runs every minute.",
|
|
"conditions": "There are no conditions that must be met.",
|
|
"action": "It calls a REST command named read envoy relay [rest_command.read_envoy_relay] to fetch data. From the response, it extracts the current mains operating state. It then updates the text field EE observed grid status [input_text.ee_observed_grid_status] with this extracted value."
|
|
},
|
|
"human_like": "Checks the grid status from an Envoy device every minute and updates a text field with the result.",
|
|
"complexity": "low"
|
|
}
|
|
},
|
|
{
|
|
"id": "ee_read_envoy_tariff",
|
|
"result": {
|
|
"structured": "TRIGGER: Every minute (time pattern minutes: /1). CONDITIONS: None. ACTIONS: Execute read envoy tariff rest command [rest_command.read_envoy_tariff] and then execute ee decode tariff script [script.ee_decode_tariff] with the response from the previous command.",
|
|
"natural_language": {
|
|
"trigger": "The automation runs every minute.",
|
|
"conditions": "There are no conditions; it runs every time the trigger occurs.",
|
|
"action": "It first calls the 'read envoy tariff' REST command [rest_command.read_envoy_tariff] and stores its response. Then, it runs the 'ee decode tariff' script [script.ee_decode_tariff], passing the stored response to it."
|
|
},
|
|
"human_like": "Checks the Envoy tariff information every minute and processes the data.",
|
|
"complexity": "low"
|
|
}
|
|
},
|
|
{
|
|
"id": "ee_read_envoy_xml_info",
|
|
"result": {
|
|
"structured": "TRIGGER: When the time pattern matches every 12 hours (i.e., at 0 and 12 hours). CONDITIONS: None. ACTIONS: Execute the rest command read envoy relay rest command [rest_command.read_envoy_relay] and store the response in variable 'envoy_ivp_ensemble_relay'. Set variable 'content' to the response content and variable 'grid' to a boolean indicating if the mains_oper_state is 'closed'. Execute the rest command read envoy xml info rest command [rest_command.read_envoy_xml_info] and store the response in variable 'envoy_info_xml'. Set variable 'xml_text' to the response content, extract the <time> tag content into variable 'time_tag', derive the time value into variable 'time', extract the <software> tag content into variable 'software_tag', and derive the version string into variable 'vers'. Update variable 'xml_text' again to the response content, extract the <software> tag content again into variable 'software_tag', and derive the version string again into variable 'vers'. Finally, set the value of EE observed vers [input_text.ee_observed_vers] to the derived version string.",
|
|
"natural_language": {
|
|
"trigger": "The automation runs on a time pattern, specifically every 12 hours (at 0 and 12 hours).",
|
|
"conditions": "There are no conditions for this automation.",
|
|
"action": "First, it calls a REST command to read the Envoy relay status, storing the response and checking if the grid mains state is closed. Then, it calls another REST command to read Envoy XML information. From the XML response, it extracts the software version string using regular expressions. Finally, it updates the text input entity EE observed vers [input_text.ee_observed_vers] with the extracted software version."
|
|
},
|
|
"human_like": "This automation periodically fetches the software version from an Envoy device every 12 hours and stores it in a text field for monitoring.",
|
|
"complexity": "medium"
|
|
}
|
|
},
|
|
{
|
|
"id": "EE Set Hour of Day",
|
|
"result": {
|
|
"structured": "TRIGGER: When the time pattern matches every hour (hours: /1) OR when Home Assistant starts. CONDITIONS: None. ACTIONS: Set EE hour of day [input_number.ee_hour_of_day] to the current hour of the day.",
|
|
"natural_language": {
|
|
"trigger": "The automation triggers either at the start of every hour or when Home Assistant first starts up.",
|
|
"conditions": "There are no conditions that must be met for the action to run.",
|
|
"action": "Updates the EE hour of day [input_number.ee_hour_of_day] helper to reflect the current hour of the day."
|
|
},
|
|
"human_like": "Keeps a helper updated with the current hour of the day, refreshing every hour and on system startup.",
|
|
"complexity": "low"
|
|
}
|
|
},
|
|
{
|
|
"id": "ee_set_is_tou_workday",
|
|
"result": {
|
|
"structured": "TRIGGER: At 00:15:00 daily OR on Home Assistant start. CONDITIONS: None. ACTIONS: First, evaluate if today is a weekend (Saturday OR Sunday) OR if utility tou holidays calendar [calendar.utility_tou_holidays] state is 'on'. If true, turn off EE solar is tou workday [input_boolean.ee_solar_is_tou_workday]. If false, turn on EE solar is tou workday [input_boolean.ee_solar_is_tou_workday]. Then, if the trigger index is 0 (time trigger at 00:15:00), perform the following sequence: turn off While ZN Automation [automation.ee_while_zn] and While DL Automation [automation.ee_while_dl]; turn on While CP Automation [automation.ee_while_cp]; wait 5 seconds; trigger Read Envoy Tariff Automation [automation.ee_read_envoy_tariff]; wait 5 seconds; trigger Read Envoy Relay Automation [automation.ee_read_envoy_relay]; wait 5 seconds; trigger Read Envoy XML Info Automation [automation.ee_read_envoy_xml_info].",
|
|
"natural_language": {
|
|
"trigger": "The automation runs daily at 12:15 AM or when Home Assistant starts up.",
|
|
"conditions": "There are no conditions that must be met for the automation to proceed.",
|
|
"action": "First, it determines if today is a non-workday. It checks if it's a weekend (Saturday or Sunday) or if the utility tou holidays calendar [calendar.utility_tou_holidays] shows an event. If either is true, it marks the day as a non-workday by turning off EE solar is tou workday [input_boolean.ee_solar_is_tou_workday]. Otherwise, it marks it as a workday by turning the input boolean on. Then, if the automation was triggered by the scheduled time (not by the Home Assistant start event), it performs a series of actions to manage other automations: it stops the While ZN Automation [automation.ee_while_zn] and While DL Automation [automation.ee_while_dl], starts the While CP Automation [automation.ee_while_cp], and then, with 5-second delays between each, triggers the Read Envoy Tariff Automation [automation.ee_read_envoy_tariff], Read Envoy Relay Automation [automation.ee_read_envoy_relay], and Read Envoy XML Info Automation [automation.ee_read_envoy_xml_info]."
|
|
},
|
|
"human_like": "This automation sets the time-of-use workday status each day and, at midnight, coordinates a sequence of other automations to manage solar system data collection.",
|
|
"complexity": "medium"
|
|
}
|
|
},
|
|
{
|
|
"id": "ee_while_cp",
|
|
"result": {
|
|
"structured": "TRIGGER: When the template evaluates to true for 20 seconds (EE observed tariff [input_text.ee_observed_tariff] is 'CP' OR 'ZN' OR 'DL' AND EE observed solar production [input_number.ee_observed_solar_production] is greater than or equal to 100000 AND the automation itself is on) OR at 16:45:00. CONDITIONS: None. ACTIONS: Set variables: new_reserve from EE desired battery reserve [sensor.ee_desired_battery_reserve], workday from EE solar is tou workday [input_boolean.ee_solar_is_tou_workday] being on, dl_time from current time being at or after 16:44, observed_tariff from EE observed tariff [input_text.ee_observed_tariff], observed_production from EE observed solar production [input_number.ee_observed_solar_production]. IF workday AND dl_time are true THEN turn off this automation AND turn on While DL Automation [automation.ee_while_dl]. OTHERWISE set variables response.status to 'timeout' and attempts to 0. THEN REPEAT sequence: IF attempts > 0 THEN IF attempts < 10 THEN delay 2 seconds ELSE delay 30 minutes AND send a persistent notification [notify.persistent_notification] with a failure message. THEN call send envoy param tariff rest command [rest_command.send_envoy_param_tariff] with parameters peak_rule 'ZN', peak_start 420, peak_end 1141, reserve new_reserve, storing response. THEN increment attempts. WHILE attempts is 0 OR (response.status is 200 AND attempts < 100). AFTER loop, run ee decode tariff script [script.ee_decode_tariff] with the response. THEN delay 1 minute. THEN turn off this automation AND turn on While ZN Automation [automation.ee_while_zn].",
|
|
"natural_language": {
|
|
"trigger": "The automation triggers in one of two ways: either when a specific template condition holds true for 20 seconds, which requires the EE observed tariff [input_text.ee_observed_tariff] to be 'CP', 'ZN', or 'DL', the EE observed solar production [input_number.ee_observed_solar_production] to be at least 100,000, and the automation itself to be enabled. Alternatively, it triggers daily at 4:45 PM.",
|
|
"conditions": "There are no explicit conditions for this automation.",
|
|
"action": "First, several variables are set based on current system states, including the desired battery reserve, whether it's a workday, if the current time is 4:44 PM or later, and the current tariff and production values. If it's a workday and the time is 4:44 PM or later, the automation turns itself off and activates another automation called While DL Automation [automation.ee_while_dl]. Otherwise, it begins a retry loop to send a command to an Envoy device to set the tariff rule to 'ZN' with specific peak times and the current desired battery reserve. This loop retries up to 100 times, with short delays between attempts initially, and longer delays after 10 failed attempts, sending a notification on each failure after the first. Once the command succeeds (or the loop ends), a script is run to decode the tariff response, followed by a one-minute delay. Finally, the automation turns itself off and activates the While ZN Automation [automation.ee_while_zn]."
|
|
},
|
|
"human_like": "Manages the solar system's tariff mode during high production periods, switching to a specific schedule or handling failures with retries.",
|
|
"complexity": "high"
|
|
}
|
|
},
|
|
{
|
|
"id": "ee_while_dl",
|
|
"result": {
|
|
"structured": "TRIGGER: At 20:02:00 daily. CONDITIONS: None. ACTIONS: Turn off this automation [automation.ee_while_dl] AND Turn on While CP Automation [automation.ee_while_cp].",
|
|
"natural_language": {
|
|
"trigger": "Every day at 8:02 PM.",
|
|
"conditions": "There are no conditions that must be met.",
|
|
"action": "Disables itself (EE While DL) and enables another automation named While CP Automation [automation.ee_while_cp]."
|
|
},
|
|
"human_like": "At 8:02 PM, this automation turns itself off and starts another automation called While CP.",
|
|
"complexity": "low"
|
|
}
|
|
},
|
|
{
|
|
"id": "ee_while_zn",
|
|
"result": {
|
|
"structured": "TRIGGER: When the template condition (EE observed tariff [input_text.ee_observed_tariff] equals 'ZN' AND EE observed tariff battery reserve [input_number.ee_observed_tariff_battery_reserve] equals EE desired battery reserve [sensor.ee_desired_battery_reserve] AND this automation entity is on) remains true for 20 seconds OR When the template condition (EE observed tariff [input_text.ee_observed_tariff] equals 'ZN' AND EE observed solar production [input_number.ee_observed_solar_production] is less than 50000 AND this automation entity is on) remains true for 45 seconds OR At 16:45:00. CONDITIONS: None. ACTIONS: Set variables: tidx (trigger index), workday (if EE solar is tou workday [input_boolean.ee_solar_is_tou_workday] is on), observed_tariff (EE observed tariff [input_text.ee_observed_tariff]), observed_production (EE observed solar production [input_number.ee_observed_solar_production]). If tidx equals 0 (Climb Reserve in ZN trigger), set variable 'tariff' to a JSON object with peak_rule 'ZN', peak_start 420, peak_end 1141, and reserve equal to EE desired battery reserve [sensor.ee_desired_battery_reserve]. Otherwise, if tidx equals 2 (Ready for DL trigger) AND workday is false, stop the automation with message 'It is 4:45pm but not workday'. Otherwise, set variable 'tariff' to a JSON object with peak_rule 'DL', peak_start 1021 if workday else 780, peak_end 1201 if workday else 785, and reserve equal to the minimum of 50 and EE observed charge [input_number.ee_observed_charge]. Then, turn off this automation. Then, if workday is true AND the current time is after 16:44:00, turn on While DL Automation [automation.ee_while_dl]; otherwise, turn on While CP Automation [automation.ee_while_cp]. Then, set variables: response.status to 'timeout' and attempts to 0. Then, repeat the following sequence: If attempts is greater than 0, then if attempts is less than 10, delay for 2 seconds, otherwise delay for 30 minutes and send a persistent notification with a failure message. Then, call the send envoy param tariff rest command [rest_command.send_envoy_param_tariff] with the 'tariff' variable, storing the response. Then, increment attempts by 1. Continue repeating while attempts equals 0 OR (response.status equals 200 AND attempts is less than 100). Finally, run the ee decode tariff script [script.ee_decode_tariff] with the response variable.",
|
|
"natural_language": {
|
|
"trigger": "The automation triggers in three scenarios: 1) When the current observed tariff is 'ZN', the observed battery reserve matches the desired reserve, and this automation is active, and this condition holds for 20 seconds. 2) When the current observed tariff is 'ZN', the observed solar production is below 50,000, and this automation is active, and this condition holds for 45 seconds. 3) At exactly 4:45 PM.",
|
|
"conditions": "There are no explicit conditions; the logic is handled within the actions based on which trigger fired and the state of other variables.",
|
|
"action": "First, it captures the trigger index and checks if today is a workday. Depending on which trigger fired, it prepares a new tariff configuration. If the 'Climb Reserve in ZN' trigger fired, it sets a tariff for the ZN period. If the time trigger fired at 4:45 PM but it's not a workday, the automation stops. Otherwise, it sets a tariff for the DL period. It then turns itself off. Next, it activates either the 'While DL' or 'While CP' automation based on whether it's a workday and after 4:44 PM. The automation then attempts to send this new tariff configuration to the Envoy system via a REST command. It will retry this command up to 100 times with short delays, but if attempts exceed 10, it waits 30 minutes between tries and sends a persistent notification about the failure. Once a successful response is received or the retry limit is hit, it runs a script to decode the tariff response."
|
|
},
|
|
"human_like": "Manages the home's energy tariff during the 'ZN' period, automatically switching to a different rate (DL or CP) based on battery reserve, solar production, or a scheduled time, and coordinates with other automations.",
|
|
"complexity": "high"
|
|
}
|
|
},
|
|
{
|
|
"id": "ee_read_envoy_battery",
|
|
"result": {
|
|
"structured": "TRIGGER: When Home Assistant starts OR When the automation entity itself [this.entity_id] is on for 1 second. CONDITIONS: None. ACTIONS: Repeat the following sequence 60 times: 1. Set variable request_time to the current time. 2. Execute the read envoy batteries rest command [rest_command.read_envoy_batteries], storing the result in variable response. 3. Set variable response_time to the current time and calculate latency. 4. (Optional, disabled) Send a persistent notification [notify.persistent_notification] with the response. 5. If response is undefined, has status 'timeout', or has a status code of 200, then: send a persistent notification [notify.persistent_notification] with a timestamp and the status, then stop the repeat loop with an error and delay for 1 minute. Otherwise: a. Parse the response content to calculate total power (flow), total state of charge (soc), average state of charge (socpct), and a battery list (batts). b. Set EE observed charge [input_number.ee_observed_charge] to socpct. c. Set EE observed batteries [input_text.ee_observed_batteries] to batts. d. Set EE envoy battery reporting time [input_datetime.ee_envoy_battery_reporting_time] to the current time. e. Set EE observed envoy read battery latency [input_number.ee_observed_envoy_read_battery_latency] to the latency in milliseconds. f. Delay for 2 seconds. After the repeat loop, turn off the automation entity [this.entity_id], then turn it back on.",
|
|
"natural_language": {
|
|
"trigger": "The automation runs either when Home Assistant first starts up, or when the automation itself is turned on and remains on for at least one second.",
|
|
"conditions": "There are no conditions that must be met for the automation to proceed.",
|
|
"action": "The automation performs a loop 60 times. In each loop, it attempts to read battery data from an Envoy device via a REST command. It records the start time, makes the request, and records the end time to calculate the request latency. If the request fails (is undefined, times out, or returns a 200 status code—which appears to be a logic error, as 200 typically indicates success), it logs a notification and stops the loop after a one-minute delay. If the request is successful, it processes the response to calculate the total power flow, the total and average battery state of charge, and creates a list of battery data. It then updates several input entities: EE observed charge, EE observed batteries, EE envoy battery reporting time, and EE observed envoy read battery latency. After a two-second delay, the loop repeats. Once all 60 loops are complete, the automation turns itself off and then immediately turns itself back on."
|
|
},
|
|
"human_like": "This automation reads battery data from an Envoy system 60 times in a row when Home Assistant starts or when it's enabled, updating sensor values with the results and handling any request failures.",
|
|
"complexity": "high"
|
|
}
|
|
},
|
|
{
|
|
"id": "ee_read_envoy_livedata",
|
|
"result": {
|
|
"structured": "TRIGGER: When Home Assistant starts OR When the automation entity itself [this.entity_id] is on for 1 second. CONDITIONS: None. ACTIONS: Repeat the following sequence 60 times: 1. Set variable 'request_time' to current time. 2. Execute rest command read envoy livedata status [rest_command.read_envoy_livedata_status], store result in 'response', continue on error. 3. Set variable 'response_time' to current time, 'just_now' to formatted time, and 'latency' to response time minus request time. 4. (Disabled) Send a persistent notification [notify.persistent_notification] with the response. 5. IF response is undefined OR response.status is 'timeout' OR response.status equals 200, THEN: a. Send a persistent notification [notify.persistent_notification] with a timestamp and status message. b. (Disabled) Stop with error 'Rest command failed'. c. Delay for 1 minute. ELSE: a. Extract variables 'content', 'connection', 'sc_stream' from response. b. IF sc_stream equals 'enabled', THEN: i. Execute rest command envoy enable livedata stream [rest_command.envoy_enable_livedata_stream]. ii. Send a persistent notification [notify.persistent_notification] with a timestamp and 'Enabling Stream' message. iii. Delay for 1 minute. ELSE: i. Extract meter data variables: 'meters', 'last_update', 'solar_production', 'net_consumption', 'battery_flow', 'home_load', 'total_consumption'. ii. Set EE observed battery flow [input_number.ee_observed_battery_flow] to battery_flow. iii. Set EE observed solar production [input_number.ee_observed_solar_production] to solar_production. iv. Set EE observed net consumption [input_number.ee_observed_net_consumption] to net_consumption. v. Set EE observed total consumption [input_number.ee_observed_total_consumption] to total_consumption. vi. Set EE observed home load [input_number.ee_observed_home_load] to home_load. vii. Set EE envoy pc reporting time [input_datetime.ee_envoy_pc_reporting_time] to just_now. viii. Set EE observed envoy read livedata latency [input_number.ee_observed_envoy_read_livedata_latency] to latency (converted to milliseconds). ix. (Disabled) Send a persistent notification [notify.persistent_notification] with last_update. x. Delay for 1 second. After the repeat loop, turn off the automation entity [this.entity_id], then turn it back on.",
|
|
"natural_language": {
|
|
"trigger": "The automation runs either when Home Assistant starts up, or when the automation itself is turned on and remains on for at least one second.",
|
|
"conditions": "There are no conditions that must be met for the automation to proceed.",
|
|
"action": "The automation performs a loop 60 times. In each loop, it first records the current time, then attempts to read data from the Envoy device via a REST command. It records the response time and calculates the latency. If the REST command fails or times out, or if it returns a 200 status, a notification is sent and the loop pauses for one minute before continuing. If the command succeeds and returns data, it checks if the data stream is enabled. If the stream is not enabled, it sends a command to enable it, sends a notification, and waits a minute. If the stream is already enabled, it extracts solar production, net consumption, battery flow, and home load data from the response. It then updates several input_number entities with these values: EE observed battery flow, EE observed solar production, EE observed net consumption, EE observed total consumption, and EE observed home load. It also updates the reporting time and records the latency. After a one-second delay, the loop continues. Once all 60 loops are complete, the automation turns itself off and then immediately turns itself back on."
|
|
},
|
|
"human_like": "This automation periodically fetches live energy data from an Envoy device, updates dashboard sensors with the readings, and manages the data stream, restarting itself to run continuously.",
|
|
"complexity": "high"
|
|
}
|
|
},
|
|
{
|
|
"id": "ee_read_envoy_relay",
|
|
"result": {
|
|
"structured": "TRIGGER: Every minute (time pattern minutes: /1). CONDITIONS: None. ACTIONS: Execute the read envoy relay rest command [rest_command.read_envoy_relay] and store the response in a variable. Extract the 'mains_oper_state' value from the response content and set the EE observed grid status [input_text.ee_observed_grid_status] to that value.",
|
|
"natural_language": {
|
|
"trigger": "The automation runs every minute.",
|
|
"conditions": "There are no conditions; the automation runs unconditionally.",
|
|
"action": "It calls the 'read envoy relay' REST command, extracts the grid operating state from the response, and updates the 'EE observed grid status' text input with that value."
|
|
},
|
|
"human_like": "Checks the grid status from the Envoy device every minute and updates a text field with the result.",
|
|
"complexity": "low"
|
|
}
|
|
},
|
|
{
|
|
"id": "ee_read_envoy_tariff",
|
|
"result": {
|
|
"structured": "TRIGGER: Every minute (time pattern minutes: /1). CONDITIONS: None. ACTIONS: Execute read envoy tariff rest command [rest_command.read_envoy_tariff] and then execute ee decode tariff script [script.ee_decode_tariff] with the response from the first action.",
|
|
"natural_language": {
|
|
"trigger": "The automation runs every minute.",
|
|
"conditions": "There are no conditions; the automation runs whenever the trigger occurs.",
|
|
"action": "It first calls the 'read envoy tariff' REST command [rest_command.read_envoy_tariff] and stores its response. Then, it runs the 'ee decode tariff' script [script.ee_decode_tariff], passing the stored response to it."
|
|
},
|
|
"human_like": "Every minute, this automation fetches the current tariff data from the Envoy device and processes it.",
|
|
"complexity": "low"
|
|
}
|
|
},
|
|
{
|
|
"id": "ee_read_envoy_xml_info",
|
|
"result": {
|
|
"structured": "TRIGGER: When the time pattern matches every 12 hours (i.e., at 00:00 and 12:00). CONDITIONS: None. ACTIONS: Execute the following sequence: 1. Call the REST command read envoy relay rest command [rest_command.read_envoy_relay] and store the response in variable 'envoy_ivp_ensemble_relay'. 2. Set variable 'content' to the content of the response and variable 'grid' to a boolean indicating if the mains_oper_state is 'closed'. 3. Call the REST command read envoy xml info rest command [rest_command.read_envoy_xml_info] and store the response in variable 'envoy_info_xml'. 4. Set variable 'xml_text' to the content of the response, extract the software version string using regex patterns, and store it in variable 'vers'. 5. Set the value of EE observed vers [input_text.ee_observed_vers] to the extracted software version.",
|
|
"natural_language": {
|
|
"trigger": "The automation runs on a time schedule, specifically every 12 hours (at midnight and noon).",
|
|
"conditions": "There are no conditions that must be met for the automation to proceed.",
|
|
"action": "First, it makes a REST call to the Envoy device to read relay data, storing the response. It then checks if the mains operational state is 'closed' from that data. Next, it makes another REST call to fetch XML information from the Envoy. From the XML response, it extracts the software version string using regular expressions. Finally, it updates the text input entity EE observed vers [input_text.ee_observed_vers] with the extracted software version."
|
|
},
|
|
"human_like": "This automation periodically checks the Envoy device's software version every 12 hours and updates a text field with the latest version number.",
|
|
"complexity": "medium"
|
|
}
|
|
},
|
|
{
|
|
"id": "ee_read_envoy_battery",
|
|
"result": {
|
|
"structured": "TRIGGER: When Home Assistant starts OR When the automation entity itself [this.entity_id] is on for 1 second. CONDITIONS: None. ACTIONS: Repeat the following sequence 60 times: 1. Set variable request_time to the current time. 2. Execute the read envoy batteries rest command [rest_command.read_envoy_batteries] and store the response in variable response, continuing on error. 3. Set variable response_time to the current time and calculate latency as response_time minus request_time. 4. If the response is undefined, has a status of 'timeout', or has a non-200 HTTP status code, then send a persistent notification [notify.persistent_notification] with a failure message and delay for 1 minute. 5. Otherwise, parse the response content to calculate total power (flow), total state of charge (soc), average state of charge (socpct), and a list of battery states (batts). Then, set EE observed charge [input_number.ee_observed_charge] to socpct, set EE observed batteries [input_text.ee_observed_batteries] to batts, set EE envoy battery reporting time [input_datetime.ee_envoy_battery_reporting_time] to the current time, set EE observed envoy read battery latency [input_number.ee_observed_envoy_read_battery_latency] to the latency in milliseconds, and delay for 2 seconds. After the repeat loop, turn off the automation entity itself [this.entity_id] and then turn it back on.",
|
|
"natural_language": {
|
|
"trigger": "The automation starts either when Home Assistant itself starts up, or when the automation's own entity is in the 'on' state for at least one second.",
|
|
"conditions": "There are no conditions that must be met for the actions to run.",
|
|
"action": "The automation performs a loop 60 times. In each loop, it attempts to read battery data from an Envoy device via a REST command. It records the start time, makes the request, and records the end time to calculate the request latency. If the request fails (times out or returns a non-200 status), it sends a persistent notification with an error message and waits one minute before the next loop iteration. If the request succeeds, it processes the response to calculate the total power flow, the total and average battery state of charge, and a detailed list of battery states. It then updates several Home Assistant input entities: EE observed charge, EE observed batteries, EE envoy battery reporting time, and EE observed envoy read battery latency. After each successful read, it waits two seconds before the next loop iteration. Once all 60 loops are complete, the automation turns itself off and then immediately turns itself back on."
|
|
},
|
|
"human_like": "This automation reads battery data from an Envoy system 60 times in a row, updating dashboard values with the latest charge levels and performance metrics.",
|
|
"complexity": "high"
|
|
}
|
|
},
|
|
{
|
|
"id": "ee_read_envoy_livedata",
|
|
"result": {
|
|
"structured": "TRIGGER: When Home Assistant starts OR When the automation's own entity state is on for 1 second. CONDITIONS: None. ACTIONS: Repeat the following sequence 60 times: 1. Set variable request_time to the current time and variable response.status to 'timeout'. 2. Execute rest command read envoy livedata status [rest_command.read_envoy_livedata_status], storing the result in variable response. 3. Set variable response_time to the current time, variable just_now to the formatted time, and variable latency to the difference between response_time and request_time. 4. (Optional) Send a notification with the response message. 5. Check if response is undefined, response.status is 'timeout', or response.status is not 200. IF TRUE: Send a notification with a failure message, stop the repeat loop with an error, and delay for 1 minute. IF FALSE: Parse the response content. Check if sc_stream is not 'enabled'. IF TRUE: Execute rest command envoy enable livedata stream [rest_command.envoy_enable_livedata_stream], send a notification, and delay for 1 minute. IF FALSE: Extract solar production, net consumption, battery flow, and home load values from the response. Set the following input numbers: EE observed battery flow [input_number.ee_observed_battery_flow], EE observed solar production [input_number.ee_observed_solar_production], EE observed net consumption [input_number.ee_observed_net_consumption], EE observed total consumption [input_number.ee_observed_total_consumption], EE observed home load [input_number.ee_observed_home_load]. Set EE envoy pc reporting time [input_datetime.ee_envoy_pc_reporting_time] to just_now. Set EE observed envoy read livedata latency [input_number.ee_observed_envoy_read_livedata_latency] to the latency in milliseconds. (Optional) Send a notification with the last_update time. Delay for 1 second. After the repeat loop, turn off the automation itself, then turn it back on.",
|
|
"natural_language": {
|
|
"trigger": "The automation starts either when Home Assistant itself starts, or when the automation's own state is switched on and remains on for at least one second.",
|
|
"conditions": "There are no conditions that must be met for the actions to run.",
|
|
"action": "The automation performs a loop 60 times. In each loop, it attempts to read live data from an Envoy device. It records the start time, makes the request, and records the end time to calculate latency. If the request fails (e.g., times out or returns a non-200 status), it sends a failure notification, stops the loop, and waits for a minute. If the request succeeds, it checks if the live data stream is enabled on the device. If not, it sends a command to enable the stream, sends a notification, and waits a minute. If the stream is already enabled, it extracts key energy metrics from the response—solar production, net grid consumption, battery flow, and home load—and updates corresponding input_number entities with these values. It also records the time of the report and the request latency. After a one-second delay, the loop repeats. Once all 60 loops are complete, the automation turns itself off and then immediately turns itself back on."
|
|
},
|
|
"human_like": "This automation periodically fetches and updates home energy production and consumption data from an Envoy device, handling errors and ensuring the data stream is active.",
|
|
"complexity": "high"
|
|
}
|
|
},
|
|
{
|
|
"id": "ee_read_envoy_relay",
|
|
"result": {
|
|
"structured": "TRIGGER: Every minute (time pattern minutes: /1). CONDITIONS: None. ACTIONS: Execute read envoy relay rest command [rest_command.read_envoy_relay] and store the response in variable envoy_ivp_ensemble_relay. Extract the mains_oper_state field from the response content and assign it to variable grid. Set the value of EE observed grid status [input_text.ee_observed_grid_status] to the value of variable grid.",
|
|
"natural_language": {
|
|
"trigger": "The automation runs every minute.",
|
|
"conditions": "There are no conditions; the automation runs unconditionally.",
|
|
"action": "It calls a REST command named read envoy relay rest command [rest_command.read_envoy_relay] to fetch data. From the response, it extracts the grid status (mains_oper_state) and updates the text field EE observed grid status [input_text.ee_observed_grid_status] with that value."
|
|
},
|
|
"human_like": "This automation checks the grid status from an Envoy device every minute and updates a text field with the result.",
|
|
"complexity": "low"
|
|
}
|
|
},
|
|
{
|
|
"id": "ee_read_envoy_tariff",
|
|
"result": {
|
|
"structured": "TRIGGER: Every minute (time pattern with minutes matching /1). CONDITIONS: None. ACTIONS: Execute read envoy tariff rest command [rest_command.read_envoy_tariff] and then execute ee decode tariff script [script.ee_decode_tariff] with the response from the first action.",
|
|
"natural_language": {
|
|
"trigger": "The automation runs every minute.",
|
|
"conditions": "There are no conditions; the automation runs whenever the trigger occurs.",
|
|
"action": "It first calls the 'read envoy tariff' REST command [rest_command.read_envoy_tariff] and then runs the 'ee decode tariff' script [script.ee_decode_tariff], passing the response from the REST command to the script."
|
|
},
|
|
"human_like": "Checks the Envoy energy tariff every minute and processes the data.",
|
|
"complexity": "low"
|
|
}
|
|
},
|
|
{
|
|
"id": "ee_read_envoy_xml_info",
|
|
"result": {
|
|
"structured": "TRIGGER: When the time pattern matches every 12 hours (i.e., at 00:00 and 12:00). CONDITIONS: None. ACTIONS: Execute the rest command read envoy relay [rest_command.read_envoy_relay] (disabled), set variable 'content' from the response and variable 'grid' based on mains_oper_state, execute the rest command read envoy xml info [rest_command.read_envoy_xml_info], set variables 'xml_text', 'time_tag', 'time', 'software_tag', and 'vers' by parsing the XML response, set variable 'xml_text' again, set variable 'software_tag' again, set variable 'vers' again, and finally set the value of EE observed vers [input_text.ee_observed_vers] to the extracted software version.",
|
|
"natural_language": {
|
|
"trigger": "The automation runs on a time pattern, specifically every 12 hours.",
|
|
"conditions": "There are no conditions that must be met for the automation to proceed.",
|
|
"action": "The automation first attempts to call a disabled REST command to read the Envoy relay status, then it calls another REST command to fetch XML information from the Envoy device. It processes the XML response to extract the software version and updates the text input EE observed vers [input_text.ee_observed_vers] with that version number."
|
|
},
|
|
"human_like": "This automation fetches and records the software version from an Envoy solar device twice a day.",
|
|
"complexity": "medium"
|
|
}
|
|
},
|
|
{
|
|
"id": "EE Set Hour of Day",
|
|
"result": {
|
|
"structured": "TRIGGER: When the hour changes (every hour) OR when Home Assistant starts. CONDITIONS: None. ACTIONS: Set EE hour of day [input_number.ee_hour_of_day] to the current hour of the day.",
|
|
"natural_language": {
|
|
"trigger": "The automation runs every hour, on the hour, and also when Home Assistant first starts up.",
|
|
"conditions": "There are no conditions that must be met.",
|
|
"action": "It updates the EE hour of day [input_number.ee_hour_of_day] helper to the current hour of the day."
|
|
},
|
|
"human_like": "Keeps a helper updated with the current hour of the day, refreshing every hour and on system startup.",
|
|
"complexity": "low"
|
|
}
|
|
},
|
|
{
|
|
"id": "ee_set_is_tou_workday",
|
|
"result": {
|
|
"structured": "TRIGGER: At 00:15:00 daily OR When Home Assistant starts. CONDITIONS: None. ACTIONS: First, evaluate if today is a weekend (Saturday OR Sunday) OR if utility tou holidays calendar [calendar.utility_tou_holidays] is set to 'on'. If true, turn off EE solar is tou workday [input_boolean.ee_solar_is_tou_workday]. If false, turn on EE solar is tou workday [input_boolean.ee_solar_is_tou_workday]. Then, if the trigger index is not zero (i.e., the trigger was Home Assistant start), perform the following sequence: turn off While ZN Automation [automation.ee_while_zn] and While DL Automation [automation.ee_while_dl] and While CP Automation [automation.ee_while_cp]; then turn on While CP Automation [automation.ee_while_cp]; wait 5 seconds; trigger Read Envoy Tariff Automation [automation.ee_read_envoy_tariff] skipping its conditions; wait 5 seconds; trigger Read Envoy Relay Automation [automation.ee_read_envoy_relay] skipping its conditions; wait 5 seconds; trigger Read Envoy XML Info Automation [automation.ee_read_envoy_xml_info] skipping its conditions.",
|
|
"natural_language": {
|
|
"trigger": "The automation runs every day at 12:15 AM, or immediately when Home Assistant starts up.",
|
|
"conditions": "There are no conditions that must be met for the automation to proceed.",
|
|
"action": "First, it determines if today is a workday for Time-of-Use (TOU) rates. It checks if it's a weekend (Saturday or Sunday) or if the utility tou holidays calendar [calendar.utility_tou_holidays] shows an event. If either is true, it marks the day as a non-workday by turning off EE solar is tou workday [input_boolean.ee_solar_is_tou_workday]. Otherwise, it marks it as a workday by turning the input boolean on. Then, if the automation was triggered by Home Assistant starting (not by the scheduled time), it performs a system reset and initialization sequence: it stops several related automations (While ZN, While DL, and While CP), then re-enables the While CP Automation [automation.ee_while_cp]. After a series of 5-second delays, it manually triggers three other automations (Read Envoy Tariff, Read Envoy Relay, and Read Envoy XML Info), instructing them to run even if their own conditions aren't met."
|
|
},
|
|
"human_like": "This automation sets the daily Time-of-Use workday status and, when Home Assistant restarts, resets and initializes a set of related solar monitoring automations.",
|
|
"complexity": "medium"
|
|
}
|
|
},
|
|
{
|
|
"id": "ee_while_cp",
|
|
"result": {
|
|
"structured": "TRIGGER: When the template condition (EE observed tariff [input_text.ee_observed_tariff] is 'CP', 'ZN', or 'DL' AND EE observed solar production [input_number.ee_observed_solar_production] is greater than or equal to 100000 AND this automation's state is 'on') remains true for 20 seconds OR at 16:45:00 daily. CONDITIONS: None. ACTIONS: First, set variables: new_reserve from EE desired battery reserve [sensor.ee_desired_battery_reserve], workday from EE solar is tou workday [input_boolean.ee_solar_is_tou_workday] being 'on', dl_time based on current time being at or after 16:44, observed_tariff from EE observed tariff [input_text.ee_observed_tariff], and observed_production from EE observed solar production [input_number.ee_observed_solar_production]. Then, IF workday is true AND dl_time is true, THEN turn off this automation and turn on While DL Automation [automation.ee_while_dl]. OTHERWISE, set variables response.status to 'timeout' and attempts to 0. THEN, REPEAT the following sequence WHILE attempts is 0 OR (response.status is not 200 AND attempts is less than 100): If attempts is greater than 0, then if attempts is less than 10, delay for 2 seconds, else delay for 30 minutes and send a persistent notification [notify.persistent_notification] with a failure message. Then, call the send envoy param tariff rest command [rest_command.send_envoy_param_tariff] with parameters peak_rule 'ZN', peak_start 420, peak_end 1141, and reserve set to new_reserve, storing the response. Then, increment attempts by 1. AFTER the loop, run the ee decode tariff script [script.ee_decode_tariff] with the response variable. THEN, delay for 1 minute. FINALLY, turn off this automation and turn on While ZN Automation [automation.ee_while_zn].",
|
|
"natural_language": {
|
|
"trigger": "The automation triggers in two ways. First, when the EE observed tariff [input_text.ee_observed_tariff] is 'CP', 'ZN', or 'DL', and the EE observed solar production [input_number.ee_observed_solar_production] is at least 100,000, and the automation itself is currently enabled. This combined condition must stay true for 20 seconds. The second trigger is a daily schedule at 4:45 PM.",
|
|
"conditions": "There are no explicit conditions to evaluate after the trigger.",
|
|
"action": "The automation first gathers several pieces of information: the desired battery reserve level, whether today is a workday for time-of-use rates, if the current time is at or after 4:44 PM, and the current tariff and solar production values. If it's a workday and the time is at or after 4:44 PM, the automation will stop itself and activate a different automation called While DL Automation [automation.ee_while_dl]. Otherwise, it begins a process to change the tariff. It will repeatedly attempt to send a command to set the tariff rule to 'ZN' with specific start and end times and the desired battery reserve. It will make up to 100 attempts, with short delays between the first few attempts and longer delays after that. If attempts continue to fail, a notification is sent. Once a successful response is received or the maximum attempts are reached, it runs a script to decode the tariff response, waits one minute, then turns itself off and activates another automation called While ZN Automation [automation.ee_while_zn]."
|
|
},
|
|
"human_like": "This automation manages the home's energy tariff, switching to a 'ZN' rule when solar production is high, unless it's a workday afternoon, in which case it defers to a different schedule.",
|
|
"complexity": "high"
|
|
}
|
|
},
|
|
{
|
|
"id": "ee_while_dl",
|
|
"result": {
|
|
"structured": "TRIGGER: At 20:02:00. CONDITIONS: None. ACTIONS: Turn off the current automation [{{ this.entity_id }}] AND turn on While CP Automation [automation.ee_while_cp].",
|
|
"natural_language": {
|
|
"trigger": "The automation is triggered daily at 8:02 PM.",
|
|
"conditions": "There are no conditions that need to be met.",
|
|
"action": "It stops itself from running again and then starts another automation named While CP Automation [automation.ee_while_cp]."
|
|
},
|
|
"human_like": "At 8:02 PM, this automation stops itself and starts a different automation.",
|
|
"complexity": "low"
|
|
}
|
|
},
|
|
{
|
|
"id": "ee_while_zn",
|
|
"result": {
|
|
"structured": "TRIGGER: When (EE observed tariff [input_text.ee_observed_tariff] is 'ZN' AND EE observed tariff battery reserve [input_number.ee_observed_tariff_battery_reserve] does not equal EE desired battery reserve [sensor.ee_desired_battery_reserve] AND this automation is on) remains true for 20 seconds OR When (EE observed tariff [input_text.ee_observed_tariff] is 'ZN' AND EE observed solar production [input_number.ee_observed_solar_production] is less than 50000 AND this automation is on) remains true for 45 seconds OR At 16:45:00. CONDITIONS: None. ACTIONS: Set variables: tidx (trigger index), workday (if EE solar is tou workday [input_boolean.ee_solar_is_tou_workday] is on), observed_tariff, observed_production. If tidx is 0 (Climb Reserve trigger), set tariff variable with peak_rule 'ZN', peak_start 420, peak_end 1141, and reserve from EE desired battery reserve [sensor.ee_desired_battery_reserve]. Otherwise, if tidx is 2 (Ready for DL trigger) AND workday is false, stop execution with message 'It is 4:45pm but not workday'. Otherwise, set tariff variable with peak_rule 'DL', peak_start 1021 if workday else 780, peak_end 1201 if workday else 785, and reserve as minimum of 50 and EE observed charge [input_number.ee_observed_charge]. Then turn off this automation. If workday is true AND time is after 16:44:00, turn on While DL Automation [automation.ee_while_dl]; otherwise, turn on While CP Automation [automation.ee_while_cp]. Set variables: response.status = 'timeout', attempts = 0. Repeat: If attempts > 0, delay 2 seconds for attempts < 10, otherwise delay 30 minutes and send a persistent notification. Then call send envoy param tariff rest command [rest_command.send_envoy_param_tariff] with tariff variable, storing response. Increment attempts. While (attempts is 0) OR (response.status is not 200 AND attempts < 100). Finally, run ee decode tariff script [script.ee_decode_tariff] with the response.",
|
|
"natural_language": {
|
|
"trigger": "The automation can be triggered in three ways. First, if the EE observed tariff [input_text.ee_observed_tariff] is 'ZN', the EE observed tariff battery reserve [input_number.ee_observed_tariff_battery_reserve] differs from the EE desired battery reserve [sensor.ee_desired_battery_reserve], and the automation itself is enabled, and this condition persists for 20 seconds. Second, if the EE observed tariff [input_text.ee_observed_tariff] is 'ZN', the EE observed solar production [input_number.ee_observed_solar_production] is below 50000, and the automation is enabled, and this condition persists for 45 seconds. Third, at exactly 4:45 PM.",
|
|
"conditions": "There are no explicit conditions that must be met after the trigger fires.",
|
|
"action": "The automation first captures the trigger index, whether today is a workday based on EE solar is tou workday [input_boolean.ee_solar_is_tou_workday], the current observed tariff, and the current solar production. If the trigger was the 'Climb Reserve' event, it prepares a tariff configuration for the 'ZN' period with specific peak times and sets the battery reserve target. If the trigger was the 4:45 PM time trigger and it's not a workday, the automation stops. Otherwise, it prepares a tariff configuration for the 'DL' period with workday-dependent peak times and a calculated reserve limit. It then turns itself off. If it's a workday and after 4:44 PM, it activates the While DL Automation [automation.ee_while_dl]; otherwise, it activates the While CP Automation [automation.ee_while_cp]. The core action is to repeatedly attempt to send this new tariff configuration to the envoy system via the send envoy param tariff rest command [rest_command.send_envoy_param_tariff]. It retries up to 100 times with short delays, but after 10 failed attempts, it switches to a longer 30-minute delay and sends a persistent notification. This loop continues until a successful HTTP 200 response is received or the attempt limit is reached. Finally, it processes the response with the ee decode tariff script [script.ee_decode_tariff]."
|
|
},
|
|
"human_like": "This automation manages the home's energy tariff settings during the 'ZN' period, adjusting battery reserves or switching to a different tariff (DL or CP) based on solar production, time of day, and whether it's a workday.",
|
|
"complexity": "high"
|
|
}
|
|
}
|
|
] |