1313 lines
84 KiB
JSON
1313 lines
84 KiB
JSON
[
|
|
{
|
|
"id": "ee_read_envoy_battery",
|
|
"automation": "- alias: EE Read Envoy Battery\n id: ee_read_envoy_battery\n description: ''\n triggers:\n - trigger: homeassistant\n event: start\n - trigger: template\n value_template: '{{ states(this.entity_id) == \"on\" }}'\n for:\n hours: 0\n minutes: 0\n seconds: 1\n conditions: []\n actions:\n - repeat:\n sequence:\n - variables:\n request_time: '{{ now() }}'\n response:\n status: timeout\n - action: rest_command.read_envoy_batteries\n continue_on_error: true\n metadata: {}\n data: {}\n response_variable: response\n - variables:\n response_time: '{{ now() }}'\n latency: '{{ response_time | as_timestamp - request_time | as_timestamp\n }}'\n - action: notify.persistent_notification\n metadata: {}\n data:\n message: '{{ response }}'\n enabled: false\n - if:\n - condition: template\n value_template: \"{{\\n response is not defined or response.status == 'timeout'\\\n \\ or\\n response.status | int(0) = 200\\n}}\"\n then:\n - action: notify.persistent_notification\n metadata: {}\n data:\n message: '{{ now().strftime(\"%m/%d %H:%M:%S\") }} -- Read Battery -- {{\n response.status | default(response) }}'\n - stop: Rest command failure\n error: true\n enabled: false\n - delay:\n hours: 0\n minutes: 1\n seconds: 0\n milliseconds: 0\n else:\n - variables:\n newline: '\n\n '\n content: '{{ response.content | replace(newline, '' '') }}'\n devices: '{{ content[''devices:''] }}'\n pwr_soc: \"{% set ns = namespace(pwr=0,soc=0,batts=[]) %}\\n{% for d in\\\n \\ devices %}\\n {% set ns.pwr = ns.pwr + d.real_power_mw %}\\n {% set\\\n \\ ns.soc = ns.soc + d.soc %}\\n {% set ns.batts = ns.batts + [d.soc]\\\n \\ %}\\n {% set ns.batts = ns.batts + [(-d.real_power_mw)] %}\\n{% endfor\\\n \\ %}\\n{{\\n { \\n \\\"pwr\\\": ns.pwr,\\n \\\"soc\\\": ns.soc,\\n \\\"num\\\"\\\n : devices | count,\\n \\\"batts\\\": ns.batts\\n }\\n}}\"\n flow: '{{ -pwr_soc.pwr }}'\n soc: '{{ pwr_soc.soc }}'\n socpct: '{{ soc / pwr_soc.num }}'\n batts: '{{ pwr_soc.batts }}'\n - action: input_number.set_value\n metadata: {}\n data:\n value: '{{ socpct | round(2) }}'\n target:\n entity_id: input_number.ee_observed_charge\n - action: input_text.set_value\n metadata: {}\n data:\n value: '{{ batts }}'\n target:\n entity_id: input_text.ee_observed_batteries\n - action: input_datetime.set_datetime\n metadata: {}\n data:\n time: '{{ now().strftime(''%H:%M:%S'') }}'\n target:\n entity_id: input_datetime.ee_envoy_battery_reporting_time\n - action: input_number.set_value\n metadata: {}\n data:\n value: '{{ (latency * 1000) | int }}'\n target:\n entity_id: input_number.ee_observed_envoy_read_battery_latency\n - delay:\n hours: 0\n minutes: 0\n seconds: 2\n milliseconds: 0\n count: 60\n - action: automation.turn_off\n metadata: {}\n data:\n stop_actions: false\n target:\n entity_id: '{{ this.entity_id }}'\n - action: automation.turn_on\n metadata: {}\n data: {}\n target:\n entity_id: '{{ this.entity_id }}'\n mode: single",
|
|
"config": [
|
|
{
|
|
"name": "EE observed charge",
|
|
"room": null,
|
|
"type": "input_number",
|
|
"id": {
|
|
"entity_id": "input_number.ee_observed_charge",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "EE observed batteries",
|
|
"room": null,
|
|
"type": "input_text",
|
|
"id": {
|
|
"entity_id": "input_text.ee_observed_batteries",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "EE envoy battery reporting time",
|
|
"room": null,
|
|
"type": "input_datetime",
|
|
"id": {
|
|
"entity_id": "input_datetime.ee_envoy_battery_reporting_time",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "EE observed envoy read battery latency",
|
|
"room": null,
|
|
"type": "input_number",
|
|
"id": {
|
|
"entity_id": "input_number.ee_observed_envoy_read_battery_latency",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "persistent notification",
|
|
"room": null,
|
|
"type": "notify",
|
|
"id": {
|
|
"entity_id": "notify.persistent_notification",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "read envoy batteries rest command",
|
|
"room": null,
|
|
"type": "rest_command",
|
|
"id": {
|
|
"entity_id": "rest_command.read_envoy_batteries",
|
|
"device_id": null
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "ee_read_envoy_livedata",
|
|
"automation": "- alias: EE Read Envoy Livedata\n id: ee_read_envoy_livedata\n description: ''\n triggers:\n - trigger: homeassistant\n event: start\n - trigger: template\n value_template: '{{ states(this.entity_id) == \"on\" }}'\n for:\n hours: 0\n minutes: 0\n seconds: 1\n conditions: []\n actions:\n - repeat:\n sequence:\n - variables:\n request_time: '{{ now() }}'\n response:\n status: timeout\n - action: rest_command.read_envoy_livedata_status\n continue_on_error: true\n metadata: {}\n data: {}\n response_variable: response\n - variables:\n response_time: '{{ now() }}'\n just_now: '{{ (response_time | as_datetime).strftime(\"%H:%M:%S\") }}'\n latency: '{{ response_time | as_timestamp - request_time | as_timestamp\n }}'\n - action: notify.persistent_notification\n metadata: {}\n data:\n message: '{{ response }}'\n enabled: false\n - if:\n - condition: template\n value_template: \"{{\\n response is not defined or response.status == 'timeout'\\\n \\ or\\n response.status | int(0) = 200\\n}}\"\n then:\n - action: notify.persistent_notification\n metadata: {}\n data:\n message: '{{ now().strftime(\"%m/%d %H:%M:%S\") }} -- Read Livedata -- {{\n response.status | default(response) }}'\n - stop: Rest command failed\n error: true\n enabled: false\n - delay:\n hours: 0\n minutes: 1\n seconds: 0\n milliseconds: 0\n else:\n - variables:\n content: '{{ response.content }}'\n connection: '{{ content.connection }}'\n sc_stream: '{{ connection.sc_stream }}'\n - if:\n - condition: template\n value_template: '{{ sc_stream = ''enabled'' }}'\n then:\n - action: rest_command.envoy_enable_livedata_stream\n metadata: {}\n data: {}\n response_variable: response\n - action: notify.persistent_notification\n metadata: {}\n data:\n message: '{{ now().strftime(\"%m/%d %H:%M:%S\") }}\n\n Enabling Stream '\n - delay:\n hours: 0\n minutes: 1\n seconds: 0\n milliseconds: 0\n else:\n - variables:\n meters: '{{ content.meters }}'\n last_update: '{{ meters.last_update }}'\n solar_production: '{{ meters.pv.agg_p_mw }}'\n net_consumption: '{{ meters.grid.agg_p_mw }}'\n battery_flow: '{{ - meters.storage.agg_p_mw }}'\n home_load: '{{ meters.load.agg_p_mw }}'\n total_consumption: '{{ home_load + battery_flow }}'\n - action: input_number.set_value\n metadata: {}\n data:\n value: '{{ battery_flow }}'\n target:\n entity_id: input_number.ee_observed_battery_flow\n enabled: true\n - action: input_number.set_value\n metadata: {}\n data:\n value: '{{ solar_production }}'\n target:\n entity_id: input_number.ee_observed_solar_production\n - action: input_number.set_value\n metadata: {}\n data:\n value: '{{ net_consumption }}'\n target:\n entity_id: input_number.ee_observed_net_consumption\n - action: input_number.set_value\n metadata: {}\n data:\n value: '{{ total_consumption }}'\n target:\n entity_id: input_number.ee_observed_total_consumption\n - action: input_number.set_value\n metadata: {}\n data:\n value: '{{ home_load }}'\n target:\n entity_id: input_number.ee_observed_home_load\n - action: input_datetime.set_datetime\n metadata: {}\n data:\n time: '{{ just_now }}'\n target:\n entity_id: input_datetime.ee_envoy_pc_reporting_time\n - action: input_number.set_value\n metadata: {}\n data:\n value: '{{ (latency * 1000) | int }}'\n target:\n entity_id: input_number.ee_observed_envoy_read_livedata_latency\n - action: notify.persistent_notification\n metadata: {}\n data:\n message: '{{ last_update | as_datetime }}'\n enabled: false\n - delay:\n hours: 0\n minutes: 0\n seconds: 1\n milliseconds: 0\n count: 60\n - action: automation.turn_off\n metadata: {}\n data:\n stop_actions: false\n target:\n entity_id: '{{ this.entity_id }}'\n - action: automation.turn_on\n metadata: {}\n data: {}\n target:\n entity_id: '{{ this.entity_id }}'\n mode: single",
|
|
"config": [
|
|
{
|
|
"name": "EE observed battery flow",
|
|
"room": null,
|
|
"type": "input_number",
|
|
"id": {
|
|
"entity_id": "input_number.ee_observed_battery_flow",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "EE observed solar production",
|
|
"room": null,
|
|
"type": "input_number",
|
|
"id": {
|
|
"entity_id": "input_number.ee_observed_solar_production",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "EE observed net consumption",
|
|
"room": null,
|
|
"type": "input_number",
|
|
"id": {
|
|
"entity_id": "input_number.ee_observed_net_consumption",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "EE observed total consumption",
|
|
"room": null,
|
|
"type": "input_number",
|
|
"id": {
|
|
"entity_id": "input_number.ee_observed_total_consumption",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "EE observed home load",
|
|
"room": null,
|
|
"type": "input_number",
|
|
"id": {
|
|
"entity_id": "input_number.ee_observed_home_load",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "EE envoy pc reporting time",
|
|
"room": null,
|
|
"type": "input_datetime",
|
|
"id": {
|
|
"entity_id": "input_datetime.ee_envoy_pc_reporting_time",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "EE observed envoy read livedata latency",
|
|
"room": null,
|
|
"type": "input_number",
|
|
"id": {
|
|
"entity_id": "input_number.ee_observed_envoy_read_livedata_latency",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "persistent notification",
|
|
"room": null,
|
|
"type": "notify",
|
|
"id": {
|
|
"entity_id": "notify.persistent_notification",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "read envoy livedata status rest command",
|
|
"room": null,
|
|
"type": "rest_command",
|
|
"id": {
|
|
"entity_id": "rest_command.read_envoy_livedata_status",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "envoy enable livedata stream rest command",
|
|
"room": null,
|
|
"type": "rest_command",
|
|
"id": {
|
|
"entity_id": "rest_command.envoy_enable_livedata_stream",
|
|
"device_id": null
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "ee_read_envoy_relay",
|
|
"automation": "- alias: EE Read Envoy Relay\n id: ee_read_envoy_relay\n description: ''\n triggers:\n - trigger: time_pattern\n minutes: /1\n conditions: []\n actions:\n - action: rest_command.read_envoy_relay\n metadata: {}\n data: {}\n response_variable: envoy_ivp_ensemble_relay\n - variables:\n content: '{{ envoy_ivp_ensemble_relay.content }}'\n grid: '{{ content.mains_oper_state }}'\n - action: input_text.set_value\n metadata: {}\n data:\n value: '{{ grid }}'\n target:\n entity_id: input_text.ee_observed_grid_status\n mode: single",
|
|
"config": [
|
|
{
|
|
"name": "EE observed grid status",
|
|
"room": null,
|
|
"type": "input_text",
|
|
"id": {
|
|
"entity_id": "input_text.ee_observed_grid_status",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "read envoy relay rest command",
|
|
"room": null,
|
|
"type": "rest_command",
|
|
"id": {
|
|
"entity_id": "rest_command.read_envoy_relay",
|
|
"device_id": null
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "ee_read_envoy_tariff",
|
|
"automation": "- alias: EE Read Envoy Tariff\n id: ee_read_envoy_tariff\n description: ''\n triggers:\n - trigger: time_pattern\n minutes: /1\n conditions: []\n actions:\n - action: rest_command.read_envoy_tariff\n metadata: {}\n data: {}\n response_variable: response\n - action: script.ee_decode_tariff\n metadata: {}\n data:\n response: '{{ response }}'\n mode: single",
|
|
"config": [
|
|
{
|
|
"name": "read envoy tariff rest command",
|
|
"room": null,
|
|
"type": "rest_command",
|
|
"id": {
|
|
"entity_id": "rest_command.read_envoy_tariff",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "ee decode tariff script",
|
|
"room": null,
|
|
"type": "script",
|
|
"id": {
|
|
"entity_id": "script.ee_decode_tariff",
|
|
"device_id": null
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "ee_read_envoy_xml_info",
|
|
"automation": "- alias: EE Read Envoy XML Info\n id: ee_read_envoy_xml_info\n description: ''\n triggers:\n - trigger: time_pattern\n hours: /12\n conditions: []\n actions:\n - action: rest_command.read_envoy_relay\n metadata: {}\n data: {}\n response_variable: envoy_ivp_ensemble_relay\n enabled: false\n - variables:\n content: '{{ envoy_ivp_ensemble_relay.content }}'\n grid: '{{ content.mains_oper_state == \"closed\" }}'\n enabled: false\n - action: rest_command.read_envoy_xml_info\n metadata: {}\n data: {}\n response_variable: envoy_info_xml\n - variables:\n xml_text: '{{ envoy_info_xml.content }}'\n time_tag: '{{ xml_text | regex_findall_index(\"<time>.*</time>\") }}'\n time: '{{ time_tag[6:-7] }}'\n software_tag: '{{ xml_text | regex_findall_index(\"<software>.*</software>\")\n }}'\n vers: '{{ software_tag[10:-11] }}'\n enabled: false\n - variables:\n xml_text: '{{ envoy_info_xml.content }}'\n software_tag: '{{ xml_text | regex_findall_index(\"<software>.*</software>\")\n }}'\n vers: '{{ software_tag[10:-11] }}'\n - action: input_text.set_value\n metadata: {}\n data:\n value: '{{ vers }}'\n target:\n entity_id: input_text.ee_observed_vers\n mode: single",
|
|
"config": [
|
|
{
|
|
"name": "EE observed vers",
|
|
"room": null,
|
|
"type": "input_text",
|
|
"id": {
|
|
"entity_id": "input_text.ee_observed_vers",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "read envoy relay rest command",
|
|
"room": null,
|
|
"type": "rest_command",
|
|
"id": {
|
|
"entity_id": "rest_command.read_envoy_relay",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "read envoy xml info rest command",
|
|
"room": null,
|
|
"type": "rest_command",
|
|
"id": {
|
|
"entity_id": "rest_command.read_envoy_xml_info",
|
|
"device_id": null
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "EE Set Hour of Day",
|
|
"automation": "- alias: EE Set Hour of Day\n description: ''\n triggers:\n - trigger: time_pattern\n hours: /1\n - trigger: homeassistant\n event: start\n conditions: []\n actions:\n - action: input_number.set_value\n metadata: {}\n data:\n value: '{{ now().hour }}'\n target:\n entity_id: input_number.ee_hour_of_day\n mode: single",
|
|
"config": [
|
|
{
|
|
"name": "EE hour of day",
|
|
"room": null,
|
|
"type": "input_number",
|
|
"id": {
|
|
"entity_id": "input_number.ee_hour_of_day",
|
|
"device_id": null
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "ee_set_is_tou_workday",
|
|
"automation": "- alias: EE Set is TOU Workday\n id: ee_set_is_tou_workday\n description: Determine todays rates as to workday or holiday\n triggers:\n - trigger: time\n at: 00:15:00\n - trigger: homeassistant\n event: start\n conditions: []\n actions:\n - if:\n - condition: or\n conditions:\n - condition: time\n weekday:\n - sun\n - sat\n - condition: template\n value_template: '{{ states(\"calendar.utility_tou_holidays\") == \"on\" }}'\n then:\n - action: input_boolean.turn_off\n metadata: {}\n data: {}\n target:\n entity_id: input_boolean.ee_solar_is_tou_workday\n else:\n - action: input_boolean.turn_on\n metadata: {}\n data: {}\n target:\n entity_id: input_boolean.ee_solar_is_tou_workday\n - variables:\n tidx: '{{ trigger.idx }}'\n - if:\n - condition: template\n value_template: '{{ tidx = 0 }}'\n then:\n - action: automation.turn_off\n metadata: {}\n data:\n stop_actions: true\n target:\n entity_id:\n - automation.ee_while_zn\n - automation.ee_while_dl\n - automation.ee_while_cp\n - action: automation.turn_on\n metadata: {}\n data: {}\n target:\n entity_id: automation.ee_while_cp\n - delay:\n hours: 0\n minutes: 0\n seconds: 5\n milliseconds: 0\n - action: automation.trigger\n metadata: {}\n data:\n skip_condition: true\n target:\n entity_id:\n - automation.ee_read_envoy_tariff\n - delay:\n hours: 0\n minutes: 0\n seconds: 5\n milliseconds: 0\n - action: automation.trigger\n metadata: {}\n data:\n skip_condition: true\n target:\n entity_id:\n - automation.ee_read_envoy_relay\n - delay:\n hours: 0\n minutes: 0\n seconds: 5\n milliseconds: 0\n - action: automation.trigger\n metadata: {}\n data:\n skip_condition: true\n target:\n entity_id:\n - automation.ee_read_envoy_xml_info\n mode: single",
|
|
"config": [
|
|
{
|
|
"name": "EE solar is tou workday",
|
|
"room": null,
|
|
"type": "input_boolean",
|
|
"id": {
|
|
"entity_id": "input_boolean.ee_solar_is_tou_workday",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "utility tou holidays calendar",
|
|
"room": null,
|
|
"type": "calendar",
|
|
"id": {
|
|
"entity_id": "calendar.utility_tou_holidays",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "Read Envoy Relay Automation",
|
|
"room": null,
|
|
"type": "automation",
|
|
"id": {
|
|
"entity_id": "automation.ee_read_envoy_relay",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "Read Envoy Tariff Automation",
|
|
"room": null,
|
|
"type": "automation",
|
|
"id": {
|
|
"entity_id": "automation.ee_read_envoy_tariff",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "Read Envoy XML Info Automation",
|
|
"room": null,
|
|
"type": "automation",
|
|
"id": {
|
|
"entity_id": "automation.ee_read_envoy_xml_info",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "While CP Automation",
|
|
"room": null,
|
|
"type": "automation",
|
|
"id": {
|
|
"entity_id": "automation.ee_while_cp",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "While DL Automation",
|
|
"room": null,
|
|
"type": "automation",
|
|
"id": {
|
|
"entity_id": "automation.ee_while_dl",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "While ZN Automation",
|
|
"room": null,
|
|
"type": "automation",
|
|
"id": {
|
|
"entity_id": "automation.ee_while_zn",
|
|
"device_id": null
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "ee_while_cp",
|
|
"automation": "- alias: EE While CP\n id: ee_while_cp\n description: ''\n triggers:\n - trigger: template\n value_template: \"{{\\n (states('input_text.ee_observed_tariff') == 'CP' or\\n \\\n \\ states('input_text.ee_observed_tariff') == 'ZN' or \\n states('input_text.ee_observed_tariff')\\\n \\ == 'DL') and \\n states('input_number.ee_observed_solar_production') | float\\\n \\ >= 100000 and\\n states(this.entity_id) == 'on'\\n}}\"\n for:\n hours: 0\n minutes: 0\n seconds: 20\n - trigger: time\n at: '16:45:00'\n conditions: []\n actions:\n - variables:\n new_reserve: '{{ states(''sensor.ee_desired_battery_reserve'') | int }}'\n workday: '{{ states(''input_boolean.ee_solar_is_tou_workday'') == ''on'' }}'\n dl_time: '{% set yetz = now () %}\n\n {% set hr = yetz.hour * 100 + yetz.minute %}\n\n {{ hr >= 1644 }}'\n observed_tariff: '{{ states(''input_text.ee_observed_tariff'') }}'\n observed_production: '{{ states(''input_number.ee_observed_solar_production'')\n }}'\n - if:\n - condition: template\n value_template: '{{ workday and dl_time }}'\n then:\n - action: automation.turn_off\n metadata: {}\n data:\n stop_actions: false\n target:\n entity_id: '{{ this.entity_id }}'\n - action: automation.turn_on\n metadata: {}\n data: {}\n target:\n entity_id: automation.ee_while_dl\n else:\n - variables:\n response:\n status: timeout\n attempts: 0\n - repeat:\n sequence:\n - if:\n - condition: template\n value_template: '{{ attempts > 0 }}'\n then:\n - if:\n - condition: template\n value_template: '{{ attempts < 10 }}'\n then:\n - delay:\n hours: 0\n minutes: 0\n seconds: 2\n milliseconds: 0\n else:\n - delay:\n hours: 0\n minutes: 30\n seconds: 0\n milliseconds: 0\n - action: notify.persistent_notification\n metadata: {}\n data:\n message: 'Tariff change fails (CP)\n\n {{ attempts }}\n\n {{ now().strftime(''%m/%d %H:%M:%S'') }}'\n - action: rest_command.send_envoy_param_tariff\n continue_on_error: true\n metadata: {}\n data:\n peak_rule: ZN\n peak_start: 420\n peak_end: 1141\n reserve: '{{ new_reserve }}'\n response_variable: response\n - variables:\n attempts: '{{ attempts + 1 }}'\n while:\n - condition: template\n value_template: '{{ attempts == 0 or response.status | int(0) = 200 and\n attempts < 100 }}'\n - action: script.ee_decode_tariff\n metadata: {}\n data:\n response: '{{ response }}'\n - delay:\n hours: 0\n minutes: 1\n seconds: 0\n milliseconds: 0\n - action: automation.turn_off\n metadata: {}\n data:\n stop_actions: false\n target:\n entity_id: '{{ this.entity_id }}'\n - action: automation.turn_on\n metadata: {}\n data: {}\n target:\n entity_id: automation.ee_while_zn\n mode: single",
|
|
"config": [
|
|
{
|
|
"name": "EE observed solar production",
|
|
"room": null,
|
|
"type": "input_number",
|
|
"id": {
|
|
"entity_id": "input_number.ee_observed_solar_production",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "EE solar is tou workday",
|
|
"room": null,
|
|
"type": "input_boolean",
|
|
"id": {
|
|
"entity_id": "input_boolean.ee_solar_is_tou_workday",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "EE desired battery reserve",
|
|
"room": null,
|
|
"type": "sensor",
|
|
"id": {
|
|
"entity_id": "sensor.ee_desired_battery_reserve",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "EE observed tariff",
|
|
"room": null,
|
|
"type": "input_text",
|
|
"id": {
|
|
"entity_id": "input_text.ee_observed_tariff",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "persistent notification",
|
|
"room": null,
|
|
"type": "notify",
|
|
"id": {
|
|
"entity_id": "notify.persistent_notification",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "send envoy param tariff rest command",
|
|
"room": null,
|
|
"type": "rest_command",
|
|
"id": {
|
|
"entity_id": "rest_command.send_envoy_param_tariff",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "ee decode tariff script",
|
|
"room": null,
|
|
"type": "script",
|
|
"id": {
|
|
"entity_id": "script.ee_decode_tariff",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "While DL Automation",
|
|
"room": null,
|
|
"type": "automation",
|
|
"id": {
|
|
"entity_id": "automation.ee_while_dl",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "While ZN Automation",
|
|
"room": null,
|
|
"type": "automation",
|
|
"id": {
|
|
"entity_id": "automation.ee_while_zn",
|
|
"device_id": null
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "ee_while_dl",
|
|
"automation": "- alias: EE While DL\n id: ee_while_dl\n description: ''\n triggers:\n - trigger: time\n at: '20:02:00'\n conditions: []\n actions:\n - action: automation.turn_off\n metadata: {}\n data:\n stop_actions: false\n target:\n entity_id: '{{ this.entity_id }}'\n - action: automation.turn_on\n metadata: {}\n data: {}\n target:\n entity_id: automation.ee_while_cp\n mode: single",
|
|
"config": [
|
|
{
|
|
"name": "While CP Automation",
|
|
"room": null,
|
|
"type": "automation",
|
|
"id": {
|
|
"entity_id": "automation.ee_while_cp",
|
|
"device_id": null
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "ee_while_zn",
|
|
"automation": "- alias: EE While ZN\n id: ee_while_zn\n description: ''\n triggers:\n - alias: Climb Reserve in ZN\n trigger: template\n value_template: \"{{\\n states('input_text.ee_observed_tariff') == 'ZN' and \\n\\\n \\ states('input_number.ee_observed_tariff_battery_reserve') | float = states('sensor.ee_desired_battery_reserve')\\\n \\ | float and\\n states(this.entity_id) == 'on'\\n}}\"\n for:\n hours: 0\n minutes: 0\n seconds: 20\n - alias: Drop out of ZN\n trigger: template\n value_template: \"{{\\n states('input_text.ee_observed_tariff') == 'ZN' and\\n \\\n \\ states('input_number.ee_observed_solar_production') | int < 50000 and\\n states(this.entity_id)\\\n \\ == 'on'\\n}}\"\n for:\n hours: 0\n minutes: 0\n seconds: 45\n - alias: Ready for DL\n trigger: time\n at: '16:45:00'\n conditions: []\n actions:\n - variables:\n tidx: '{{ trigger.idx }}'\n workday: '{{ states(''input_boolean.ee_solar_is_tou_workday'') == ''on'' }}'\n observed_tariff: '{{ states(''input_text.ee_observed_tariff'') }}'\n observed_production: '{{ states(''input_number.ee_observed_solar_production'')\n }}'\n - if:\n - alias: Climb Trigger?\n condition: template\n value_template: '{{ tidx == 0 }}'\n then:\n - variables:\n tariff: \"{{\\n { \\n \\\"time\\\" : now().timestamp() | int,\\n \\\"peak_rule\\\"\\\n : \\\"ZN\\\",\\n \\\"peak_start\\\": 420,\\n \\\"peak_end\\\": 1141,\\n \\\"reserve\\\"\\\n : states('sensor.ee_desired_battery_reserve') | float \\n }\\n}}\"\n else:\n - if:\n - condition: template\n value_template: '{{ tidx == 2 and not workday }}'\n then:\n - stop: It is 4:45pm but not workday\n - variables:\n tariff: \"{{\\n { \\n \\\"time\\\" : now().timestamp() | int,\\n \\\"peak_rule\\\"\\\n : \\\"DL\\\",\\n \\\"peak_start\\\": 1021 if workday else 780,\\n \\\"peak_end\\\"\\\n : 1201 if workday else 785,\\n \\\"reserve\\\": min(50, states('input_number.ee_observed_charge')\\\n \\ | int)\\n }\\n}}\"\n - action: automation.turn_off\n metadata: {}\n data:\n stop_actions: false\n target:\n entity_id: '{{ this.entity_id }}'\n - if:\n - condition: and\n conditions:\n - condition: template\n value_template: '{{ workday }}'\n - condition: time\n after: '16:44:00'\n then:\n - action: automation.turn_on\n metadata: {}\n data: {}\n target:\n entity_id: automation.ee_while_dl\n else:\n - action: automation.turn_on\n metadata: {}\n data: {}\n target:\n entity_id: automation.ee_while_cp\n - variables:\n response:\n status: timeout\n attempts: 0\n - repeat:\n sequence:\n - if:\n - condition: template\n value_template: '{{ attempts > 0 }}'\n then:\n - if:\n - condition: template\n value_template: '{{ attempts < 10 }}'\n then:\n - delay:\n hours: 0\n minutes: 0\n seconds: 2\n milliseconds: 0\n else:\n - delay:\n hours: 0\n minutes: 30\n seconds: 0\n milliseconds: 0\n - action: notify.persistent_notification\n metadata: {}\n data:\n message: 'Tariff change fails (ZN)\n\n {{ attempts }}\n\n {{ now().strftime(''%m/%d %H:%M:%S'') }}'\n - action: rest_command.send_envoy_param_tariff\n continue_on_error: true\n metadata: {}\n data: '{{ tariff }}'\n response_variable: response\n - variables:\n attempts: '{{ attempts + 1 }}'\n while:\n - condition: template\n value_template: \"{{ \\n attempts == 0 or \\n response.status | int(0) = 200\\\n \\ and attempts < 100\\n}}\"\n - action: script.ee_decode_tariff\n metadata: {}\n data:\n response: '{{ response }}'\n mode: single",
|
|
"config": [
|
|
{
|
|
"name": "EE observed charge",
|
|
"room": null,
|
|
"type": "input_number",
|
|
"id": {
|
|
"entity_id": "input_number.ee_observed_charge",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "EE observed solar production",
|
|
"room": null,
|
|
"type": "input_number",
|
|
"id": {
|
|
"entity_id": "input_number.ee_observed_solar_production",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "EE solar is tou workday",
|
|
"room": null,
|
|
"type": "input_boolean",
|
|
"id": {
|
|
"entity_id": "input_boolean.ee_solar_is_tou_workday",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "EE desired battery reserve",
|
|
"room": null,
|
|
"type": "sensor",
|
|
"id": {
|
|
"entity_id": "sensor.ee_desired_battery_reserve",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "EE observed tariff",
|
|
"room": null,
|
|
"type": "input_text",
|
|
"id": {
|
|
"entity_id": "input_text.ee_observed_tariff",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "EE observed tariff battery reserve",
|
|
"room": null,
|
|
"type": "input_number",
|
|
"id": {
|
|
"entity_id": "input_number.ee_observed_tariff_battery_reserve",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "persistent notification",
|
|
"room": null,
|
|
"type": "notify",
|
|
"id": {
|
|
"entity_id": "notify.persistent_notification",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "send envoy param tariff rest command",
|
|
"room": null,
|
|
"type": "rest_command",
|
|
"id": {
|
|
"entity_id": "rest_command.send_envoy_param_tariff",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "ee decode tariff script",
|
|
"room": null,
|
|
"type": "script",
|
|
"id": {
|
|
"entity_id": "script.ee_decode_tariff",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "While CP Automation",
|
|
"room": null,
|
|
"type": "automation",
|
|
"id": {
|
|
"entity_id": "automation.ee_while_cp",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "While DL Automation",
|
|
"room": null,
|
|
"type": "automation",
|
|
"id": {
|
|
"entity_id": "automation.ee_while_dl",
|
|
"device_id": null
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "ee_read_envoy_battery",
|
|
"automation": "- alias: EE Read Envoy Battery\n id: ee_read_envoy_battery\n description: ''\n triggers:\n - trigger: homeassistant\n event: start\n - trigger: template\n value_template: '{{ states(this.entity_id) == \"on\" }}'\n for:\n hours: 0\n minutes: 0\n seconds: 1\n conditions: []\n actions:\n - repeat:\n sequence:\n - variables:\n request_time: '{{ now() }}'\n response:\n status: timeout\n - action: rest_command.read_envoy_batteries\n continue_on_error: true\n metadata: {}\n data: {}\n response_variable: response\n - variables:\n response_time: '{{ now() }}'\n latency: '{{ response_time | as_timestamp - request_time | as_timestamp\n }}'\n - action: notify.persistent_notification\n metadata: {}\n data:\n message: '{{ response }}'\n enabled: false\n - if:\n - condition: template\n value_template: \"{{\\n response is not defined or response.status == 'timeout'\\\n \\ or\\n response.status | int(0) = 200\\n}}\"\n then:\n - action: notify.persistent_notification\n metadata: {}\n data:\n message: '{{ now().strftime(\"%m/%d %H:%M:%S\") }} -- Read Battery -- {{\n response.status | default(response) }}'\n - stop: Rest command failure\n error: true\n enabled: false\n - delay:\n hours: 0\n minutes: 1\n seconds: 0\n milliseconds: 0\n else:\n - variables:\n newline: '\n\n '\n content: '{{ response.content | replace(newline, '' '') }}'\n devices: '{{ content[''devices:''] }}'\n pwr_soc: \"{% set ns = namespace(pwr=0,soc=0,batts=[]) %}\\n{% for d in\\\n \\ devices %}\\n {% set ns.pwr = ns.pwr + d.real_power_mw %}\\n {% set\\\n \\ ns.soc = ns.soc + d.soc %}\\n {% set ns.batts = ns.batts + [d.soc]\\\n \\ %}\\n {% set ns.batts = ns.batts + [(-d.real_power_mw)] %}\\n{% endfor\\\n \\ %}\\n{{\\n { \\n \\\"pwr\\\": ns.pwr,\\n \\\"soc\\\": ns.soc,\\n \\\"num\\\"\\\n : devices | count,\\n \\\"batts\\\": ns.batts\\n }\\n}}\"\n flow: '{{ -pwr_soc.pwr }}'\n soc: '{{ pwr_soc.soc }}'\n socpct: '{{ soc / pwr_soc.num }}'\n batts: '{{ pwr_soc.batts }}'\n - action: input_number.set_value\n metadata: {}\n data:\n value: '{{ socpct | round(2) }}'\n target:\n entity_id: input_number.ee_observed_charge\n - action: input_text.set_value\n metadata: {}\n data:\n value: '{{ batts }}'\n target:\n entity_id: input_text.ee_observed_batteries\n - action: input_datetime.set_datetime\n metadata: {}\n data:\n time: '{{ now().strftime(''%H:%M:%S'') }}'\n target:\n entity_id: input_datetime.ee_envoy_battery_reporting_time\n - action: input_number.set_value\n metadata: {}\n data:\n value: '{{ (latency * 1000) | int }}'\n target:\n entity_id: input_number.ee_observed_envoy_read_battery_latency\n - delay:\n hours: 0\n minutes: 0\n seconds: 2\n milliseconds: 0\n count: 60\n - action: automation.turn_off\n metadata: {}\n data:\n stop_actions: false\n target:\n entity_id: '{{ this.entity_id }}'\n - action: automation.turn_on\n metadata: {}\n data: {}\n target:\n entity_id: '{{ this.entity_id }}'\n mode: single",
|
|
"config": [
|
|
{
|
|
"name": "EE observed charge",
|
|
"room": null,
|
|
"type": "input_number",
|
|
"id": {
|
|
"entity_id": "input_number.ee_observed_charge",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "EE observed batteries",
|
|
"room": null,
|
|
"type": "input_text",
|
|
"id": {
|
|
"entity_id": "input_text.ee_observed_batteries",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "EE envoy battery reporting time",
|
|
"room": null,
|
|
"type": "input_datetime",
|
|
"id": {
|
|
"entity_id": "input_datetime.ee_envoy_battery_reporting_time",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "EE observed envoy read battery latency",
|
|
"room": null,
|
|
"type": "input_number",
|
|
"id": {
|
|
"entity_id": "input_number.ee_observed_envoy_read_battery_latency",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "persistent notification",
|
|
"room": null,
|
|
"type": "notify",
|
|
"id": {
|
|
"entity_id": "notify.persistent_notification",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "read envoy batteries rest command",
|
|
"room": null,
|
|
"type": "rest_command",
|
|
"id": {
|
|
"entity_id": "rest_command.read_envoy_batteries",
|
|
"device_id": null
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "ee_read_envoy_livedata",
|
|
"automation": "- alias: EE Read Envoy Livedata\n id: ee_read_envoy_livedata\n description: ''\n triggers:\n - trigger: homeassistant\n event: start\n - trigger: template\n value_template: '{{ states(this.entity_id) == \"on\" }}'\n for:\n hours: 0\n minutes: 0\n seconds: 1\n conditions: []\n actions:\n - repeat:\n sequence:\n - variables:\n request_time: '{{ now() }}'\n response:\n status: timeout\n - action: rest_command.read_envoy_livedata_status\n continue_on_error: true\n metadata: {}\n data: {}\n response_variable: response\n - variables:\n response_time: '{{ now() }}'\n just_now: '{{ (response_time | as_datetime).strftime(\"%H:%M:%S\") }}'\n latency: '{{ response_time | as_timestamp - request_time | as_timestamp\n }}'\n - action: notify.persistent_notification\n metadata: {}\n data:\n message: '{{ response }}'\n enabled: false\n - if:\n - condition: template\n value_template: \"{{\\n response is not defined or response.status == 'timeout'\\\n \\ or\\n response.status | int(0) = 200\\n}}\"\n then:\n - action: notify.persistent_notification\n metadata: {}\n data:\n message: '{{ now().strftime(\"%m/%d %H:%M:%S\") }} -- Read Livedata -- {{\n response.status | default(response) }}'\n - stop: Rest command failed\n error: true\n enabled: false\n - delay:\n hours: 0\n minutes: 1\n seconds: 0\n milliseconds: 0\n else:\n - variables:\n content: '{{ response.content }}'\n connection: '{{ content.connection }}'\n sc_stream: '{{ connection.sc_stream }}'\n - if:\n - condition: template\n value_template: '{{ sc_stream = ''enabled'' }}'\n then:\n - action: rest_command.envoy_enable_livedata_stream\n metadata: {}\n data: {}\n response_variable: response\n - action: notify.persistent_notification\n metadata: {}\n data:\n message: '{{ now().strftime(\"%m/%d %H:%M:%S\") }}\n\n Enabling Stream '\n - delay:\n hours: 0\n minutes: 1\n seconds: 0\n milliseconds: 0\n else:\n - variables:\n meters: '{{ content.meters }}'\n last_update: '{{ meters.last_update }}'\n solar_production: '{{ meters.pv.agg_p_mw }}'\n net_consumption: '{{ meters.grid.agg_p_mw }}'\n battery_flow: '{{ - meters.storage.agg_p_mw }}'\n home_load: '{{ meters.load.agg_p_mw }}'\n total_consumption: '{{ home_load + battery_flow }}'\n - action: input_number.set_value\n metadata: {}\n data:\n value: '{{ battery_flow }}'\n target:\n entity_id: input_number.ee_observed_battery_flow\n enabled: true\n - action: input_number.set_value\n metadata: {}\n data:\n value: '{{ solar_production }}'\n target:\n entity_id: input_number.ee_observed_solar_production\n - action: input_number.set_value\n metadata: {}\n data:\n value: '{{ net_consumption }}'\n target:\n entity_id: input_number.ee_observed_net_consumption\n - action: input_number.set_value\n metadata: {}\n data:\n value: '{{ total_consumption }}'\n target:\n entity_id: input_number.ee_observed_total_consumption\n - action: input_number.set_value\n metadata: {}\n data:\n value: '{{ home_load }}'\n target:\n entity_id: input_number.ee_observed_home_load\n - action: input_datetime.set_datetime\n metadata: {}\n data:\n time: '{{ just_now }}'\n target:\n entity_id: input_datetime.ee_envoy_pc_reporting_time\n - action: input_number.set_value\n metadata: {}\n data:\n value: '{{ (latency * 1000) | int }}'\n target:\n entity_id: input_number.ee_observed_envoy_read_livedata_latency\n - action: notify.persistent_notification\n metadata: {}\n data:\n message: '{{ last_update | as_datetime }}'\n enabled: false\n - delay:\n hours: 0\n minutes: 0\n seconds: 1\n milliseconds: 0\n count: 60\n - action: automation.turn_off\n metadata: {}\n data:\n stop_actions: false\n target:\n entity_id: '{{ this.entity_id }}'\n - action: automation.turn_on\n metadata: {}\n data: {}\n target:\n entity_id: '{{ this.entity_id }}'\n mode: single",
|
|
"config": [
|
|
{
|
|
"name": "EE observed battery flow",
|
|
"room": null,
|
|
"type": "input_number",
|
|
"id": {
|
|
"entity_id": "input_number.ee_observed_battery_flow",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "EE observed solar production",
|
|
"room": null,
|
|
"type": "input_number",
|
|
"id": {
|
|
"entity_id": "input_number.ee_observed_solar_production",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "EE observed net consumption",
|
|
"room": null,
|
|
"type": "input_number",
|
|
"id": {
|
|
"entity_id": "input_number.ee_observed_net_consumption",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "EE observed total consumption",
|
|
"room": null,
|
|
"type": "input_number",
|
|
"id": {
|
|
"entity_id": "input_number.ee_observed_total_consumption",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "EE observed home load",
|
|
"room": null,
|
|
"type": "input_number",
|
|
"id": {
|
|
"entity_id": "input_number.ee_observed_home_load",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "EE envoy pc reporting time",
|
|
"room": null,
|
|
"type": "input_datetime",
|
|
"id": {
|
|
"entity_id": "input_datetime.ee_envoy_pc_reporting_time",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "EE observed envoy read livedata latency",
|
|
"room": null,
|
|
"type": "input_number",
|
|
"id": {
|
|
"entity_id": "input_number.ee_observed_envoy_read_livedata_latency",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "persistent notification",
|
|
"room": null,
|
|
"type": "notify",
|
|
"id": {
|
|
"entity_id": "notify.persistent_notification",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "read envoy livedata status rest command",
|
|
"room": null,
|
|
"type": "rest_command",
|
|
"id": {
|
|
"entity_id": "rest_command.read_envoy_livedata_status",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "envoy enable livedata stream rest command",
|
|
"room": null,
|
|
"type": "rest_command",
|
|
"id": {
|
|
"entity_id": "rest_command.envoy_enable_livedata_stream",
|
|
"device_id": null
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "ee_read_envoy_relay",
|
|
"automation": "- alias: EE Read Envoy Relay\n id: ee_read_envoy_relay\n description: ''\n triggers:\n - trigger: time_pattern\n minutes: /1\n conditions: []\n actions:\n - action: rest_command.read_envoy_relay\n metadata: {}\n data: {}\n response_variable: envoy_ivp_ensemble_relay\n - variables:\n content: '{{ envoy_ivp_ensemble_relay.content }}'\n grid: '{{ content.mains_oper_state }}'\n - action: input_text.set_value\n metadata: {}\n data:\n value: '{{ grid }}'\n target:\n entity_id: input_text.ee_observed_grid_status\n mode: single",
|
|
"config": [
|
|
{
|
|
"name": "EE observed grid status",
|
|
"room": null,
|
|
"type": "input_text",
|
|
"id": {
|
|
"entity_id": "input_text.ee_observed_grid_status",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "read envoy relay rest command",
|
|
"room": null,
|
|
"type": "rest_command",
|
|
"id": {
|
|
"entity_id": "rest_command.read_envoy_relay",
|
|
"device_id": null
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "ee_read_envoy_tariff",
|
|
"automation": "- alias: EE Read Envoy Tariff\n id: ee_read_envoy_tariff\n description: ''\n triggers:\n - trigger: time_pattern\n minutes: /1\n conditions: []\n actions:\n - action: rest_command.read_envoy_tariff\n metadata: {}\n data: {}\n response_variable: response\n - action: script.ee_decode_tariff\n metadata: {}\n data:\n response: '{{ response }}'\n mode: single",
|
|
"config": [
|
|
{
|
|
"name": "read envoy tariff rest command",
|
|
"room": null,
|
|
"type": "rest_command",
|
|
"id": {
|
|
"entity_id": "rest_command.read_envoy_tariff",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "ee decode tariff script",
|
|
"room": null,
|
|
"type": "script",
|
|
"id": {
|
|
"entity_id": "script.ee_decode_tariff",
|
|
"device_id": null
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "ee_read_envoy_xml_info",
|
|
"automation": "- alias: EE Read Envoy XML Info\n id: ee_read_envoy_xml_info\n description: ''\n triggers:\n - trigger: time_pattern\n hours: /12\n conditions: []\n actions:\n - action: rest_command.read_envoy_relay\n metadata: {}\n data: {}\n response_variable: envoy_ivp_ensemble_relay\n enabled: false\n - variables:\n content: '{{ envoy_ivp_ensemble_relay.content }}'\n grid: '{{ content.mains_oper_state == \"closed\" }}'\n enabled: false\n - action: rest_command.read_envoy_xml_info\n metadata: {}\n data: {}\n response_variable: envoy_info_xml\n - variables:\n xml_text: '{{ envoy_info_xml.content }}'\n time_tag: '{{ xml_text | regex_findall_index(\"<time>.*</time>\") }}'\n time: '{{ time_tag[6:-7] }}'\n software_tag: '{{ xml_text | regex_findall_index(\"<software>.*</software>\")\n }}'\n vers: '{{ software_tag[10:-11] }}'\n enabled: false\n - variables:\n xml_text: '{{ envoy_info_xml.content }}'\n software_tag: '{{ xml_text | regex_findall_index(\"<software>.*</software>\")\n }}'\n vers: '{{ software_tag[10:-11] }}'\n - action: input_text.set_value\n metadata: {}\n data:\n value: '{{ vers }}'\n target:\n entity_id: input_text.ee_observed_vers\n mode: single",
|
|
"config": [
|
|
{
|
|
"name": "EE observed vers",
|
|
"room": null,
|
|
"type": "input_text",
|
|
"id": {
|
|
"entity_id": "input_text.ee_observed_vers",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "read envoy relay rest command",
|
|
"room": null,
|
|
"type": "rest_command",
|
|
"id": {
|
|
"entity_id": "rest_command.read_envoy_relay",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "read envoy xml info rest command",
|
|
"room": null,
|
|
"type": "rest_command",
|
|
"id": {
|
|
"entity_id": "rest_command.read_envoy_xml_info",
|
|
"device_id": null
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "ee_read_envoy_battery",
|
|
"automation": "- alias: EE Read Envoy Battery\n id: ee_read_envoy_battery\n description: ''\n triggers:\n - trigger: homeassistant\n event: start\n - trigger: template\n value_template: '{{ states(this.entity_id) == \"on\" }}'\n for:\n hours: 0\n minutes: 0\n seconds: 1\n conditions: []\n actions:\n - repeat:\n sequence:\n - variables:\n request_time: '{{ now() }}'\n response:\n status: timeout\n - action: rest_command.read_envoy_batteries\n continue_on_error: true\n metadata: {}\n data: {}\n response_variable: response\n - variables:\n response_time: '{{ now() }}'\n latency: '{{ response_time | as_timestamp - request_time | as_timestamp\n }}'\n - action: notify.persistent_notification\n metadata: {}\n data:\n message: '{{ response }}'\n enabled: false\n - if:\n - condition: template\n value_template: \"{{\\n response is not defined or response.status == 'timeout'\\\n \\ or\\n response.status | int(0) != 200\\n}}\"\n then:\n - action: notify.persistent_notification\n metadata: {}\n data:\n message: '{{ now().strftime(\"%m/%d %H:%M:%S\") }} -- Read Battery -- {{\n response.status | default(response) }}'\n - stop: Rest command failure\n error: true\n enabled: false\n - delay:\n hours: 0\n minutes: 1\n seconds: 0\n milliseconds: 0\n else:\n - variables:\n newline: '\n\n '\n content: '{{ response.content | replace(newline, '' '') }}'\n devices: '{{ content[''devices:''] }}'\n pwr_soc: \"{% set ns = namespace(pwr=0,soc=0,batts=[]) %}\\n{% for d in\\\n \\ devices %}\\n {% set ns.pwr = ns.pwr + d.real_power_mw %}\\n {% set\\\n \\ ns.soc = ns.soc + d.soc %}\\n {% set ns.batts = ns.batts + [d.soc]\\\n \\ %}\\n {% set ns.batts = ns.batts + [(-d.real_power_mw)] %}\\n{% endfor\\\n \\ %}\\n{{\\n { \\n \\\"pwr\\\": ns.pwr,\\n \\\"soc\\\": ns.soc,\\n \\\"num\\\"\\\n : devices | count,\\n \\\"batts\\\": ns.batts\\n }\\n}}\"\n flow: '{{ -pwr_soc.pwr }}'\n soc: '{{ pwr_soc.soc }}'\n socpct: '{{ soc / pwr_soc.num }}'\n batts: '{{ pwr_soc.batts }}'\n - action: input_number.set_value\n metadata: {}\n data:\n value: '{{ socpct | round(2) }}'\n target:\n entity_id: input_number.ee_observed_charge\n - action: input_text.set_value\n metadata: {}\n data:\n value: '{{ batts }}'\n target:\n entity_id: input_text.ee_observed_batteries\n - action: input_datetime.set_datetime\n metadata: {}\n data:\n time: '{{ now().strftime(''%H:%M:%S'') }}'\n target:\n entity_id: input_datetime.ee_envoy_battery_reporting_time\n - action: input_number.set_value\n metadata: {}\n data:\n value: '{{ (latency * 1000) | int }}'\n target:\n entity_id: input_number.ee_observed_envoy_read_battery_latency\n - delay:\n hours: 0\n minutes: 0\n seconds: 2\n milliseconds: 0\n count: 60\n - action: automation.turn_off\n metadata: {}\n data:\n stop_actions: false\n target:\n entity_id: '{{ this.entity_id }}'\n - action: automation.turn_on\n metadata: {}\n data: {}\n target:\n entity_id: '{{ this.entity_id }}'\n mode: single",
|
|
"config": [
|
|
{
|
|
"name": "EE observed charge",
|
|
"room": null,
|
|
"type": "input_number",
|
|
"id": {
|
|
"entity_id": "input_number.ee_observed_charge",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "EE observed batteries",
|
|
"room": null,
|
|
"type": "input_text",
|
|
"id": {
|
|
"entity_id": "input_text.ee_observed_batteries",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "EE envoy battery reporting time",
|
|
"room": null,
|
|
"type": "input_datetime",
|
|
"id": {
|
|
"entity_id": "input_datetime.ee_envoy_battery_reporting_time",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "EE observed envoy read battery latency",
|
|
"room": null,
|
|
"type": "input_number",
|
|
"id": {
|
|
"entity_id": "input_number.ee_observed_envoy_read_battery_latency",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "persistent notification",
|
|
"room": null,
|
|
"type": "notify",
|
|
"id": {
|
|
"entity_id": "notify.persistent_notification",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "read envoy batteries rest command",
|
|
"room": null,
|
|
"type": "rest_command",
|
|
"id": {
|
|
"entity_id": "rest_command.read_envoy_batteries",
|
|
"device_id": null
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "ee_read_envoy_livedata",
|
|
"automation": "- alias: EE Read Envoy Livedata\n id: ee_read_envoy_livedata\n description: ''\n triggers:\n - trigger: homeassistant\n event: start\n - trigger: template\n value_template: '{{ states(this.entity_id) == \"on\" }}'\n for:\n hours: 0\n minutes: 0\n seconds: 1\n conditions: []\n actions:\n - repeat:\n sequence:\n - variables:\n request_time: '{{ now() }}'\n response:\n status: timeout\n - action: rest_command.read_envoy_livedata_status\n continue_on_error: true\n metadata: {}\n data: {}\n response_variable: response\n - variables:\n response_time: '{{ now() }}'\n just_now: '{{ (response_time | as_datetime).strftime(\"%H:%M:%S\") }}'\n latency: '{{ response_time | as_timestamp - request_time | as_timestamp\n }}'\n - action: notify.persistent_notification\n metadata: {}\n data:\n message: '{{ response }}'\n enabled: false\n - if:\n - condition: template\n value_template: \"{{\\n response is not defined or response.status == 'timeout'\\\n \\ or\\n response.status | int(0) != 200\\n}}\"\n then:\n - action: notify.persistent_notification\n metadata: {}\n data:\n message: '{{ now().strftime(\"%m/%d %H:%M:%S\") }} -- Read Livedata -- {{\n response.status | default(response) }}'\n - stop: Rest command failed\n error: true\n enabled: false\n - delay:\n hours: 0\n minutes: 1\n seconds: 0\n milliseconds: 0\n else:\n - variables:\n content: '{{ response.content }}'\n connection: '{{ content.connection }}'\n sc_stream: '{{ connection.sc_stream }}'\n - if:\n - condition: template\n value_template: '{{ sc_stream != ''enabled'' }}'\n then:\n - action: rest_command.envoy_enable_livedata_stream\n metadata: {}\n data: {}\n response_variable: response\n - action: notify.persistent_notification\n metadata: {}\n data:\n message: '{{ now().strftime(\"%m/%d %H:%M:%S\") }}\n\n Enabling Stream '\n - delay:\n hours: 0\n minutes: 1\n seconds: 0\n milliseconds: 0\n else:\n - variables:\n meters: '{{ content.meters }}'\n last_update: '{{ meters.last_update }}'\n solar_production: '{{ meters.pv.agg_p_mw }}'\n net_consumption: '{{ meters.grid.agg_p_mw }}'\n battery_flow: '{{ - meters.storage.agg_p_mw }}'\n home_load: '{{ meters.load.agg_p_mw }}'\n total_consumption: '{{ home_load + battery_flow }}'\n - action: input_number.set_value\n metadata: {}\n data:\n value: '{{ battery_flow }}'\n target:\n entity_id: input_number.ee_observed_battery_flow\n enabled: true\n - action: input_number.set_value\n metadata: {}\n data:\n value: '{{ solar_production }}'\n target:\n entity_id: input_number.ee_observed_solar_production\n - action: input_number.set_value\n metadata: {}\n data:\n value: '{{ net_consumption }}'\n target:\n entity_id: input_number.ee_observed_net_consumption\n - action: input_number.set_value\n metadata: {}\n data:\n value: '{{ total_consumption }}'\n target:\n entity_id: input_number.ee_observed_total_consumption\n - action: input_number.set_value\n metadata: {}\n data:\n value: '{{ home_load }}'\n target:\n entity_id: input_number.ee_observed_home_load\n - action: input_datetime.set_datetime\n metadata: {}\n data:\n time: '{{ just_now }}'\n target:\n entity_id: input_datetime.ee_envoy_pc_reporting_time\n - action: input_number.set_value\n metadata: {}\n data:\n value: '{{ (latency * 1000) | int }}'\n target:\n entity_id: input_number.ee_observed_envoy_read_livedata_latency\n - action: notify.persistent_notification\n metadata: {}\n data:\n message: '{{ last_update | as_datetime }}'\n enabled: false\n - delay:\n hours: 0\n minutes: 0\n seconds: 1\n milliseconds: 0\n count: 60\n - action: automation.turn_off\n metadata: {}\n data:\n stop_actions: false\n target:\n entity_id: '{{ this.entity_id }}'\n - action: automation.turn_on\n metadata: {}\n data: {}\n target:\n entity_id: '{{ this.entity_id }}'\n mode: single",
|
|
"config": [
|
|
{
|
|
"name": "EE observed battery flow",
|
|
"room": null,
|
|
"type": "input_number",
|
|
"id": {
|
|
"entity_id": "input_number.ee_observed_battery_flow",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "EE observed solar production",
|
|
"room": null,
|
|
"type": "input_number",
|
|
"id": {
|
|
"entity_id": "input_number.ee_observed_solar_production",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "EE observed net consumption",
|
|
"room": null,
|
|
"type": "input_number",
|
|
"id": {
|
|
"entity_id": "input_number.ee_observed_net_consumption",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "EE observed total consumption",
|
|
"room": null,
|
|
"type": "input_number",
|
|
"id": {
|
|
"entity_id": "input_number.ee_observed_total_consumption",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "EE observed home load",
|
|
"room": null,
|
|
"type": "input_number",
|
|
"id": {
|
|
"entity_id": "input_number.ee_observed_home_load",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "EE envoy pc reporting time",
|
|
"room": null,
|
|
"type": "input_datetime",
|
|
"id": {
|
|
"entity_id": "input_datetime.ee_envoy_pc_reporting_time",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "EE observed envoy read livedata latency",
|
|
"room": null,
|
|
"type": "input_number",
|
|
"id": {
|
|
"entity_id": "input_number.ee_observed_envoy_read_livedata_latency",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "persistent notification",
|
|
"room": null,
|
|
"type": "notify",
|
|
"id": {
|
|
"entity_id": "notify.persistent_notification",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "read envoy livedata status rest command",
|
|
"room": null,
|
|
"type": "rest_command",
|
|
"id": {
|
|
"entity_id": "rest_command.read_envoy_livedata_status",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "envoy enable livedata stream rest command",
|
|
"room": null,
|
|
"type": "rest_command",
|
|
"id": {
|
|
"entity_id": "rest_command.envoy_enable_livedata_stream",
|
|
"device_id": null
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "ee_read_envoy_relay",
|
|
"automation": "- alias: EE Read Envoy Relay\n id: ee_read_envoy_relay\n description: ''\n triggers:\n - trigger: time_pattern\n minutes: /1\n conditions: []\n actions:\n - action: rest_command.read_envoy_relay\n metadata: {}\n data: {}\n response_variable: envoy_ivp_ensemble_relay\n - variables:\n content: '{{ envoy_ivp_ensemble_relay.content }}'\n grid: '{{ content.mains_oper_state }}'\n - action: input_text.set_value\n metadata: {}\n data:\n value: '{{ grid }}'\n target:\n entity_id: input_text.ee_observed_grid_status\n mode: single",
|
|
"config": [
|
|
{
|
|
"name": "EE observed grid status",
|
|
"room": null,
|
|
"type": "input_text",
|
|
"id": {
|
|
"entity_id": "input_text.ee_observed_grid_status",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "read envoy relay rest command",
|
|
"room": null,
|
|
"type": "rest_command",
|
|
"id": {
|
|
"entity_id": "rest_command.read_envoy_relay",
|
|
"device_id": null
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "ee_read_envoy_tariff",
|
|
"automation": "- alias: EE Read Envoy Tariff\n id: ee_read_envoy_tariff\n description: ''\n triggers:\n - trigger: time_pattern\n minutes: /1\n conditions: []\n actions:\n - action: rest_command.read_envoy_tariff\n metadata: {}\n data: {}\n response_variable: response\n - action: script.ee_decode_tariff\n metadata: {}\n data:\n response: '{{ response }}'\n mode: single",
|
|
"config": [
|
|
{
|
|
"name": "read envoy tariff rest command",
|
|
"room": null,
|
|
"type": "rest_command",
|
|
"id": {
|
|
"entity_id": "rest_command.read_envoy_tariff",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "ee decode tariff script",
|
|
"room": null,
|
|
"type": "script",
|
|
"id": {
|
|
"entity_id": "script.ee_decode_tariff",
|
|
"device_id": null
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "ee_read_envoy_xml_info",
|
|
"automation": "- alias: EE Read Envoy XML Info\n id: ee_read_envoy_xml_info\n description: ''\n triggers:\n - trigger: time_pattern\n hours: /12\n conditions: []\n actions:\n - action: rest_command.read_envoy_relay\n metadata: {}\n data: {}\n response_variable: envoy_ivp_ensemble_relay\n enabled: false\n - variables:\n content: '{{ envoy_ivp_ensemble_relay.content }}'\n grid: '{{ content.mains_oper_state == \"closed\" }}'\n enabled: false\n - action: rest_command.read_envoy_xml_info\n metadata: {}\n data: {}\n response_variable: envoy_info_xml\n - variables:\n xml_text: '{{ envoy_info_xml.content }}'\n time_tag: '{{ xml_text | regex_findall_index(\"<time>.*</time>\") }}'\n time: '{{ time_tag[6:-7] }}'\n software_tag: '{{ xml_text | regex_findall_index(\"<software>.*</software>\")\n }}'\n vers: '{{ software_tag[10:-11] }}'\n enabled: false\n - variables:\n xml_text: '{{ envoy_info_xml.content }}'\n software_tag: '{{ xml_text | regex_findall_index(\"<software>.*</software>\")\n }}'\n vers: '{{ software_tag[10:-11] }}'\n - action: input_text.set_value\n metadata: {}\n data:\n value: '{{ vers }}'\n target:\n entity_id: input_text.ee_observed_vers\n mode: single",
|
|
"config": [
|
|
{
|
|
"name": "EE observed vers",
|
|
"room": null,
|
|
"type": "input_text",
|
|
"id": {
|
|
"entity_id": "input_text.ee_observed_vers",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "read envoy relay rest command",
|
|
"room": null,
|
|
"type": "rest_command",
|
|
"id": {
|
|
"entity_id": "rest_command.read_envoy_relay",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "read envoy xml info rest command",
|
|
"room": null,
|
|
"type": "rest_command",
|
|
"id": {
|
|
"entity_id": "rest_command.read_envoy_xml_info",
|
|
"device_id": null
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "EE Set Hour of Day",
|
|
"automation": "- alias: EE Set Hour of Day\n description: ''\n triggers:\n - trigger: time_pattern\n hours: /1\n - trigger: homeassistant\n event: start\n conditions: []\n actions:\n - action: input_number.set_value\n metadata: {}\n data:\n value: '{{ now().hour }}'\n target:\n entity_id: input_number.ee_hour_of_day\n mode: single",
|
|
"config": [
|
|
{
|
|
"name": "EE hour of day",
|
|
"room": null,
|
|
"type": "input_number",
|
|
"id": {
|
|
"entity_id": "input_number.ee_hour_of_day",
|
|
"device_id": null
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "ee_set_is_tou_workday",
|
|
"automation": "- alias: EE Set is TOU Workday\n id: ee_set_is_tou_workday\n description: Determine todays rates as to workday or holiday\n triggers:\n - trigger: time\n at: 00:15:00\n - trigger: homeassistant\n event: start\n conditions: []\n actions:\n - if:\n - condition: or\n conditions:\n - condition: time\n weekday:\n - sun\n - sat\n - condition: template\n value_template: '{{ states(\"calendar.utility_tou_holidays\") == \"on\" }}'\n then:\n - action: input_boolean.turn_off\n metadata: {}\n data: {}\n target:\n entity_id: input_boolean.ee_solar_is_tou_workday\n else:\n - action: input_boolean.turn_on\n metadata: {}\n data: {}\n target:\n entity_id: input_boolean.ee_solar_is_tou_workday\n - variables:\n tidx: '{{ trigger.idx }}'\n - if:\n - condition: template\n value_template: '{{ tidx != 0 }}'\n then:\n - action: automation.turn_off\n metadata: {}\n data:\n stop_actions: true\n target:\n entity_id:\n - automation.ee_while_zn\n - automation.ee_while_dl\n - automation.ee_while_cp\n - action: automation.turn_on\n metadata: {}\n data: {}\n target:\n entity_id: automation.ee_while_cp\n - delay:\n hours: 0\n minutes: 0\n seconds: 5\n milliseconds: 0\n - action: automation.trigger\n metadata: {}\n data:\n skip_condition: true\n target:\n entity_id:\n - automation.ee_read_envoy_tariff\n - delay:\n hours: 0\n minutes: 0\n seconds: 5\n milliseconds: 0\n - action: automation.trigger\n metadata: {}\n data:\n skip_condition: true\n target:\n entity_id:\n - automation.ee_read_envoy_relay\n - delay:\n hours: 0\n minutes: 0\n seconds: 5\n milliseconds: 0\n - action: automation.trigger\n metadata: {}\n data:\n skip_condition: true\n target:\n entity_id:\n - automation.ee_read_envoy_xml_info\n mode: single",
|
|
"config": [
|
|
{
|
|
"name": "EE solar is tou workday",
|
|
"room": null,
|
|
"type": "input_boolean",
|
|
"id": {
|
|
"entity_id": "input_boolean.ee_solar_is_tou_workday",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "utility tou holidays calendar",
|
|
"room": null,
|
|
"type": "calendar",
|
|
"id": {
|
|
"entity_id": "calendar.utility_tou_holidays",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "Read Envoy Relay Automation",
|
|
"room": null,
|
|
"type": "automation",
|
|
"id": {
|
|
"entity_id": "automation.ee_read_envoy_relay",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "Read Envoy Tariff Automation",
|
|
"room": null,
|
|
"type": "automation",
|
|
"id": {
|
|
"entity_id": "automation.ee_read_envoy_tariff",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "Read Envoy XML Info Automation",
|
|
"room": null,
|
|
"type": "automation",
|
|
"id": {
|
|
"entity_id": "automation.ee_read_envoy_xml_info",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "While CP Automation",
|
|
"room": null,
|
|
"type": "automation",
|
|
"id": {
|
|
"entity_id": "automation.ee_while_cp",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "While DL Automation",
|
|
"room": null,
|
|
"type": "automation",
|
|
"id": {
|
|
"entity_id": "automation.ee_while_dl",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "While ZN Automation",
|
|
"room": null,
|
|
"type": "automation",
|
|
"id": {
|
|
"entity_id": "automation.ee_while_zn",
|
|
"device_id": null
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "ee_while_cp",
|
|
"automation": "- alias: EE While CP\n id: ee_while_cp\n description: ''\n triggers:\n - trigger: template\n value_template: \"{{\\n (states('input_text.ee_observed_tariff') == 'CP' or\\n \\\n \\ states('input_text.ee_observed_tariff') == 'ZN' or \\n states('input_text.ee_observed_tariff')\\\n \\ == 'DL') and \\n states('input_number.ee_observed_solar_production') | float\\\n \\ >= 100000 and\\n states(this.entity_id) == 'on'\\n}}\"\n for:\n hours: 0\n minutes: 0\n seconds: 20\n - trigger: time\n at: '16:45:00'\n conditions: []\n actions:\n - variables:\n new_reserve: '{{ states(''sensor.ee_desired_battery_reserve'') | int }}'\n workday: '{{ states(''input_boolean.ee_solar_is_tou_workday'') == ''on'' }}'\n dl_time: '{% set yetz = now () %}\n\n {% set hr = yetz.hour * 100 + yetz.minute %}\n\n {{ hr >= 1644 }}'\n observed_tariff: '{{ states(''input_text.ee_observed_tariff'') }}'\n observed_production: '{{ states(''input_number.ee_observed_solar_production'')\n }}'\n - if:\n - condition: template\n value_template: '{{ workday and dl_time }}'\n then:\n - action: automation.turn_off\n metadata: {}\n data:\n stop_actions: false\n target:\n entity_id: '{{ this.entity_id }}'\n - action: automation.turn_on\n metadata: {}\n data: {}\n target:\n entity_id: automation.ee_while_dl\n else:\n - variables:\n response:\n status: timeout\n attempts: 0\n - repeat:\n sequence:\n - if:\n - condition: template\n value_template: '{{ attempts > 0 }}'\n then:\n - if:\n - condition: template\n value_template: '{{ attempts < 10 }}'\n then:\n - delay:\n hours: 0\n minutes: 0\n seconds: 2\n milliseconds: 0\n else:\n - delay:\n hours: 0\n minutes: 30\n seconds: 0\n milliseconds: 0\n - action: notify.persistent_notification\n metadata: {}\n data:\n message: 'Tariff change fails (CP)\n\n {{ attempts }}\n\n {{ now().strftime(''%m/%d %H:%M:%S'') }}'\n - action: rest_command.send_envoy_param_tariff\n continue_on_error: true\n metadata: {}\n data:\n peak_rule: ZN\n peak_start: 420\n peak_end: 1141\n reserve: '{{ new_reserve }}'\n response_variable: response\n - variables:\n attempts: '{{ attempts + 1 }}'\n while:\n - condition: template\n value_template: '{{ attempts == 0 or response.status | int(0) != 200 and\n attempts < 100 }}'\n - action: script.ee_decode_tariff\n metadata: {}\n data:\n response: '{{ response }}'\n - delay:\n hours: 0\n minutes: 1\n seconds: 0\n milliseconds: 0\n - action: automation.turn_off\n metadata: {}\n data:\n stop_actions: false\n target:\n entity_id: '{{ this.entity_id }}'\n - action: automation.turn_on\n metadata: {}\n data: {}\n target:\n entity_id: automation.ee_while_zn\n mode: single",
|
|
"config": [
|
|
{
|
|
"name": "EE observed solar production",
|
|
"room": null,
|
|
"type": "input_number",
|
|
"id": {
|
|
"entity_id": "input_number.ee_observed_solar_production",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "EE solar is tou workday",
|
|
"room": null,
|
|
"type": "input_boolean",
|
|
"id": {
|
|
"entity_id": "input_boolean.ee_solar_is_tou_workday",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "EE desired battery reserve",
|
|
"room": null,
|
|
"type": "sensor",
|
|
"id": {
|
|
"entity_id": "sensor.ee_desired_battery_reserve",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "EE observed tariff",
|
|
"room": null,
|
|
"type": "input_text",
|
|
"id": {
|
|
"entity_id": "input_text.ee_observed_tariff",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "persistent notification",
|
|
"room": null,
|
|
"type": "notify",
|
|
"id": {
|
|
"entity_id": "notify.persistent_notification",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "send envoy param tariff rest command",
|
|
"room": null,
|
|
"type": "rest_command",
|
|
"id": {
|
|
"entity_id": "rest_command.send_envoy_param_tariff",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "ee decode tariff script",
|
|
"room": null,
|
|
"type": "script",
|
|
"id": {
|
|
"entity_id": "script.ee_decode_tariff",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "While DL Automation",
|
|
"room": null,
|
|
"type": "automation",
|
|
"id": {
|
|
"entity_id": "automation.ee_while_dl",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "While ZN Automation",
|
|
"room": null,
|
|
"type": "automation",
|
|
"id": {
|
|
"entity_id": "automation.ee_while_zn",
|
|
"device_id": null
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "ee_while_dl",
|
|
"automation": "- alias: EE While DL\n id: ee_while_dl\n description: ''\n triggers:\n - trigger: time\n at: '20:02:00'\n conditions: []\n actions:\n - action: automation.turn_off\n metadata: {}\n data:\n stop_actions: false\n target:\n entity_id: '{{ this.entity_id }}'\n - action: automation.turn_on\n metadata: {}\n data: {}\n target:\n entity_id: automation.ee_while_cp\n mode: single",
|
|
"config": [
|
|
{
|
|
"name": "While CP Automation",
|
|
"room": null,
|
|
"type": "automation",
|
|
"id": {
|
|
"entity_id": "automation.ee_while_cp",
|
|
"device_id": null
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "ee_while_zn",
|
|
"automation": "- alias: EE While ZN\n id: ee_while_zn\n description: ''\n triggers:\n - alias: Climb Reserve in ZN\n trigger: template\n value_template: \"{{\\n states('input_text.ee_observed_tariff') == 'ZN' and \\n\\\n \\ states('input_number.ee_observed_tariff_battery_reserve') | float != states('sensor.ee_desired_battery_reserve')\\\n \\ | float and\\n states(this.entity_id) == 'on'\\n}}\"\n for:\n hours: 0\n minutes: 0\n seconds: 20\n - alias: Drop out of ZN\n trigger: template\n value_template: \"{{\\n states('input_text.ee_observed_tariff') == 'ZN' and\\n \\\n \\ states('input_number.ee_observed_solar_production') | int < 50000 and\\n states(this.entity_id)\\\n \\ == 'on'\\n}}\"\n for:\n hours: 0\n minutes: 0\n seconds: 45\n - alias: Ready for DL\n trigger: time\n at: '16:45:00'\n conditions: []\n actions:\n - variables:\n tidx: '{{ trigger.idx }}'\n workday: '{{ states(''input_boolean.ee_solar_is_tou_workday'') == ''on'' }}'\n observed_tariff: '{{ states(''input_text.ee_observed_tariff'') }}'\n observed_production: '{{ states(''input_number.ee_observed_solar_production'')\n }}'\n - if:\n - alias: Climb Trigger?\n condition: template\n value_template: '{{ tidx == 0 }}'\n then:\n - variables:\n tariff: \"{{\\n { \\n \\\"time\\\" : now().timestamp() | int,\\n \\\"peak_rule\\\"\\\n : \\\"ZN\\\",\\n \\\"peak_start\\\": 420,\\n \\\"peak_end\\\": 1141,\\n \\\"reserve\\\"\\\n : states('sensor.ee_desired_battery_reserve') | float \\n }\\n}}\"\n else:\n - if:\n - condition: template\n value_template: '{{ tidx == 2 and not workday }}'\n then:\n - stop: It is 4:45pm but not workday\n - variables:\n tariff: \"{{\\n { \\n \\\"time\\\" : now().timestamp() | int,\\n \\\"peak_rule\\\"\\\n : \\\"DL\\\",\\n \\\"peak_start\\\": 1021 if workday else 780,\\n \\\"peak_end\\\"\\\n : 1201 if workday else 785,\\n \\\"reserve\\\": min(50, states('input_number.ee_observed_charge')\\\n \\ | int)\\n }\\n}}\"\n - action: automation.turn_off\n metadata: {}\n data:\n stop_actions: false\n target:\n entity_id: '{{ this.entity_id }}'\n - if:\n - condition: and\n conditions:\n - condition: template\n value_template: '{{ workday }}'\n - condition: time\n after: '16:44:00'\n then:\n - action: automation.turn_on\n metadata: {}\n data: {}\n target:\n entity_id: automation.ee_while_dl\n else:\n - action: automation.turn_on\n metadata: {}\n data: {}\n target:\n entity_id: automation.ee_while_cp\n - variables:\n response:\n status: timeout\n attempts: 0\n - repeat:\n sequence:\n - if:\n - condition: template\n value_template: '{{ attempts > 0 }}'\n then:\n - if:\n - condition: template\n value_template: '{{ attempts < 10 }}'\n then:\n - delay:\n hours: 0\n minutes: 0\n seconds: 2\n milliseconds: 0\n else:\n - delay:\n hours: 0\n minutes: 30\n seconds: 0\n milliseconds: 0\n - action: notify.persistent_notification\n metadata: {}\n data:\n message: 'Tariff change fails (ZN)\n\n {{ attempts }}\n\n {{ now().strftime(''%m/%d %H:%M:%S'') }}'\n - action: rest_command.send_envoy_param_tariff\n continue_on_error: true\n metadata: {}\n data: '{{ tariff }}'\n response_variable: response\n - variables:\n attempts: '{{ attempts + 1 }}'\n while:\n - condition: template\n value_template: \"{{ \\n attempts == 0 or \\n response.status | int(0) != 200\\\n \\ and attempts < 100\\n}}\"\n - action: script.ee_decode_tariff\n metadata: {}\n data:\n response: '{{ response }}'\n mode: single",
|
|
"config": [
|
|
{
|
|
"name": "EE observed charge",
|
|
"room": null,
|
|
"type": "input_number",
|
|
"id": {
|
|
"entity_id": "input_number.ee_observed_charge",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "EE observed solar production",
|
|
"room": null,
|
|
"type": "input_number",
|
|
"id": {
|
|
"entity_id": "input_number.ee_observed_solar_production",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "EE solar is tou workday",
|
|
"room": null,
|
|
"type": "input_boolean",
|
|
"id": {
|
|
"entity_id": "input_boolean.ee_solar_is_tou_workday",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "EE desired battery reserve",
|
|
"room": null,
|
|
"type": "sensor",
|
|
"id": {
|
|
"entity_id": "sensor.ee_desired_battery_reserve",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "EE observed tariff",
|
|
"room": null,
|
|
"type": "input_text",
|
|
"id": {
|
|
"entity_id": "input_text.ee_observed_tariff",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "EE observed tariff battery reserve",
|
|
"room": null,
|
|
"type": "input_number",
|
|
"id": {
|
|
"entity_id": "input_number.ee_observed_tariff_battery_reserve",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "persistent notification",
|
|
"room": null,
|
|
"type": "notify",
|
|
"id": {
|
|
"entity_id": "notify.persistent_notification",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "send envoy param tariff rest command",
|
|
"room": null,
|
|
"type": "rest_command",
|
|
"id": {
|
|
"entity_id": "rest_command.send_envoy_param_tariff",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "ee decode tariff script",
|
|
"room": null,
|
|
"type": "script",
|
|
"id": {
|
|
"entity_id": "script.ee_decode_tariff",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "While CP Automation",
|
|
"room": null,
|
|
"type": "automation",
|
|
"id": {
|
|
"entity_id": "automation.ee_while_cp",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "While DL Automation",
|
|
"room": null,
|
|
"type": "automation",
|
|
"id": {
|
|
"entity_id": "automation.ee_while_dl",
|
|
"device_id": null
|
|
}
|
|
}
|
|
]
|
|
}
|
|
] |