diff --git a/esphome/common/api_common.yaml b/esphome/common/api_common.yaml index 30f6ff6..26ba038 100644 --- a/esphome/common/api_common.yaml +++ b/esphome/common/api_common.yaml @@ -5,4 +5,5 @@ api: encryption: key: ${local_api_key} + reboot_timeout: 0s # disables watchdog reboot on API failure diff --git a/esphome/common/mqtt_common.yaml b/esphome/common/mqtt_common.yaml index 097a941..43994a9 100644 --- a/esphome/common/mqtt_common.yaml +++ b/esphome/common/mqtt_common.yaml @@ -20,3 +20,4 @@ mqtt: discovery: False # enable entity discovery (true is default) discover_ip: False # enable device discovery (true is default) id: mqtt_client + reboot_timeout: 0s # same for MQTT diff --git a/esphome/esp-poollightpower.yaml b/esphome/esp-poollightpower.yaml index 2e80269..1a96da6 100644 --- a/esphome/esp-poollightpower.yaml +++ b/esphome/esp-poollightpower.yaml @@ -497,8 +497,18 @@ binary_sensor: # https://esphome.io/components/text_sensor/index.html ########################################################################################## sensor: + - platform: template + name: "Boost Duration" + id: boost_duration_time + unit_of_measurement: "mins" + accuracy_decimals: "0" + update_interval: "${update_interval}" + lambda: |- + return id(boost_duration); + - platform: template name: "Mins from Midnight" + id: mins_from_midnight unit_of_measurement: "mins" accuracy_decimals: "0" update_interval: "${update_interval}" diff --git a/esphome/esp-poolpumppower.yaml b/esphome/esp-poolpumppower.yaml index 785b272..9ae7a9f 100644 --- a/esphome/esp-poolpumppower.yaml +++ b/esphome/esp-poolpumppower.yaml @@ -506,11 +506,21 @@ binary_sensor: ########################################################################################## sensor: - platform: template - name: "Mins from Midnight" + name: "Boost Duration" + id: boost_duration_time unit_of_measurement: "mins" - accuracy_decimals: 0 + accuracy_decimals: "0" update_interval: "${update_interval}" - internal: True # No need to show this in Home Assistanti + lambda: |- + return id(boost_duration); + + - platform: template + name: "Mins from Midnight" + id: mins_from_midnight + unit_of_measurement: "mins" + accuracy_decimals: "0" + update_interval: "${update_interval}" + internal: True # No need to show this in Home Assistant lambda: |- return id(current_mins); diff --git a/packages/pool_controls.yaml b/packages/pool_controls.yaml index 651d8a5..aeb2610 100644 --- a/packages/pool_controls.yaml +++ b/packages/pool_controls.yaml @@ -1,11 +1,3 @@ -sensor: - - platform: integration - unique_id: pool_pump_power_total - name: "Pool pump power total" - source: sensor.tasmo_athplug_5853_3_poolpump_energy_power - unit_prefix: k - #round: 2 - input_select: pool_light_colour_select: icon: mdi:swimming-pool diff --git a/packages/pool_light_boost_switch.yaml b/packages/pool_light_boost_switch.yaml new file mode 100644 index 0000000..bd4a5f2 --- /dev/null +++ b/packages/pool_light_boost_switch.yaml @@ -0,0 +1,95 @@ +# packages/poollight_operation.yaml + +homeassistant: + customize: + input_boolean.poollight_mode_switch: + icon: mdi:spotlight + +input_boolean: + poollight_mode_switch: + name: "Pool Light Operation" + initial: false + + timer_light_midnight_pending: + name: "Send TIMER at Midnight" + initial: false + +automation: + - alias: "Pool Light → send BOOST when user turns UI switch ON" + trigger: + platform: state + entity_id: input_boolean.poollight_mode_switch + to: "on" + condition: + condition: state + entity_id: switch.esp_poollightpower_power_output + state: "off" + action: + - service: mqtt.publish + data: + topic: "viewroad-commands/poollight-timer/operation" + payload: "BOOST" + + - alias: "Pool Light → send OFF & schedule TIMER when user turns UI switch OFF" + trigger: + platform: state + entity_id: input_boolean.poollight_mode_switch + to: "off" + condition: + condition: state + entity_id: switch.esp_poollightpower_power_output + state: "on" + action: + - service: mqtt.publish + data: + topic: "viewroad-commands/poollight-timer/operation" + payload: "OFF" + - service: input_boolean.turn_on + data: + entity_id: input_boolean.timer_light_midnight_pending + + - alias: "Pool Light → send TIMER at midnight" + trigger: + platform: time + at: "00:00:00" + condition: + condition: state + entity_id: input_boolean.timer_light_midnight_pending + state: "on" + action: + - service: mqtt.publish + data: + topic: "viewroad-commands/poollight-timer/operation" + payload: "TIMER" + - service: input_boolean.turn_off + data: + entity_id: input_boolean.timer_light_midnight_pending + + - alias: "Pool Light → sync UI switch with real output (no MQTT)" + trigger: + platform: state + entity_id: switch.esp_poollightpower_power_output + action: + - choose: + - conditions: + - condition: state + entity_id: switch.esp_poollightpower_power_output + state: "on" + sequence: + - service: input_boolean.turn_on + data: + entity_id: input_boolean.poollight_mode_switch + - service: input_boolean.turn_off + data: + entity_id: input_boolean.timer_light_midnight_pending + - conditions: + - condition: state + entity_id: switch.esp_poollightpower_power_output + state: "off" + sequence: + - service: input_boolean.turn_off + data: + entity_id: input_boolean.poollight_mode_switch + - service: input_boolean.turn_on + data: + entity_id: input_boolean.timer_light_midnight_pending diff --git a/packages/pool_pump_boost_switch.yaml b/packages/pool_pump_boost_switch.yaml new file mode 100644 index 0000000..ba1631e --- /dev/null +++ b/packages/pool_pump_boost_switch.yaml @@ -0,0 +1,95 @@ +# packages/poolpump_operation.yaml + +homeassistant: + customize: + input_boolean.poolpump_mode_switch: + icon: mdi:pump + +input_boolean: + poolpump_mode_switch: + name: "Pool Pump Operation" + initial: false + + timer_midnight_pending: + name: "Send TIMER at Midnight" + initial: false + +automation: + - alias: "Pool Pump → send BOOST when user turns UI switch ON" + trigger: + platform: state + entity_id: input_boolean.poolpump_mode_switch + to: "on" + condition: + condition: state + entity_id: switch.esp_poolpumppower_power_output + state: "off" + action: + - service: mqtt.publish + data: + topic: "viewroad-commands/poolpump-timer/operation" + payload: "BOOST" + + - alias: "Pool Pump → send OFF & schedule TIMER when user turns UI switch OFF" + trigger: + platform: state + entity_id: input_boolean.poolpump_mode_switch + to: "off" + condition: + condition: state + entity_id: switch.esp_poolpumppower_power_output + state: "on" + action: + - service: mqtt.publish + data: + topic: "viewroad-commands/poolpump-timer/operation" + payload: "OFF" + - service: input_boolean.turn_on + data: + entity_id: input_boolean.timer_midnight_pending + + - alias: "Pool Pump → send TIMER at midnight" + trigger: + platform: time + at: "00:00:00" + condition: + condition: state + entity_id: input_boolean.timer_midnight_pending + state: "on" + action: + - service: mqtt.publish + data: + topic: "viewroad-commands/poolpump-timer/operation" + payload: "TIMER" + - service: input_boolean.turn_off + data: + entity_id: input_boolean.timer_midnight_pending + + - alias: "Pool Pump → sync UI switch with real output (no MQTT)" + trigger: + platform: state + entity_id: switch.esp_poolpumppower_power_output + action: + - choose: + - conditions: + - condition: state + entity_id: switch.esp_poolpumppower_power_output + state: "on" + sequence: + - service: input_boolean.turn_on + data: + entity_id: input_boolean.poolpump_mode_switch + - service: input_boolean.turn_off + data: + entity_id: input_boolean.timer_midnight_pending + - conditions: + - condition: state + entity_id: switch.esp_poolpumppower_power_output + state: "off" + sequence: + - service: input_boolean.turn_off + data: + entity_id: input_boolean.poolpump_mode_switch + - service: input_boolean.turn_on + data: + entity_id: input_boolean.timer_midnight_pending