- id: '1755254428695' alias: 🏊🏻 Piscina - Arranque com excedente FV description: '' triggers: - entity_id: binary_sensor.piscina_excedente_fv_bomba to: 'on' for: 00:02:00 trigger: state conditions: - condition: numeric_state entity_id: input_number.piscina_filtracao_min_restantes above: 0 - condition: sun after: sunrise after_offset: 00:15:00 before: sunset before_offset: -00:15:00 actions: - target: entity_id: - switch.bomba_piscina - switch.bomba_piscina_switch_0 action: switch.turn_on data: {} mode: single - id: '1755259008848' alias: Piscina - Manual terminou (desligar e sair do override) description: '' triggers: - event_type: timer.finished event_data: entity_id: timer.piscina_manual trigger: event conditions: [] actions: - target: entity_id: - switch.bomba_piscina_switch_0 action: switch.turn_off data: {} - target: entity_id: input_boolean.piscina_override_manual action: input_boolean.turn_off data: {} mode: single - id: '1755339332285' alias: 🏊🏻 Piscina - Watchdog arranque FV (*/2min) v2 description: '' triggers: - minutes: /2 trigger: time_pattern conditions: - condition: state entity_id: input_boolean.piscina_override_manual state: 'off' - condition: state state: 'off' entity_id: switch.bomba_piscina_switch_0 - condition: numeric_state entity_id: input_number.piscina_filtracao_min_restantes above: 0 - condition: state entity_id: binary_sensor.piscina_excedente_fv_bomba state: 'on' - condition: sun after: sunrise after_offset: 00:15:00 before: sunset before_offset: -00:15:00 actions: - target: entity_id: switch.bomba_piscina_switch_0 action: switch.turn_on data: {} mode: single - id: '1755339342740' alias: 🏊🏻 Piscina - Watchdog arranque FV (*/2min) v2 description: '' triggers: - minutes: /2 trigger: time_pattern conditions: - condition: state entity_id: input_boolean.piscina_override_manual state: 'off' - condition: state state: 'off' entity_id: switch.bomba_piscina_switch_0 - condition: numeric_state entity_id: input_number.piscina_filtracao_min_restantes above: 0 - condition: state entity_id: binary_sensor.piscina_excedente_fv_bomba state: 'on' - condition: sun after: sunrise after_offset: 00:15:00 before: sunset before_offset: -00:15:00 actions: - target: entity_id: switch.bomba_piscina_switch_0 action: switch.turn_on data: {} mode: single - id: '1755339343598' alias: 🏊🏻 Piscina - Watchdog arranque FV (*/2min) v2 description: '' triggers: - minutes: /2 trigger: time_pattern conditions: - condition: state entity_id: input_boolean.piscina_override_manual state: 'off' - condition: state state: 'off' entity_id: switch.bomba_piscina_switch_0 - condition: numeric_state entity_id: input_number.piscina_filtracao_min_restantes above: 0 - condition: state entity_id: binary_sensor.piscina_excedente_fv_bomba state: 'on' - condition: sun after: sunrise after_offset: 00:15:00 before: sunset before_offset: -00:15:00 actions: - target: entity_id: switch.bomba_piscina_switch_0 action: switch.turn_on data: {} mode: single - id: '1717785108600' alias: SpeedTests description: '' trigger: - platform: time at: 06:30:00 - platform: time at: '18:30:00' - event: sunrise offset: -00:35:00 platform: sun condition: [] action: - service: homeassistant.update_entity data: {} target: entity_id: sensor.speedtest_download mode: single - id: '1717785145333' alias: '[🏡] Callback to open gate from action' description: '' trigger: - platform: event event_type: mobile_app_notification_action event_data: action: ABRIR_PORTAO condition: [] action: - service: cover.open_cover data: {} target: entity_id: - cover.gate mode: restart - id: '1717785168033' alias: '[💡🏡] Garage light on when gate opens/closes' description: '' trigger: - platform: state entity_id: - cover.gate from: closed to: open for: hours: 0 minutes: 0 seconds: 2 - platform: state entity_id: - cover.gate from: open to: closed for: hours: 0 minutes: 0 seconds: 2 condition: - condition: state entity_id: sun.sun state: below_horizon action: - if: - condition: state entity_id: cover.gate state: open then: - service: light.turn_on metadata: {} data: {} target: entity_id: light.exterior - if: - condition: state entity_id: cover.gate state: closed for: hours: 0 minutes: 5 seconds: 0 then: - service: light.turn_off metadata: {} data: {} target: entity_id: light.exterior mode: single - id: '1717785178989' alias: '[💡🏡]Notificação para ligar o carro ao carregador' description: '' triggers: - trigger: time_pattern minutes: /15 conditions: - condition: numeric_state entity_id: sensor.i4_edrive40_remaining_battery_percent below: 46 - condition: state entity_id: device_tracker.i4_edrive40 state: home actions: - delay: hours: 0 minutes: 10 seconds: 0 milliseconds: 0 - repeat: sequence: - parallel: - if: - condition: state entity_id: binary_sensor.hk_presence_cmouta state: 'on' then: - metadata: {} data: title: 🔋🚗⚡🔌BMW i4 message: Amor, não te esqueças de ligar o carro ao carregador! ❤️😘 action: notify.mobile_app_iphone_de_cristina_3 - if: - condition: state entity_id: binary_sensor.hk_presence_gblima state: 'on' then: - metadata: {} data: message: O i4 não está ligado ao carregador! title: 🔋🚗⚡🔌BMW i4 action: notify.notify - delay: hours: 0 minutes: 15 seconds: 0 milliseconds: 0 while: - condition: state entity_id: device_tracker.i4_edrive40 state: home for: hours: 0 minutes: 0 seconds: 0 - condition: numeric_state entity_id: sensor.i4_edrive40_remaining_battery_percent below: 70 - condition: state entity_id: binary_sensor.i4_edrive40_connection_status state: 'off' for: hours: 0 minutes: 0 seconds: 0 - condition: template value_template: '{{ repeat.index <= 8 }}' mode: single - id: '1717786183938' alias: '[📣🏡] Envia notificação para abrir o portão quando chega a casa' description: '' trigger: - platform: numeric_state entity_id: - sensor.home_glima_distance below: 50 id: glima1 - platform: numeric_state entity_id: - sensor.home_cmouta_distance below: 50 id: cmouta1 condition: [] action: - if: - condition: trigger id: - glima1 then: - service: notify.mobile_app_glphone metadata: {} data: message: Queres abrir o portão de casa? title: 🏡 🔑 Bem-Vindo a casa Guilherme! data: tag: open-home-gate actions: - action: ABRIR_PORTAO title: Sim authenticationRequired: true activationMode: background icon: sfsymbols:door.garage.closed - delay: hours: 0 minutes: 10 seconds: 0 milliseconds: 0 - service: notify.mobile_app_glphone metadata: {} data: data: tag: open-home-gate message: clear_notification - if: - condition: trigger id: - cmouta1 then: - service: notify.mobile_app_iphone_de_cristina_3 metadata: {} data: message: Queres abrir o portão de casa? title: 🏡 🔑 Bem-Vinda a casa Cristina! data: tag: open-home-gate actions: - action: ABRIR_PORTAO title: Sim authenticationRequired: true activationMode: background icon: sfsymbols:door.garage.closed - delay: hours: 0 minutes: 10 seconds: 0 milliseconds: 0 - service: notify.mobile_app_iphone_de_cristina_3 metadata: {} data: message: clear_notification data: tag: open-home-gate mode: single - id: '1717786217050' alias: '[📣🏡] Notify when garage door was left open for too long' description: '' triggers: - entity_id: - cover.gate to: open for: hours: 0 minutes: 5 seconds: 0 from: closed trigger: state conditions: [] actions: - repeat: sequence: - action: camera.snapshot metadata: {} data: filename: /config/www/camera_snapshots/mysnap_portao.jpg target: entity_id: camera.patio_exterior_hd_stream - action: telegram_bot.send_message metadata: {} data: message: Está aberto a mais de 5 minutos. Fechar? title: 🚙🚨 Portão de casa aberto!🚨 - action: telegram_bot.send_photo metadata: {} data: authentication: digest file: /config/www/camera_snapshots/mysnap_portao.jpg - data: title: 🚙 Portão de casa aberto! message: Está aberto a mais de 5 minutos. Fechar? action: notify.notify enabled: true - delay: hours: 0 minutes: 5 seconds: 0 milliseconds: 0 while: - condition: state entity_id: cover.gate state: open - action: camera.snapshot metadata: {} data: filename: /config/www/camera_snapshots/mysnap_portao.jpg target: entity_id: camera.patio_exterior_hd_stream - action: telegram_bot.send_message metadata: {} data: message: O portão está fechado. title: 🚙✅Portão de casa fechado.✅ - action: telegram_bot.send_photo metadata: {} data: authentication: digest file: /config/www/camera_snapshots/mysnap_portao.jpg - data: title: 🚙✅Portão de casa fechado.✅ message: O portão está fechado. action: notify.notify enabled: true mode: single - id: '1717786230999' alias: '[📣📲] Callback notification to open garage' description: '' trigger: - platform: event event_type: ios.action_fired event_data: actionID: 06BE95EF-F583-440C-9BED-C5FEB7684C15 context: user_id: - fc76053283b948f39e0979158ba02875 alias: gblima id: gblima2 - platform: event event_type: ios.action_fired event_data: actionID: EA13513A-5C16-44C1-B9ED-8AEC747DC1D0 context: user_id: - 7df539210ca3465e9ca91c3e2f1bd7e0 alias: cmouta id: cmouta2 condition: [] action: - service: cover.open_cover data: {} target: entity_id: - cover.gate - delay: hours: 0 minutes: 2 seconds: 0 milliseconds: 0 - alias: gblima notificações if: - condition: and conditions: - condition: trigger id: - gblima2 - condition: state entity_id: cover.gate state: closed - condition: state entity_id: input_boolean.gblima_present state: 'off' then: - service: notify.mobile_app_glphone metadata: {} data: message: O portão está fechado.✅🔒 title: 🚗 Ate Logo! 🙂 data: tag: open-home-gate - delay: hours: 0 minutes: 5 seconds: 0 milliseconds: 0 - service: notify.mobile_app_glphone metadata: {} data: message: clear_notification data: tag: open-home-gate else: - if: - condition: and conditions: - condition: trigger id: - gblima2 - condition: state entity_id: input_boolean.gblima_present state: 'off' then: - service: notify.mobile_app_glphone metadata: {} data: message: ⚠️O portão não fechou!!!⚠️🔓 data: push: interruption-level: critical title: '------------' - alias: cmouta notificações if: - condition: and conditions: - condition: trigger id: - cmouta2 - condition: state entity_id: cover.gate state: closed - condition: state entity_id: input_boolean.cmouta_present state: 'off' then: - service: notify.mobile_app_iphone_de_cristina_3 data: data: tag: open-home-gate message: O portão está fechado.✅🔒 title: 🚗 Ate Logo! 🙂 - delay: hours: 0 minutes: 5 seconds: 0 milliseconds: 0 - service: notify.mobile_app_iphone_de_cristina_3 metadata: {} data: message: clear_notification data: tag: open-home-gate else: - if: - condition: and conditions: - condition: trigger id: - cmouta2 - condition: state entity_id: input_boolean.cmouta_present state: 'off' then: - service: notify.mobile_app_iphone_de_cristina_3 data: data: push: interruption-level: critical message: ⚠️O portão não fechou!!!⚠️🔓 title: '------------' mode: single - id: '1717786241528' alias: 🏊🏻 Bomba Piscina Noite description: '' triggers: - at: input_datetime.horario_piscina_noite trigger: time conditions: - condition: and conditions: - condition: template value_template: '{%- set filtragemdiaria = state_attr(''sensor.filtragem_piscina_historico_s'', ''today-1'') | int -%} {%- set duration = states(''input_number.pool_pump_duration_lower_threshold'') | int -%} {%- set durationt = duration * 60 -%} {{ filtragemdiaria < durationt }}' - condition: or conditions: - condition: numeric_state entity_id: sensor.media_de_cobertura_de_nuvens_10_00_18_00 above: 35 - condition: template value_template: '{%- set filtragemdiaria = states(''sensor.filtragem_piscina_historico_s'') | int -%} {{ filtragemdiaria <= 3600 }}' actions: - if: - condition: or conditions: - condition: state entity_id: sensor.season state: spring - condition: state entity_id: sensor.season state: summer then: - metadata: {} data: {} target: entity_id: - switch.bomba_piscina_switch_0 action: switch.turn_on - repeat: sequence: - delay: hours: 0 minutes: 0 seconds: 5 milliseconds: 0 - type: turn_on device_id: e5f1b9b1d10308b32ef8f69bc0d20d74 entity_id: 43f5cd2f7257fed3e55788df58ce96de domain: switch while: - condition: device type: is_off device_id: e5f1b9b1d10308b32ef8f69bc0d20d74 entity_id: 43f5cd2f7257fed3e55788df58ce96de domain: switch - condition: template value_template: '{{ repeat.index <= 10 }}' - delay: '{{ [(states(''input_number.pool_pump_duration_lower_threshold'') | int) * 60 - state_attr(''sensor.filtragem_piscina_historico_s'', ''today-1'') | int(0),0] | max }}' - target: entity_id: - switch.bomba_piscina_switch_0 data: {} action: switch.turn_off else: - metadata: {} data: {} target: entity_id: - switch.bomba_piscina_switch_0 action: switch.turn_on - repeat: sequence: - delay: hours: 0 minutes: 0 seconds: 5 milliseconds: 0 - type: turn_on device_id: e5f1b9b1d10308b32ef8f69bc0d20d74 entity_id: 43f5cd2f7257fed3e55788df58ce96de domain: switch while: - condition: device type: is_off device_id: e5f1b9b1d10308b32ef8f69bc0d20d74 entity_id: 43f5cd2f7257fed3e55788df58ce96de domain: switch - condition: template value_template: '{{ repeat.index <= 10 }}' - delay: '{{ [(states(''input_number.pool_pump_duration_inverno'') | int) * 60 - state_attr(''sensor.filtragem_piscina_historico_s'', ''today-1'') | int(0),0] | max }}' - target: entity_id: - switch.bomba_piscina_switch_0 data: {} action: switch.turn_off mode: single - id: '1717786251723' alias: 🏊🏻 Cascata description: Inicia ou para a Cascata na piscina com 1 click no botão shelly triggers: - device_id: 50eb20ac53472c3cc1b1da733634d1c8 domain: bthome type: button subtype: press trigger: device conditions: [] actions: - type: toggle device_id: ed7ccde197e708b2a6b6cd25ef2e60c5 entity_id: 44b25a719c3fa50cbbd4ebd6e57fcdb9 domain: switch enabled: true mode: single - id: '1717786261877' alias: 🏊🏻 Hidrojet description: '' trigger: - platform: device device_id: 50eb20ac53472c3cc1b1da733634d1c8 domain: bthome type: button subtype: double_press condition: [] action: - if: - condition: device type: is_off device_id: 8be4eb1cd22d4bd03d7c70c99e84930b entity_id: a282d1ef3a0591beb9ddf1392c8e3e42 domain: switch then: - type: turn_off device_id: e5f1b9b1d10308b32ef8f69bc0d20d74 entity_id: 43f5cd2f7257fed3e55788df58ce96de domain: switch - service: automation.turn_off data: stop_actions: true target: entity_id: automation.new_automation_3 - delay: hours: 0 minutes: 0 seconds: 5 milliseconds: 0 - type: turn_on device_id: 8be4eb1cd22d4bd03d7c70c99e84930b entity_id: a282d1ef3a0591beb9ddf1392c8e3e42 domain: switch - repeat: sequence: - delay: hours: 0 minutes: 0 seconds: 30 milliseconds: 0 while: - condition: device type: is_on device_id: 8be4eb1cd22d4bd03d7c70c99e84930b entity_id: a282d1ef3a0591beb9ddf1392c8e3e42 domain: switch - service: automation.turn_on data: {} target: entity_id: automation.new_automation_3 else: - type: turn_off device_id: 8be4eb1cd22d4bd03d7c70c99e84930b entity_id: a282d1ef3a0591beb9ddf1392c8e3e42 domain: switch - service: automation.turn_on data: {} target: entity_id: automation.new_automation_3 mode: restart - id: '1717786272132' alias: 🏊🏻 Ligar/Desligar Automação Piscina description: Liga e desliga a Wallbox triggers: - minutes: /5 trigger: time_pattern conditions: [] actions: - if: - condition: and conditions: - condition: sun after: sunrise before: sunset - condition: numeric_state entity_id: sensor.duracao_filtragem_piscina_diario_em_segundos above: 10800 - condition: state entity_id: device_tracker.i4_edrive40 state: home - condition: state entity_id: binary_sensor.i4_edrive40_connection_status state: 'on' - condition: numeric_state entity_id: sensor.i4_edrive40_remaining_battery_percent below: 100 then: - data: stop_actions: true target: entity_id: automation.new_automation_3 action: automation.turn_off - metadata: {} data: {} target: entity_id: - switch.bomba_piscina_switch_0 action: switch.turn_off - metadata: {} data: {} target: entity_id: switch.wallbox_charging_enabled action: switch.turn_on else: - if: - condition: time after: 09:00:00 before: '18:00:00' then: - data: {} target: entity_id: automation.new_automation_3 action: automation.turn_on - metadata: {} data: {} target: entity_id: switch.wallbox_charging_enabled enabled: false action: switch.turn_off - metadata: {} data: skip_condition: true target: entity_id: automation.new_automation_3 action: automation.trigger else: - data: stop_actions: true target: entity_id: automation.new_automation_3 action: automation.turn_off - target: entity_id: - switch.wallbox_charging_enabled data: {} enabled: false action: switch.turn_on mode: single - id: '1717786282800' alias: 🏊🏻 Variable Piscina timer description: '' triggers: - at: 00:00:00 trigger: time conditions: [] actions: - metadata: {} data: replace_attributes: false value: '{{ states(''sensor.duracao_filtragem_piscina_diario_em_segundos'') | default(0) | int }}' attributes: today-1: '{{ states(''sensor.filtragem_piscina_historico_s'') | default(0)| int }}' today-2: '{{ state_attr(''sensor.filtragem_piscina_historico_s'',''today-1'') | default(0) | int }}' today-3: '{{ state_attr(''sensor.filtragem_piscina_historico_s'',''today-2'') | default(0) | int }}' today-4: '{{ state_attr(''sensor.filtragem_piscina_historico_s'',''today-3'') | default(0) | int }}' today-5: '{{ state_attr(''sensor.filtragem_piscina_historico_s'',''today-4'') | default(0) | int }}' today-6: '{{ state_attr(''sensor.filtragem_piscina_historico_s'',''today-5'') | default(0) | int }}' today-7: '{{ state_attr(''sensor.filtragem_piscina_historico_s'',''today-6'') | default(0) | int }}' today-8: '{{ state_attr(''sensor.filtragem_piscina_historico_s'',''today-7'') | default(0) | int }}' today-9: '{{ state_attr(''sensor.filtragem_piscina_historico_s'',''today-8'') | default(0) | int }}' today-10: '{{ state_attr(''sensor.filtragem_piscina_historico_s'',''today-9'') | default(0) | int }}' target: entity_id: sensor.filtragem_piscina_historico_s action: variable.update_sensor mode: single - id: '1717786439250' alias: 🔋🚗⚡Change charge completion time description: '' trigger: - platform: state entity_id: - sensor.ev_smart_charging_charging attribute: raw_two_days condition: [] action: - if: - condition: time after: 00:00:00 before: 00:00:00 weekday: - sat - fri then: - service: select.select_option metadata: {} data: option: None target: entity_id: select.ev_smart_charging_charge_completion_time - service: switch.turn_off metadata: {} data: {} target: entity_id: switch.ev_smart_charging_continuous_charging_preferred else: - service: select.select_option metadata: {} data: option: 08:00 target: entity_id: select.ev_smart_charging_charge_completion_time - service: switch.turn_on metadata: {} data: {} target: entity_id: switch.ev_smart_charging_continuous_charging_preferred mode: single - id: '1717786450595' alias: 🔋🚗⚡Disable i4 Climate if not home description: '' trigger: - platform: state entity_id: - switch.i4_edrive40_climate from: 'off' to: 'on' condition: - condition: device device_id: 73087b9e1e3a0ceb0fc6d4024bd9ffe1 domain: device_tracker entity_id: 17973f520f671f084cc637505d0c747d type: is_not_home - condition: time after: 07:40:00 before: 08:00:00 weekday: - mon - tue - wed - thu - fri action: - service: switch.turn_off metadata: {} data: {} target: entity_id: switch.i4_edrive40_climate mode: single - id: '1717786462808' alias: 🔋🚗⚡EV Connected to Charger description: '' triggers: - entity_id: - binary_sensor.i4_edrive40_connection_status trigger: state id: i4 - entity_id: - sensor.ev_smart_charging_status_2 trigger: state id: x1 conditions: [] actions: - if: - condition: and conditions: - condition: trigger id: - i4 - condition: state entity_id: binary_sensor.i4_edrive40_connection_status state: 'on' then: - data: {} target: entity_id: switch.ev_smart_charging_ev_connected action: switch.turn_on else: - data: {} target: entity_id: switch.ev_smart_charging_ev_connected action: switch.turn_off - if: - condition: and conditions: - condition: trigger id: - x1 - condition: state entity_id: binary_sensor.x1_xdrive25e_connection_status state: 'on' then: - data: {} target: entity_id: - switch.ev_smart_charging_ev_connected_2 action: switch.turn_on else: - data: {} target: entity_id: - switch.ev_smart_charging_ev_connected_2 action: switch.turn_off mode: single - id: '1717786472626' alias: '🔋🚗⚡EV Set SOC to 80% ' description: sempre que chega a casa e é ligado ao carregador. trigger: - platform: device device_id: 73087b9e1e3a0ceb0fc6d4024bd9ffe1 domain: device_tracker entity_id: 17973f520f671f084cc637505d0c747d type: enters zone: zone.home condition: - condition: time after: '18:00:00' before: 08:00:00 weekday: - sun - mon - tue - wed - thu - fri - sat action: - delay: hours: 0 minutes: 5 seconds: 0 milliseconds: 0 - service: number.set_value metadata: {} data: value: '80' target: entity_id: number.i4_edrive40_target_soc mode: single - id: '1717786483857' alias: 🔋🚗⚡EV Set Target SOC Dia description: '' trigger: - platform: time_pattern minutes: /5 condition: - condition: and conditions: - condition: time after: 08:00:00 before: '18:00:00' weekday: - sun - mon - tue - wed - thu - fri - sat - condition: state entity_id: automation.new_automation_3 state: 'off' - condition: state entity_id: device_tracker.i4_edrive40 state: home - condition: state entity_id: binary_sensor.i4_edrive40_connection_status state: 'on' enabled: true action: - if: - condition: and conditions: - condition: numeric_state entity_id: number.i4_edrive40_target_soc above: 79 - condition: numeric_state entity_id: sensor.i4_edrive40_remaining_battery_percent above: 79 enabled: true then: - service: number.set_value metadata: {} data: value: '100' target: entity_id: number.i4_edrive40_target_soc mode: single - id: '1717786494527' alias: 🔋🚗⚡EV Smart Charging - Start description: '' triggers: - entity_id: - sensor.ev_smart_charging_charging from: 'Off' to: 'On' trigger: state - entity_id: - sensor.ev_smart_charging_charging_2 from: 'Off' to: 'On' trigger: state conditions: [] actions: - data: {} target: entity_id: switch.evse_admin_rules_inverted action: switch.turn_on mode: single - id: '1717786503067' alias: 🔋🚗⚡EV Smart Charging - Stop description: '' triggers: - entity_id: - sensor.ev_smart_charging_charging from: 'On' to: 'Off' trigger: state - entity_id: - sensor.ev_smart_charging_charging_2 from: 'On' to: 'Off' trigger: state conditions: [] actions: - data: {} target: entity_id: switch.evse_admin_rules_inverted action: switch.turn_off mode: single - id: '1717786511680' alias: 🔋🚗⚡EV Smart Charging Set AC Current Limit description: '' trigger: - platform: state entity_id: - binary_sensor.i4_edrive40_charging_status from: null to: 'on' condition: - condition: device device_id: 73087b9e1e3a0ceb0fc6d4024bd9ffe1 domain: device_tracker entity_id: 17973f520f671f084cc637505d0c747d type: is_home action: - repeat: sequence: - service: select.select_option metadata: {} data: option: '32' target: entity_id: select.i4_edrive40_ac_charging_limit - delay: hours: 0 minutes: 1 seconds: 0 milliseconds: 0 while: - condition: numeric_state entity_id: sensor.i4_edrive40_ac_current_limit above: 5 below: 32 - condition: template value_template: '{{ repeat.index <= 30 }}' mode: single - id: '1717786521476' alias: 🔋🚗⚡Help for charging at home description: '' triggers: - entity_id: - sensor.ev_smart_charging_charging to: 'on' trigger: state for: hours: 0 minutes: 5 seconds: 0 id: i4 - entity_id: - sensor.ev_smart_charging_charging_2 to: 'on' trigger: state for: hours: 0 minutes: 5 seconds: 0 id: x1 conditions: - condition: or conditions: - condition: and conditions: - condition: state entity_id: device_tracker.i4_edrive40 state: home - condition: state entity_id: binary_sensor.i4_edrive40_connection_status state: 'on' - condition: numeric_state entity_id: sensor.wallbox_charging_power below: 2 - condition: trigger id: - i4 - condition: and conditions: - condition: state entity_id: device_tracker.x1_xdrive25e state: Home - condition: state entity_id: binary_sensor.x1_xdrive25e_connection_status state: 'on' - condition: numeric_state entity_id: sensor.wallbox_charging_power below: 2 - condition: trigger id: - x1 actions: - if: - condition: trigger id: - i4 then: - device_id: 73087b9e1e3a0ceb0fc6d4024bd9ffe1 domain: lock entity_id: 4cad819e94c6b23041776358896b68a0 type: unlock - delay: hours: 0 minutes: 1 seconds: 0 milliseconds: 0 - device_id: 73087b9e1e3a0ceb0fc6d4024bd9ffe1 domain: lock entity_id: 4cad819e94c6b23041776358896b68a0 type: lock - delay: hours: 0 minutes: 1 seconds: 0 milliseconds: 0 - action: button.press metadata: {} data: {} target: entity_id: button.ev_smart_charging_manually_start_charging - if: - condition: trigger id: - x1 then: - device_id: d2b7376b62ba76e3cebf5d2479e76922 domain: lock entity_id: 2574b858b69f29422a37da5a8a6db887 type: unlock - delay: hours: 0 minutes: 1 seconds: 0 milliseconds: 0 - device_id: d2b7376b62ba76e3cebf5d2479e76922 domain: lock entity_id: 2574b858b69f29422a37da5a8a6db887 type: lock - delay: hours: 0 minutes: 1 seconds: 0 milliseconds: 0 - action: button.press metadata: {} data: {} target: entity_id: button.ev_smart_charging_manually_start_charging mode: single - id: '1717786531178' alias: '🛋️ Sala: Baixar Estores Sunset' description: Baixar os estores quando o sol se põe trigger: - platform: sun event: sunset offset: -00:15:00 condition: [] action: - if: - condition: state entity_id: group.alguem_em_casa state: home then: - service: cover.close_cover metadata: {} data: {} target: entity_id: - cover.estore_3_estore_3 - service: light.turn_on metadata: {} data: {} target: entity_id: light.candeeiros_sala_inferior - delay: hours: 0 minutes: 0 seconds: 5 milliseconds: 0 - service: cover.close_cover metadata: {} data: {} target: entity_id: cover.estore_2_estore_2 else: - service: cover.close_cover metadata: {} data: {} target: entity_id: - cover.estore_3_estore_3 - delay: hours: 0 minutes: 0 seconds: 5 milliseconds: 0 - service: cover.close_cover metadata: {} data: {} target: entity_id: cover.estore_2_estore_2 mode: single - id: '1717786542943' alias: '🛋️ Sala: Subir estores manhã' description: Subir os estores quando as 07:45 triggers: - at: 07:45:00 trigger: time conditions: [] actions: - action: cover.open_cover metadata: {} data: {} target: entity_id: cover.estores mode: single - id: '1717786571925' alias: Smart Grid Auto on description: '' trigger: - platform: state entity_id: - sensor.template_coopernico_spot_price_bihorario condition: [] action: - if: - condition: numeric_state entity_id: sensor.template_coopernico_spot_price_bihorario below: 76 then: - type: turn_on device_id: fdb41e98b294e9204d61b1a6320f6c91 entity_id: 812cfe69bc952bc3c627fef200856b27 domain: switch else: - type: turn_off device_id: fdb41e98b294e9204d61b1a6320f6c91 entity_id: 812cfe69bc952bc3c627fef200856b27 domain: switch mode: single - id: '1717786590629' alias: Status Portão description: Status do portão de casa, para resolver o flapping do sensor e o switch do shelly ter temporizador de 1 segundo. trigger: - platform: state entity_id: - switch.portao from: 'off' to: 'on' condition: [] action: - service: input_boolean.turn_on target: entity_id: input_boolean.portao_status data: {} - delay: hours: 0 minutes: 0 seconds: 50 milliseconds: 0 - service: input_boolean.turn_off target: entity_id: input_boolean.portao_status data: {} mode: single - id: '1717929670853' alias: Automatic Backups description: '' trigger: - id: daily platform: time at: 01:00:00 - id: hourly enabled: true platform: time_pattern hours: /12 condition: [] action: - if: - condition: trigger id: daily then: - choose: - conditions: - condition: template value_template: '{{ enable_yearly }}' - condition: template value_template: '{{ now().day == 1 and now().month == 1 }}' sequence: - variables: backup_type: yearly keep_days: 365 - variables: name: "{{ backup_type | title }}Backup: {{\n now().strftime(\n \"\ %A, \"\n ~ iif(backup_type == \"hourly\", \"%-I:%M %p, \", \"\")\n\ \ ~ \"%B %-d, %Y\"\n )\n}}\n{# HourlyBackup: Monday, 3:04 PM, January\ \ 2, 2006 #}\n{# DailyBackup: Monday, January 2, 2006 #}\n" backup_action: - service: auto_backup.backup data: name: '{{ name }}' password: '{{ password }}' keep_days: '{{ keep_days }}' include_folders: - config - if: - condition: template value_template: '{{ not use_action_hourly }}' - condition: template value_template: '{{ backup_action | length > 0 }}' then: - service: auto_backup.backup data: name: '{{ name }}' password: '{{ password }}' keep_days: '{{ keep_days }}' include_folders: - config else: - alias: Creating a full backup (default action) service: auto_backup.backup data: name: '{{ name }}' password: '{{ password }}' keep_days: '{{ keep_days }}' - conditions: - condition: template value_template: '{{ enable_monthly }}' - condition: template value_template: '{{ now().day == 1 }}' sequence: - variables: backup_type: monthly keep_days: 90 - variables: name: "{{ backup_type | title }}Backup: {{\n now().strftime(\n \"\ %A, \"\n ~ iif(backup_type == \"hourly\", \"%-I:%M %p, \", \"\")\n\ \ ~ \"%B %-d, %Y\"\n )\n}}\n{# HourlyBackup: Monday, 3:04 PM, January\ \ 2, 2006 #}\n{# DailyBackup: Monday, January 2, 2006 #}\n" backup_action: - service: auto_backup.backup data: name: '{{ name }}' password: '{{ password }}' keep_days: '{{ keep_days }}' include_folders: - config - if: - condition: template value_template: '{{ not use_action_hourly }}' - condition: template value_template: '{{ backup_action | length > 0 }}' then: - service: auto_backup.backup data: name: '{{ name }}' password: '{{ password }}' keep_days: '{{ keep_days }}' include_folders: - config else: - alias: Creating a full backup (default action) service: auto_backup.backup data: name: '{{ name }}' password: '{{ password }}' keep_days: '{{ keep_days }}' - conditions: - condition: template value_template: '{{ enable_weekly }}' - condition: template value_template: '{{ now().weekday() == 0 }}' sequence: - variables: backup_type: weekly keep_days: 30 - variables: name: "{{ backup_type | title }}Backup: {{\n now().strftime(\n \"\ %A, \"\n ~ iif(backup_type == \"hourly\", \"%-I:%M %p, \", \"\")\n\ \ ~ \"%B %-d, %Y\"\n )\n}}\n{# HourlyBackup: Monday, 3:04 PM, January\ \ 2, 2006 #}\n{# DailyBackup: Monday, January 2, 2006 #}\n" backup_action: - service: auto_backup.backup data: name: '{{ name }}' password: '{{ password }}' keep_days: '{{ keep_days }}' include_folders: - config - if: - condition: template value_template: '{{ not use_action_hourly }}' - condition: template value_template: '{{ backup_action | length > 0 }}' then: - service: auto_backup.backup data: name: '{{ name }}' password: '{{ password }}' keep_days: '{{ keep_days }}' include_folders: - config else: - alias: Creating a full backup (default action) service: auto_backup.backup data: name: '{{ name }}' password: '{{ password }}' keep_days: '{{ keep_days }}' - conditions: - condition: template value_template: '{{ enable_daily }}' sequence: - variables: backup_type: daily keep_days: 7 - variables: name: "{{ backup_type | title }}Backup: {{\n now().strftime(\n \"\ %A, \"\n ~ iif(backup_type == \"hourly\", \"%-I:%M %p, \", \"\")\n\ \ ~ \"%B %-d, %Y\"\n )\n}}\n{# HourlyBackup: Monday, 3:04 PM, January\ \ 2, 2006 #}\n{# DailyBackup: Monday, January 2, 2006 #}\n" backup_action: - service: auto_backup.backup data: name: '{{ name }}' password: '{{ password }}' keep_days: '{{ keep_days }}' include_folders: - config - if: - condition: template value_template: '{{ not use_action_hourly }}' - condition: template value_template: '{{ backup_action | length > 0 }}' then: - service: auto_backup.backup data: name: '{{ name }}' password: '{{ password }}' keep_days: '{{ keep_days }}' include_folders: - config else: - alias: Creating a full backup (default action) service: auto_backup.backup data: name: '{{ name }}' password: '{{ password }}' keep_days: '{{ keep_days }}' else: - variables: backup_type: hourly keep_days: 1 - variables: name: "{{ backup_type | title }}Backup: {{\n now().strftime(\n \"%A, \"\ \n ~ iif(backup_type == \"hourly\", \"%-I:%M %p, \", \"\")\n ~ \"\ %B %-d, %Y\"\n )\n}}\n{# HourlyBackup: Monday, 3:04 PM, January 2, 2006\ \ #}\n{# DailyBackup: Monday, January 2, 2006 #}\n" backup_action: - service: auto_backup.backup data: name: '{{ name }}' password: '{{ password }}' keep_days: '{{ keep_days }}' include_folders: - config - if: - condition: template value_template: '{{ backup_action | length > 0 }}' then: - service: auto_backup.backup data: name: '{{ name }}' password: '{{ password }}' keep_days: '{{ keep_days }}' include_folders: - config else: - alias: Creating a partial backup (default action) service: auto_backup.backup data: name: '{{ name }}' password: '{{ password }}' keep_days: '{{ keep_days }}' include_folders: - config mode: single variables: password: '' enable_hourly: true enable_daily: true enable_weekly: true enable_monthly: false enable_yearly: false use_action_hourly: true - id: '1718129262036' alias: 🏊🏻Bomba Piscina Dia description: '' use_blueprint: path: PVExcessControl/pv_excess_control.yaml input: automation_id: automation.new_automation_3 grid_voltage: 230 pv_power: sensor.emoncms_solar export_power: sensor.emoncms_export_power_positive load_power: sensor.emoncms_use actual_power: sensor.bomba_piscina_switch_0_power power_toggle_margin: 10 appliance_switch: switch.bomba_piscina_switch_0 inverter_limit: 0 - id: '1718180786151' alias: 💡Luz Corredor auto description: '' use_blueprint: path: Blackshome/sensor-light.yaml input: motion_trigger: - binary_sensor.bthome_sensor_9179_motion - binary_sensor.corredor_superior_corredor_superior_motion_alarm light_switch: entity_id: - light.shellyplus2pm_c82e180d5f10_switch_1 include_sun: sun_enabled ambient_light_sensor: sensor.shelly_b_0114_illuminance include_ambient: ambient_enabled - id: '1718181298382' alias: 💡Luz Exterior Auto description: '' use_blueprint: path: Blackshome/sensor-light.yaml input: motion_trigger: - binary_sensor.shelly_b_0114_window light_switch: entity_id: light.exterior time_delay: 10 include_sun: sun_enabled night_lights_conditions: [] - id: '1718533356578' alias: Update Coopernico Prices description: '' trigger: - platform: time_pattern minutes: /5 condition: [] action: - service: homeassistant.update_entity data: {} target: entity_id: sensor.coopernico_prices - service: homeassistant.update_entity data: {} target: entity_id: sensor.coopernico_injection mode: single - id: '1718718997708' alias: Solcast update description: '' trigger: - platform: template value_template: "{% set nr = as_datetime(state_attr('sun.sun','next_rising'))\ \ | as_local %} {% set ns = as_datetime(state_attr('sun.sun','next_setting'))\ \ | as_local %} {% set api_request_limit = 10 %} {% if nr > ns %}\n {% set\ \ nr = nr - timedelta(hours = 24) %} \n{% endif %} {% set hours_difference =\ \ (ns - nr) %} {% set interval_hours = hours_difference / api_request_limit\ \ %} {% set ns = namespace(match = false) %} {% for i in range(api_request_limit)\ \ %}\n {% set start_time = nr + (i * interval_hours) %}\n {% if ((start_time\ \ - timedelta(seconds=30)) <= now()) and (now() <= (start_time + timedelta(seconds=30)))\ \ %}\n {% set ns.match = true %}\n {% endif %}\n{% endfor %} {{ ns.match\ \ }}" condition: - condition: sun before: sunset after: sunrise action: - delay: seconds: '{{ range(30, 360)|random|int }}' - service: solcast_solar.update_forecasts data: {} mode: single - id: '1718905487958' alias: 💡Luz Escadas Superior Auto description: '' use_blueprint: path: Blackshome/sensor-light.yaml input: light_switch: entity_id: light.luzes_sala_superior_channel_1 motion_trigger: - binary_sensor.motion_sensor_z_wave_plus_motion_sensor_z_wave_plus_motion_alarm include_sun: sun_enabled include_ambient: ambient_disabled ambient_light_sensor: sensor.motion_sensor_z_wave_plus_motion_sensor_z_wave_plus_luminance ambient_light_options: ambient_light_option_enabled - id: '1728665169529' alias: 🔋UPS - Notification description: '' triggers: - entity_id: - sensor.mclima_ups_informacao_do_estado - sensor.net_ups_informacao_do_estado id: battery trigger: state for: hours: 0 minutes: 1 seconds: 0 to: OB DISCHRG - entity_id: - sensor.mclima_ups_informacao_do_estado - sensor.net_ups_informacao_do_estado to: OL CHRG id: online trigger: state - entity_id: - sensor.mclima_ups_informacao_do_estado - sensor.net_ups_informacao_do_estado id: replace_battery trigger: state for: hours: 0 minutes: 5 seconds: 0 to: ALARM OL RB - entity_id: - sensor.mclima_ups_informacao_do_estado - sensor.net_ups_informacao_do_estado id: replace_battery trigger: state for: hours: 0 minutes: 5 seconds: 0 to: ALARM OL CHRH RB conditions: [] actions: - choose: - conditions: - condition: trigger id: battery sequence: - action: notify.mobile_app_glphone data: message: A UPS está em modo de bateria!!! 🔋 title: 🚨Energia data: push: interruption-level: time-sensitive sound: name: default critical: 1 volume: 1 - conditions: - condition: trigger id: online sequence: - action: notify.mobile_app_glphone data: message: A UPS já está online.🔋⚡ title: ✅Energia - conditions: - condition: trigger id: - replace_battery sequence: - action: notify.mobile_app_glphone data: title: ❗Trocar baterias na UPS.❗ message: As baterias da UPS têm de ser substituías. mode: single - id: '1728983716594' alias: Ventilador Cave Solar description: '' use_blueprint: path: PVExcessControl/pv_excess_control.yaml input: automation_id: automation.ventilador_cave appliance_priority: 2 pv_power: sensor.emoncms_solar export_power: sensor.emoncms_export_power_positive load_power: sensor.emoncms_use appliance_switch: switch.ventilador_cave_switch appliance_switch_interval: 2 actual_power: sensor.ventilador_cave_switch_0_power defined_current: 0.2 - id: '1730368547136' alias: ♨️ Bomba de Calor Power MQTT Publish description: '' triggers: - trigger: time_pattern seconds: /10 enabled: true conditions: [] actions: - action: mqtt.publish metadata: {} data: evaluate_payload: false qos: '2' topic: homeassistant/sensor/heating payload: '"{{ states(''sensor.hpsu_can_heating_emoncms'') }}"' - action: mqtt.publish metadata: {} data: qos: '2' topic: homeassistant/sensor/dhw payload: '"{{ states(''sensor.hpsu_can_dhw_emoncms'') }}"' - action: mqtt.publish metadata: {} data: evaluate_payload: false qos: '2' topic: homeassistant/sensor/t_outside payload: '"{{ states(''sensor.hpsu_can_outside_temperature'') }}"' - action: mqtt.publish metadata: {} data: evaluate_payload: false qos: '2' topic: homeassistant/sensor/target_room_temp payload: '"{{ states(''sensor.hspu_can_target_room_emoncms'') }}"' - action: mqtt.publish metadata: {} data: evaluate_payload: false qos: '2' topic: homeassistant/sensor/bomba_de_calor_flow_rate payload: '"{{ states(''sensor.hpsu_can_flow_rate'') }}"' - action: mqtt.publish metadata: {} data: evaluate_payload: false qos: '2' topic: homeassistant/sensor/thermal_power payload: '"{{ states(''sensor.hpsu_can_thermal_power_2'') }}"' - action: mqtt.publish metadata: {} data: evaluate_payload: false qos: '2' topic: homeassistant/sensor/flow_temperature_tv payload: '"{{ states(''sensor.hpsu_can_flow_temperature_tv'') }}"' - action: mqtt.publish metadata: {} data: evaluate_payload: false qos: '2' topic: homeassistant/sensor/flow_return_temperature_heating payload: '"{{ states(''sensor.hpsu_can_return_temperature_heating'') }}"' mode: single - id: '1732289985472' alias: MQTT Publish description: '' triggers: - trigger: state entity_id: - sensor.bmw_x1_charging_w_2 id: '1' - trigger: state entity_id: - sensor.bmw_i4_charging_w id: '2' conditions: [] actions: - if: - condition: trigger id: - '1' then: - action: mqtt.publish metadata: {} data: evaluate_payload: false qos: '2' topic: homeassistant/sensor/ev/bmwx1_charging_w payload: '"{{ states(''sensor.bmw_x1_charging_w_2'') | float(0) | round(0) }}"' - if: - condition: trigger id: - '2' then: - action: mqtt.publish metadata: {} data: evaluate_payload: false qos: '2' topic: homeassistant/sensor/ev/bmwi4_charging_w payload: '"{{ states(''sensor.bmw_i4_charging_w'') | float(0) | round(0) }}"' mode: single - id: '1742729233913' alias: 'Telegram Bot: Conversation with Assist' description: '' use_blueprint: path: marc-romu/telegram-bot--conversation.yaml input: conversation_agent: conversation.chatgpt - id: '1742733934795' alias: 'OpenAI Daily: Environmental Notification' description: '' triggers: - at: 08:05:00 trigger: time - at: '12:40:00' trigger: time - at: '18:30:00' trigger: time conditions: [] actions: - alias: 'Call a service ''Weather: Get Forecast''' action: weather.get_forecasts target: entity_id: weather.forecast_home data: type: daily response_variable: daily_forecast - data: agent_id: conversation.chatgpt text: '"Para esta tarefa, es um consultor meteorológico e es responsavel por garantir a qualidade do ar no interior da casa. Please provide your thoughts on our indoor air quality as it relates to the weather outside and our current heating / cooling system settings. Podes e deves usar um tom humorista. Podes usar emojis. Responde em portugues de portugal sem gerúndio. \_ Current time {{now()}} Current thermostat setting {{states(''select.hpsu_can_target_room_1_temperature'')}} Current Home temperature {{states(''sensor.emoncms_home_temperature'')}} °C Current Home average temperature is {{states(''sensor.casa_temperatura_media'')}} °C Current Home average humidity is {{states(''sensor.casa_humidade_media_relativa'')}} % Exterior Weather Data Temperature is {{ states(''sensor.bthome_sensor_6a2b_temperature'') }} °C Exterior Feels like temperature is {{ states(''sensor.home_temperatura_aparente'') }} °C Exterior Weather Data Humidity is {{ states(''sensor.bthome_sensor_6a2b_humidity'') }} % Current Rain Intensity {{ states(''sensor.home_precipitacao'') }} mm/h Forecasted Conditions for Today {{states(''sensor.home_condicao_dia_0'')}} Forecasted High Tempterature for Today {{states(''sensor.home_temperatura_max_realfeel_dia_0'')}} °C Forecasted Low Temperature for Today {{states(''sensor.home_temperatura_min_realfeel_dia_0'')}} °C' language: pt-pt enabled: true response_variable: agent action: conversation.process - action: telegram_bot.send_message metadata: {} data: title: Qualidade do Ar em Casa message: '{{agent.response.speech.plain.speech}}' mode: single - id: '1744301274357' alias: 🏊🏻 Automação Bomba Piscina description: '' triggers: - trigger: numeric_state entity_id: - sensor.potencia_emonpi_import_export_media_5_minutos below: -750 id: 'ON' - trigger: numeric_state entity_id: - sensor.potencia_emonpi_import_export_media_5_minutos id: 'OFF' above: 750 conditions: - condition: sun after: sunrise before: sunset actions: - if: - condition: trigger id: - 'ON' then: - type: turn_on device_id: e5f1b9b1d10308b32ef8f69bc0d20d74 entity_id: 43f5cd2f7257fed3e55788df58ce96de domain: switch - type: turn_on device_id: 1cb87651e79e117ef2610fc7e5c6a170 entity_id: d1b3ca4d6a019622064ef94336bbd650 domain: switch - if: - condition: trigger id: - 'OFF' then: - type: turn_off device_id: e5f1b9b1d10308b32ef8f69bc0d20d74 entity_id: 43f5cd2f7257fed3e55788df58ce96de domain: switch - type: turn_off device_id: 1cb87651e79e117ef2610fc7e5c6a170 entity_id: d1b3ca4d6a019622064ef94336bbd650 domain: switch mode: single - id: '1744308459186' alias: 🏊🏻 Bomba piscina botão description: '' triggers: - device_id: e6ae30b2d7855ae2d2b83b4497674bfb domain: bthome type: button subtype: press trigger: device conditions: [] actions: - type: toggle device_id: e5f1b9b1d10308b32ef8f69bc0d20d74 entity_id: 43f5cd2f7257fed3e55788df58ce96de domain: switch mode: single - id: '1744915008704' alias: 'OpenAI Daily: Piscina' description: '' triggers: - at: '20:30:00' trigger: time conditions: [] actions: - data: agent_id: conversation.chatgpt text: Para esta tarefa, es um consultor de piscinas e queres garantir sempre que a piscina está limpa e pronta a usar. Mostra quando vai ser iniciada a filtragem da noite. Calcula se a horas de filtragem são suficientes, usa os dados que são enviados. Podes e deves usar um tom humorista. Podes usar emojis. Responde em portugues de portugal sem gerúndio. \_ Current time {{now()}} tempo que a bomba da piscina esteve a trabalhar em {{states('sensor.duracao_filtragem_piscina_diario')}} tempo que o aquecimento da piscina esteve a funcionar {{states('sensor.duracao_aquecimento_piscina_diario')}} temperatura da piscina {{states('sensor.bomba_piscina_temperature')}} tempo que falta filtrar a piscina {{states('sensor.pool_pump_remaining_time')}} horario que vai ser iniciada a filtragem de noite {{states('sensor.bomba_piscina_noite_horario')}} Quantidade maxima em minutos que a piscina filtra por dia, tranforma em horas {{states('input_number.pool_pump_duration_lower_threshold')}} Energia gasta pela bomba da piscina {{states('sensor.energia_emonpi_piscina_use_total_kwhd')}} A bomba da piscina tem uma potencia de 1,5 CV. o volume da piscina é de 66 metros cubicos. calcula se a tempo de filtragem foi suficiente. language: pt-pt enabled: true response_variable: agent action: conversation.process - action: telegram_bot.send_message metadata: {} data: title: Piscina message: '{{agent.response.speech.plain.speech}}' mode: single - id: '1744969812713' alias: Pool Pump Solar Optimizationsdsdsd description: Gerencia a bomba da piscina priorizando energia solar e garantindo filtragem diária triggers: - minutes: /15 trigger: time_pattern - entity_id: sensor.solar_power trigger: state - at: 08:00:00 trigger: time - at: '22:00:00' trigger: time conditions: - condition: template value_template: '{{ not is_state(''binary_sensor.pool_pump_malfunction'', ''on'') }} ' actions: - target: entity_id: sensor.pool_pump_daily_runtime action: homeassistant.update_entity - choose: - conditions: - condition: time after: 08:00:00 before: '22:00:00' - condition: template value_template: '{{ states(''sensor.solar_power'')|float > min_solar_power }} ' sequence: - target: entity_id: switch.pool_pump action: switch.turn_on - target: entity_id: input_number.pool_pump_priority data: value: 1 action: input_number.set - conditions: - condition: time after: '22:00:00' before: 08:00:00 - condition: template value_template: '{% set daily_runtime = states(''sensor.pool_pump_daily_runtime'')|float %} {% set tomorrow_forecast = states(''sensor.tomorrow_solar_forecast'')|float %} {{ daily_runtime < min_daily_hours and tomorrow_forecast < 0.7 }} ' sequence: - target: entity_id: switch.pool_pump action: switch.turn_on - target: entity_id: input_number.pool_pump_priority data: value: 2 action: input_number.set default: - target: entity_id: switch.pool_pump action: switch.turn_off variables: min_daily_hours: 5 min_solar_power: 1000 pump_power: 800 mode: restart - id: '1745084857676' alias: 💡Candeeiros Ligar/Desligar description: '' triggers: - device_id: e8a6c706997d87b98183e26e7598ae8b domain: shelly type: single subtype: button trigger: device - device_id: d686deeba13232cfa6ab008fa8c80dc0 domain: bthome type: button_1 subtype: press trigger: device conditions: [] actions: - action: light.toggle metadata: {} data: {} target: entity_id: light.candeeiros_sala_inferior mode: single - id: '1745085627460' alias: 🏡Botão Sala Portão description: '' triggers: - device_id: e8a6c706997d87b98183e26e7598ae8b domain: shelly type: triple subtype: button trigger: device - device_id: d686deeba13232cfa6ab008fa8c80dc0 domain: bthome type: button_2 subtype: long_press trigger: device conditions: [] actions: - type: toggle device_id: c943a1b7851c56da555470902baf07a1 entity_id: 9e3a402090766bb2d314909658c4ee90 domain: switch mode: single - id: '1745085892451' alias: 'Desligar tudo Sala ' description: '' triggers: - device_id: e8a6c706997d87b98183e26e7598ae8b domain: shelly type: long subtype: button trigger: device - device_id: d686deeba13232cfa6ab008fa8c80dc0 domain: bthome type: button_1 subtype: long_press trigger: device conditions: [] actions: - action: light.turn_off metadata: {} data: {} target: entity_id: - light.sala_inferior - action: media_player.turn_off metadata: {} data: {} target: device_id: a5dd3a6582b27b004323486771a64137 - action: light.turn_on metadata: {} data: {} target: entity_id: light.shellyplus2pm_c82e180d5f10_switch_1 - delay: hours: 0 minutes: 1 seconds: 0 milliseconds: 0 - action: light.turn_off metadata: {} data: {} target: entity_id: light.shellyplus2pm_c82e180d5f10_switch_1 mode: single - id: '1745225774697' alias: ♨️ Heat Pump Error description: '' triggers: - trigger: state entity_id: - sensor.hpsu_can_error_code from: No Error id: Error - trigger: state entity_id: - sensor.hpsu_can_error_code id: ok to: No Error conditions: [] actions: - choose: - conditions: - condition: trigger id: - Error sequence: - action: telegram_bot.send_message metadata: {} data: message: 'A bomba de calor está em Erro. *ERROR:* {{states(''sensor.hpsu_can_error_code'') }} ' title: ❌ Error Bomba de Calor ❌ - conditions: - condition: trigger id: - ok sequence: - action: telegram_bot.send_message metadata: {} data: message: 'A bomba de calor está em {{states(''sensor.hpsu_can_error_code'') }} ' title: ✅ OK Bomba de Calor ✅ mode: single - id: '1745483501867' alias: ♨️ Hot Water Production Best price description: '' triggers: - at: sensor.aquecimento_agua_noite trigger: time conditions: - type: is_temperature condition: device device_id: dbbed3fc0849f129296b804033d10b74 entity_id: 869298e5bb3f09e40bb45c5ab1d10091 domain: sensor below: 45 actions: - device_id: dbbed3fc0849f129296b804033d10b74 domain: select entity_id: aa534d8176126b2ad55749fb0cc47992 type: select_option option: 'On' mode: single - id: '1745509795599' alias: '[🏡] Botão shelly Abrir Portão' description: '' triggers: - device_id: f3ec058f8ec36d128a8eaf0dd7286320 domain: bthome type: button subtype: press trigger: device conditions: [] actions: - type: toggle device_id: c943a1b7851c56da555470902baf07a1 entity_id: 9e3a402090766bb2d314909658c4ee90 domain: switch mode: single - id: '1745945849501' alias: '🪟Botão Sala Estore1 ' description: '' triggers: - device_id: e8a6c706997d87b98183e26e7598ae8b domain: shelly type: double subtype: button trigger: device conditions: [] actions: - action: cover.toggle metadata: {} data: {} target: entity_id: cover.estore1_cover_0 mode: single - id: '1746728025652' alias: 🏊🏻Atualizar pH filtrado com bomba ligada description: '' triggers: - entity_id: - switch.bomba_piscina_switch_0 to: 'on' trigger: state id: bomba from: 'off' - entity_id: sensor.ph_corrigido trigger: state enabled: true - trigger: time_pattern minutes: /5 conditions: - condition: state entity_id: switch.bomba_piscina_switch_0 state: 'on' for: hours: 0 minutes: 10 seconds: 0 - condition: template value_template: '{{ states(''sensor.ph_corrigido'') not in [''unavailable'', ''unknown''] }}' actions: - target: entity_id: - input_number.ph_sensor_filtrado data: value: '{{ states(''sensor.ph_sensor'') | float(2) }}' action: input_number.set_value - target: entity_id: input_number.ph_filtrado data: value: '{{ states(''sensor.ph_corrigido'') | float(2) }}' action: input_number.set_value mode: single - id: '1746780173077' alias: 🏊🏻Atualizar Temperatura Piscina filtrado com bomba de aquecimento ligada description: '' triggers: - trigger: time_pattern minutes: /5 conditions: - condition: state entity_id: switch.aquecimento_piscina_channel_1 state: 'on' for: hours: 0 minutes: 10 seconds: 0 - condition: template value_template: '{{ states(''sensor.bomba_piscina_temperature'') not in [''unavailable'', ''unknown''] }}' actions: - target: entity_id: - input_number.temperatura_piscina_filtrado data: value: '{{ states(''sensor.bomba_piscina_temperature'') | float(2) }}' action: input_number.set_value mode: single - id: '1747047245923' alias: New automation description: '' triggers: - trigger: time_pattern seconds: '30' conditions: [] actions: - action: weather.get_forecasts metadata: {} data: type: hourly target: entity_id: weather.forecast_home response_variable: forecast_data mode: single - id: '1747047675015' alias: ☁️Atualiza média de nuvens nas próximas 8h description: '' triggers: - hours: /1 trigger: time_pattern actions: - target: entity_id: weather.forecast data: type: hourly response_variable: forecast action: weather.get_forecasts - variables: clouds: "{{ forecast['weather.forecast']['forecast'][:8]\n | map(attribute='cloud_coverage')\n\ \ | reject('none')\n | list }}\n" avg_clouds: "{% if clouds | length > 0 %}\n {{ (clouds | map('float') | sum\ \ / clouds | length)\n | round(1) }}\n{% else %}\n 0\n{% endif %}\n" - data: entity_id: input_number.average_cloud_cover value: '{{ avg_clouds }}' action: input_number.set_value - id: '1747048335609' alias: ☁️Atualiza média de nuvens entre as 10:00 e as 18:00 description: '' triggers: - hours: /1 trigger: time_pattern conditions: [] actions: - if: - condition: time after: 00:00:00 before: '19:00:00' then: - target: entity_id: weather.forecast data: type: hourly response_variable: forecast action: weather.get_forecasts - variables: entries: '{{ forecast[''weather.forecast''][''forecast''] }} ' start: '{{ utcnow().replace(hour=10, minute=0, second=0, microsecond=0).isoformat(sep=''T'') }} ' end: '{{ utcnow().replace(hour=18, minute=0, second=0, microsecond=0).isoformat(sep=''T'') }} ' clouds: "{{ entries\n | selectattr('datetime', '>=', start)\n | selectattr('datetime',\ \ '<=', end)\n | map(attribute='cloud_coverage')\n | reject('none')\n\ \ | list }}\n" avg_clouds: "{% if clouds | length > 0 %}\n {{ (clouds | map('float') | sum\ \ / clouds | length) | round(1) }}\n{% else %}\n 0\n{% endif %}\n" - data: entity_id: input_number.average_cloud_cover_piscina value: '{{ avg_clouds }}' action: input_number.set_value else: - target: entity_id: weather.forecast data: type: hourly response_variable: forecast action: weather.get_forecasts - variables: entries: '{{ forecast[''weather.forecast''][''forecast''] }} ' start: '{{ (utcnow() + timedelta(days=1)).replace(hour=10, minute=0, second=0, microsecond=0).isoformat(sep=''T'') }} ' end: '{{ (utcnow() + timedelta(days=1)).replace(hour=18, minute=0, second=0, microsecond=0).isoformat(sep=''T'') }} ' clouds: "{{ entries\n | selectattr('datetime', '>=', start)\n | selectattr('datetime',\ \ '<=', end)\n | map(attribute='cloud_coverage')\n | reject('none')\n\ \ | list }}\n" avg_clouds: "{% if clouds | length > 0 %}\n {{ (clouds | map('float') | sum\ \ / clouds | length) | round(1) }}\n{% else %}\n 0\n{% endif %}\n" - data: entity_id: input_number.average_cloud_cover_piscina value: '{{ avg_clouds }}' action: input_number.set_value mode: single - id: '1747216234443' alias: 🏊🏻 Actualizar Horario Bomba Piscina Noite description: '' triggers: - trigger: time_pattern minutes: /30 hours: /1 - trigger: state entity_id: - sensor.bomba_piscina_noite_horario conditions: - condition: time after: '13:00:00' before: '21:00:00' actions: - action: input_datetime.set_datetime metadata: {} data: datetime: "{% set horario = states('sensor.bomba_piscina_noite_horario') %}\n\ {% if horario not in ['unknown', 'unavailable', '', None] %}\n {{ as_datetime(horario).astimezone().isoformat()\ \ }}\n{% else %}\n {{ (now() + timedelta(days=1)).replace(hour=2, minute=0,\ \ second=0, microsecond=0).isoformat() }}\n{% endif %}" target: entity_id: input_datetime.horario_piscina_noite mode: single - id: '1747335289002' alias: 🏊🏻Bomba Peristaltica description: '' triggers: - trigger: state entity_id: - switch.bomba_piscina_switch_0 - trigger: time_pattern minutes: /5 conditions: - condition: device type: is_on device_id: e5f1b9b1d10308b32ef8f69bc0d20d74 entity_id: 43f5cd2f7257fed3e55788df58ce96de domain: switch actions: - if: - condition: device type: is_on device_id: e5f1b9b1d10308b32ef8f69bc0d20d74 entity_id: 43f5cd2f7257fed3e55788df58ce96de domain: switch - condition: numeric_state entity_id: sensor.ph_corrigido_filtrado above: 7.5 then: - action: switch.turn_on metadata: {} data: {} target: entity_id: - switch.bomba_peristaltica_switch_0 else: - action: switch.turn_off metadata: {} data: {} target: entity_id: - switch.bomba_peristaltica_switch_0 mode: single - id: '1748274888683' alias: 🪟Abrir Estore 1 description: '' triggers: - device_id: d686deeba13232cfa6ab008fa8c80dc0 domain: bthome type: button_3 subtype: press trigger: device conditions: [] actions: - if: - condition: or conditions: - condition: device device_id: cfd18037256cb019fa29781e93e644d7 domain: cover entity_id: 8749320a26b0fe2753d119e46c5cba27 type: is_opening - condition: device device_id: cfd18037256cb019fa29781e93e644d7 domain: cover entity_id: 8749320a26b0fe2753d119e46c5cba27 type: is_closing then: - action: cover.stop_cover metadata: {} data: {} target: entity_id: cover.estore1_cover_0 else: - action: cover.open_cover metadata: {} data: {} target: entity_id: cover.estore1_cover_0 mode: single - id: '1748276682652' alias: 🪟Fechar Estore 1 description: '' triggers: - device_id: d686deeba13232cfa6ab008fa8c80dc0 domain: bthome type: button_4 subtype: press trigger: device conditions: [] actions: - if: - condition: or conditions: - condition: device device_id: cfd18037256cb019fa29781e93e644d7 domain: cover entity_id: 8749320a26b0fe2753d119e46c5cba27 type: is_opening - condition: device device_id: cfd18037256cb019fa29781e93e644d7 domain: cover entity_id: 8749320a26b0fe2753d119e46c5cba27 type: is_closing then: - action: cover.stop_cover metadata: {} data: {} target: entity_id: cover.estore1_cover_0 else: - action: cover.close_cover metadata: {} data: {} target: entity_id: cover.estore1_cover_0 mode: single - id: ev_gate_sem_starvation alias: 🚗 EV (cFos) — Só depois da bomba + Vazio 22:00–08:00 mode: single trigger: - platform: time at: '22:00:00' - platform: state entity_id: switch.bomba_piscina_switch_0 to: 'on' for: 00:01:00 - platform: numeric_state entity_id: input_number.piscina_filtracao_min_restantes below: 1 - platform: time at: 08:00:00 - platform: state entity_id: switch.bomba_piscina_switch_0 to: 'off' for: 00:00:10 action: - variables: em_vazio: "{{ now().time() >= as_datetime(strptime('22:00:00','%H:%M:%S')).time()\n\ \ or now().time() < as_datetime(strptime('08:00:00','%H:%M:%S')).time()\ \ }}" pump_on: '{{ is_state(''switch.bomba_piscina_switch_0'',''on'') }}' pool_done: '{% set m = states(''input_number.piscina_filtracao_min_restantes'') %} {{ m not in [''unknown'',''unavailable'',''''] and (m|float(0) <= 0) }}' - choose: - conditions: '{{ em_vazio or pump_on or pool_done }}' sequence: - service: switch.turn_on target: entity_id: switch.powerbrain_wallbox_enable_charging - conditions: '{{ (not em_vazio) and (not pump_on) and (not pool_done) }}' sequence: - service: switch.turn_off target: entity_id: switch.powerbrain_wallbox_enable_charging - id: ev_allow_at_22 alias: 🚗 EV (cFos) — Permitir às 22:00 trigger: - platform: time at: '22:00:00' action: - service: switch.turn_on target: entity_id: switch.wallbox_charging_enabled - id: ev_reapply_gate_at_08 alias: 🚗 EV (cFos) — Reaplicar gate às 08:00 trigger: - platform: time at: 08:00:00 action: - if: - condition: template value_template: '{% set pump_on = is_state(''switch.bomba_piscina_switch_0'',''on'') %} {% set m = states(''input_number.piscina_filtracao_min_restantes'') %} {% set pool_done = (m not in [''unknown'',''unavailable'',''''] and (m|float(0) <= 0)) %} {{ not (pump_on or pool_done) }}' then: - service: switch.turn_off target: entity_id: switch.wallbox_charging_enabled - id: piscina_cloro_tpo_seconds alias: Piscina - Cloração TPO por Cobertura (segundos) trigger: - platform: time_pattern seconds: /30 variables: janela_min: '{{ states(''input_number.piscina_cloro_janela_min'') | int(10) }}' janela_s: '{{ janela_min * 60 }}' pct_aberta: '{{ states(''input_number.piscina_pct_cobertura_aberta'') | float(100) }}' pct_fechada: '{{ states(''input_number.piscina_pct_cobertura_fechada'') | float(30) }}' pct: "{{ pct_fechada if is_state('input_boolean.piscina_cobertura_fechada','on')\n\ \ else pct_aberta }}" on_s: '{{ (pct/100 * janela_s) | int }}' ciclo_s: '{{ (now().timestamp() | int) % janela_s }}' condition: - condition: state entity_id: input_boolean.piscina_cloro_tpo_enable state: 'on' - condition: state entity_id: switch.bomba_piscina_switch_0 state: 'on' action: - choose: - conditions: '{{ pct >= 99 }}' sequence: - service: switch.turn_on target: entity_id: switch.piscina_cloro_permitir_producao - conditions: '{{ pct <= 1 }}' sequence: - service: switch.turn_off target: entity_id: switch.piscina_cloro_permitir_producao - conditions: '{{ ciclo_s < on_s }}' sequence: - service: switch.turn_on target: entity_id: switch.piscina_cloro_permitir_producao - conditions: [] sequence: - service: switch.turn_off target: entity_id: switch.piscina_cloro_permitir_producao mode: single - id: piscina_cloro_tpo_failsafe alias: Piscina - Cloração TPO (failsafe OFF) trigger: - platform: state entity_id: switch.bomba_piscina_switch_0 - platform: state entity_id: input_boolean.piscina_cloro_tpo_enable - platform: state entity_id: input_boolean.piscina_cobertura_fechada action: - choose: - conditions: - condition: or conditions: - condition: state entity_id: switch.bomba_piscina_switch_0 state: 'off' - condition: state entity_id: input_boolean.piscina_cloro_tpo_enable state: 'off' sequence: - service: switch.turn_off target: entity_id: switch.piscina_cloro_permitir_producao mode: restart - id: piscina_vazio_start alias: 🏊🏻 Piscina - Início vazio 22:00 trigger: - platform: time at: '22:00:00' condition: - condition: state entity_id: input_boolean.piscina_override_manual state: 'off' - condition: numeric_state entity_id: input_number.piscina_filtracao_min_restantes above: 0 action: - service: switch.turn_on target: entity_id: switch.bomba_piscina_switch_0 - id: piscina_vazio_stop_por_objetivo alias: 🏊🏻 Piscina - Paragem no vazio quando completar trigger: - platform: numeric_state entity_id: input_number.piscina_filtracao_min_restantes below: 1 condition: - condition: state entity_id: input_boolean.piscina_override_manual state: 'off' - condition: time after: '22:00:00' before: 08:00:00 action: - service: switch.turn_off target: entity_id: switch.bomba_piscina_switch_0 - id: piscina_vazio_stop_08 alias: 🏊🏻 Piscina - Paragem às 08:00 trigger: - platform: time at: 08:00:00 condition: - condition: state entity_id: input_boolean.piscina_override_manual state: 'off' action: - service: switch.turn_off target: entity_id: switch.bomba_piscina_switch_0 - id: piscina_reset_diario_minutos alias: 🏊🏻 Piscina - Reset diário minutos (08:00:05) trigger: - platform: time at: 08:00:06 action: - service: input_number.set_value target: entity_id: input_number.piscina_filtracao_min_restantes data: value: '{{ states(''sensor.piscina_minutos_recomendados'') | int(480) }}' - id: piscina_arranque_solar alias: 🏊🏻 Piscina - Arranque com excedente FV trigger: - platform: state entity_id: binary_sensor.piscina_excedente_fv_bomba to: 'on' for: 00:05:00 condition: - condition: state entity_id: input_boolean.piscina_override_manual state: 'off' - condition: numeric_state entity_id: input_number.piscina_filtracao_min_restantes above: 0 - condition: sun after: sunrise after_offset: 00:15:00 before: sunset before_offset: -00:15:00 action: - service: switch.turn_on target: entity_id: switch.bomba_piscina_switch_0 - id: piscina_paragem_solar alias: 🏊🏻 Piscina - Paragem quando não há excedente ou objetivo cumprido trigger: - platform: state entity_id: binary_sensor.piscina_excedente_fv_bomba to: 'off' for: 00:05:00 - platform: numeric_state entity_id: input_number.piscina_filtracao_min_restantes below: 1 - platform: sun event: sunset offset: -00:10:00 condition: - condition: state entity_id: input_boolean.piscina_override_manual state: 'off' action: - service: switch.turn_off target: entity_id: switch.bomba_piscina_switch_0 - id: piscina_arranque_solar_watchdog alias: 🏊🏻 Piscina - Watchdog arranque FV (*/2min) trigger: - platform: time_pattern minutes: /2 condition: - condition: state entity_id: input_boolean.piscina_override_manual state: 'off' - condition: state entity_id: switch.bomba_piscina_switch_0 state: 'off' - condition: numeric_state entity_id: input_number.piscina_filtracao_min_restantes above: 0 - condition: state entity_id: binary_sensor.piscina_excedente_fv_bomba state: 'on' - condition: sun after: sunrise after_offset: 00:15:00 before: sunset before_offset: -00:15:00 action: - service: switch.turn_on target: entity_id: switch.bomba_piscina_switch_0 - id: piscina_manual_finished alias: 🏊🏻 Piscina - Manual terminou (voltar ao automático) mode: single trigger: - platform: event event_type: timer.finished event_data: entity_id: timer.piscina_manual - platform: state entity_id: timer.piscina_manual from: active to: idle action: - service: switch.turn_off target: entity_id: switch.bomba_piscina_switch_0 - service: input_boolean.turn_off target: entity_id: input_boolean.piscina_override_manual - id: piscina_manual_watchdog alias: 🏊🏻 Piscina - Watchdog manual (*/1min) trigger: - platform: time_pattern minutes: /1 condition: - condition: state entity_id: input_boolean.piscina_override_manual state: 'on' - condition: not conditions: - condition: state entity_id: timer.piscina_manual state: active action: - service: switch.turn_off target: entity_id: switch.bomba_piscina_switch_0 - service: input_boolean.turn_off target: entity_id: input_boolean.piscina_override_manual - id: piscina_sync_restantes_recomendado_menos_corridos alias: 🏊🏻 Piscina - Restantes = Recomendado − Corridos (auto) trigger: - platform: state entity_id: - sensor.piscina_minutos_recomendados - sensor.piscina_minutos_on_08_08 - timer.piscina_manual - platform: homeassistant event: start - platform: time at: 08:00:05 condition: - condition: state entity_id: input_boolean.piscina_override_manual state: 'off' action: - variables: recomendado: '{{ states(''sensor.piscina_minutos_recomendados'') | int(0) }}' corridos: '{{ states(''sensor.piscina_minutos_on_08_08'') | int(0) }}' novos: '{{ [recomendado - corridos, 0] | max }}' - service: input_number.set_value target: entity_id: input_number.piscina_filtracao_min_restantes data: value: '{{ [novos, 1440] | min }}' - id: Sincronizar_bomba_piscina_com_bomba_peristaltica alias: 🏊🏻 Piscina - Sincronizar bomba piscina com bomba peristaltica description: Liga/Desliga o bomba piscina sempre que a bomba piscina mudar de estado mode: restart trigger: - platform: state entity_id: switch.bomba_piscina_switch_0 action: - service: switch.turn_{{ trigger.to_state.state }} target: entity_id: switch.bomba_peristaltica_switch_0