# Worx Landroid (M500 WR141E) package # https://github.com/Barma-lej/halandroid # Based on Landroid Cloud by @MTrab # https://github.com/MTrab/landroid_cloud # Recorder ########################################################## recorder: exclude: entities: # Swithes ############### #- swith.mower_mowing #- swith.mower_home #- swith.mower_edgecut #- swith.mower_partymode #- swith.mower_lock # Sensors ############### - sensor.mower_ip #- sensor.mower_bladetime #- sensor.mower_current bladetime #- sensor.mower_totaltime #- sensor.mower_distance #- sensor.mower_lastupdate #- sensor.mower_wifi #- sensor.mower_yaw #- sensor.mower_roll #- sensor.mower_pitch # Input selects ######### - input_select.mower_zone # Input numbers ######### - input_number.mower_raindelay - input_number.mower_timeextension - input_number.mower_zone0_distance - input_number.mower_zone1_distance - input_number.mower_zone2_distance - input_number.mower_zone3_distance - input_number.mower_zone0_probability - input_number.mower_zone1_probability - input_number.mower_zone2_probability - input_number.mower_zone3_probability # Input booleans ######## - input_boolean.mower_sched_settings - input_boolean.mower_info_toggle - input_boolean.mower_zone_enable - input_boolean.mower_view_config - input_boolean.mower_view_setzones # Automations ###### - automation.mower_notify_status - automation.mower_notify_error - automation.mower_sync_values - automation.mower_views_switch # Scripts ########## - script.mower_set_config - script.mower_setzone - script.mower_setzones - script.mower_views_toggle # Logbook ########################################################### logbook: exclude: entities: # Swithes ############### #- swith.mower_mowing #- swith.mower_home #- swith.mower_edgecut #- swith.mower_partymode #- swith.mower_lock # Sensors ############### - sensor.mower_ip #- sensor.mower_bladetime #- sensor.mower_current bladetime #- sensor.mower_totaltime #- sensor.mower_distance #- sensor.mower_lastupdate #- sensor.mower_wifi #- sensor.mower_yaw #- sensor.mower_roll #- sensor.mower_pitch # Input selects ######### - input_select.mower_zone # Input numbers ######### - input_number.mower_raindelay - input_number.mower_timeextension - input_number.mower_zone0_distance - input_number.mower_zone1_distance - input_number.mower_zone2_distance - input_number.mower_zone3_distance - input_number.mower_zone0_probability - input_number.mower_zone1_probability - input_number.mower_zone2_probability - input_number.mower_zone3_probability # Input booleans ######## - input_boolean.mower_sched_settings - input_boolean.mower_info_toggle - input_boolean.mower_zone_enable - input_boolean.mower_view_config - input_boolean.mower_view_setzones # Automations ###### - automation.mower_notify_status - automation.mower_notify_error - automation.mower_sync_values - automation.mower_views_switch # Scripts ########## - script.mower_set_config - script.mower_setzone - script.mower_setzones - script.mower_views_toggle # Switch ############################################################ switch: - platform: template switches: mower_mowing: unique_id: mower_mowing value_template: >- {{ is_state('vacuum.mower', 'mowing') or is_state('vacuum.mower', 'starting') or is_state('vacuum.mower', 'zoning') or is_state('vacuum.mower', 'edgecut') or is_state('vacuum.mower', 'initializing') }} turn_on: service: vacuum.start target: entity_id: vacuum.mower turn_off: service: vacuum.pause target: entity_id: vacuum.mower icon_template: >- {% if is_state('vacuum.mower', 'mowing') or is_state('vacuum.mower', 'starting') or is_state('vacuum.mower', 'zoning') or is_state('vacuum.mower', 'edgecut') or is_state('vacuum.mower', 'initializing') %} mdi:pause {% else %} mdi:play {% endif %} mower_home: unique_id: mower_home value_template: >- {{ is_state('vacuum.mower', 'returning') }} turn_on: service: vacuum.return_to_base target: entity_id: vacuum.mower turn_off: service: vacuum.pause target: entity_id: vacuum.mower icon_template: >- {% if is_state('vacuum.mower', 'docked') %} mdi:home-lightning-bolt {% else %} mdi:home-import-outline {% endif %} mower_edgecut: unique_id: mower_edgecut value_template: "{{ is_state('vacuum.mower', 'edgecut') }}" turn_on: service: landroid_cloud.edgecut target: entity_id: vacuum.mower turn_off: service: vacuum.pause target: entity_id: vacuum.mower icon_template: >- {% if is_state('vacuum.mower', 'edgecut') %} mdi:motion-pause {% else %} mdi:motion-play {% endif %} mower_partymode: unique_id: mower_partymode value_template: "{{ is_state_attr('vacuum.mower', 'partymode_enabled', true) }}" turn_on: service: landroid_cloud.partymode target: entity_id: vacuum.mower turn_off: service: landroid_cloud.partymode target: entity_id: vacuum.mower icon_template: >- {% if is_state_attr('vacuum.mower', 'partymode_enabled', true) %} mdi:sleep-off {% else %} mdi:sleep {% endif %} mower_lock: unique_id: mower_lock value_template: "{{ is_state_attr('vacuum.mower', 'locked', true) }}" turn_on: service: landroid_cloud.lock target: entity_id: vacuum.mower turn_off: service: landroid_cloud.lock target: entity_id: vacuum.mower icon_template: >- {% if is_state_attr('vacuum.mower', 'locked', true) %} mdi:lock {% else %} mdi:lock-open-variant {% endif %} # Sensor ############################################################ template: - sensor: # Info ############ - name: Mower IP unique_id: mower_ip state: !secret mower_ip icon: mdi:ip-network # States #################### - name: "mower_battery" unique_id: mower_battery state: "{{ state_attr('vacuum.mower','battery_level') | int(0) }}" device_class: battery unit_of_measurement: "%" - name: Mower bladetime unique_id: mower_bladetime state: "{{ state_attr('vacuum.mower', 'total_blade_time') }}" icon: mdi:fan unit_of_measurement: "min" attributes: time_formatted: > {% set t = state_attr("vacuum.mower", "total_blade_time") | int(0) %} {% if t != 0 %} {{ "%0d Tg. %0.02d Std. %0.02d Min." | format(t // 1440, ((t % 1440) // 60), t % 60) }} {%- else -%} {{ '0 min' }} {% endif %} - name: Mower current bladetime unique_id: mower_current_bladetime state: "{{ state_attr('vacuum.mower', 'current_blade_time') }}" icon: mdi:fan unit_of_measurement: "min" attributes: time_formatted: > {% set t = state_attr("vacuum.mower", "current_blade_time") | int(0) %} {% if t != 0 %} {{ "%0d Tg. %0.02d Std. %0.02d Min." | format(t // 1440, ((t % 1440) // 60), t % 60) }} {%- else -%} {{ '0 min' }} {% endif %} - name: Mower totaltime unique_id: mower_totaltime state: "{{ state_attr('vacuum.mower', 'work_time') }}" icon: mdi:bus-clock unit_of_measurement: "min" attributes: time_formatted: > {% set t = state_attr("vacuum.mower", "work_time") | int(0) %} {% if t != 0 %} {{ "%0d Tg. %0.02d Std. %0.02d Min." | format(t // 1440, ((t % 1440) // 60), t % 60) }} {%- else -%} {{ '0 min' }} {% endif %} - name: Mower distance unique_id: mower_distance state: "{{ (state_attr('vacuum.mower', 'distance') | float(0) ) / 1000 }}" icon: mdi:map-marker-distance unit_of_measurement: "km" - name: Mower lastupdate unique_id: mower_lastupdate state: "{{ as_timestamp( strptime( state_attr('vacuum.mower', 'last_update'), '%H:%M:%S %d/%m/%Y', 0), 0) | timestamp_custom('%d.%m.%Y %H:%M:%S') }}" icon: mdi:clock - name: Mower WIFI unique_id: mower_wifi state: "{{ state_attr('vacuum.mower', 'rssi') }}" device_class: signal_strength unit_of_measurement: "dBm" icon: >- {% set strength = state_attr("vacuum.mower", "rssi") | float(0) -%} {%- if strength > -56 -%}mdi:wifi-strength-4 {% elif strength > -67 -%}mdi:wifi-strength-3 {% elif strength > -78 -%}mdi:wifi-strength-2 {% elif strength > -89 -%}mdi:wifi-strength-1 {%- else -%}mdi:wifi-strength-outline {%- endif %} # -55 or higher: 4 bars # -56 to -66: 3 bars # -67 to -77: 2 bars # -78 to -88: 1 bar # -89 or lower: 0 bars - name: Mower yaw unique_id: mower_yaw state: "{{ state_attr('vacuum.mower', 'yaw') }}" icon: mdi:axis-z-rotate-clockwise unit_of_measurement: "°" - name: Mower roll unique_id: mower_roll state: "{{ state_attr('vacuum.mower', 'roll') }}" icon: mdi:axis-x-rotate-clockwise unit_of_measurement: "°" - name: Mower pitch unique_id: mower_pitch state: "{{ state_attr('vacuum.mower', 'pitch') }}" icon: mdi:seat-flat-angled unit_of_measurement: "°" # Input Select ###################################################### input_select: mower_zone: name: Mower zone initial: "0" options: - "0" - "1" - "2" - "3" icon: mdi:vector-difference # Input Number ###################################################### input_number: mower_raindelay: name: Rain delay initial: 150 min: 0 max: 1410 step: 30 unit_of_measurement: "min" icon: mdi:weather-lightning-rainy mower_timeextension: name: Time extension initial: 0 min: -100 max: 100 step: 10 unit_of_measurement: "%" icon: mdi:clock-out # Multizone mower_zone0_distance: name: "Zone 0: Distance" initial: 0 min: 0 max: 350 step: 1 unit_of_measurement: "m" icon: mdi:numeric-0-box-outline mower_zone1_distance: name: "Zone 1: Distance" initial: 0 min: 0 max: 350 step: 1 unit_of_measurement: "m" icon: mdi:numeric-1-box-outline mower_zone2_distance: name: "Zone 2: Distance" initial: 0 min: 0 max: 350 step: 1 unit_of_measurement: "m" icon: mdi:numeric-2-box-outline mower_zone3_distance: name: "Zone 3: Distance" initial: 0 min: 0 max: 350 step: 1 unit_of_measurement: "m" icon: mdi:numeric-3-box-outline mower_zone0_probability: name: "Zone 0: Probability" initial: 0 min: 0 max: 100 step: 10 unit_of_measurement: "%" icon: mdi:numeric-0-circle-outline mower_zone1_probability: name: "Zone 1: Probability" initial: 0 min: 0 max: 100 step: 10 unit_of_measurement: "%" icon: mdi:numeric-1-circle-outline mower_zone2_probability: name: "Zone 2: Probability" initial: 0 min: 0 max: 100 step: 10 unit_of_measurement: "%" icon: mdi:numeric-2-circle-outline mower_zone3_probability: name: "Zone 3: Probability" initial: 0 min: 0 max: 100 step: 10 unit_of_measurement: "%" icon: mdi:numeric-3-circle-outline # Input Boolean ##################################################### input_boolean: # Booleans for Lovelace mower_sched_settings: name: Scheduler settings initial: false icon: mdi:timer mower_info_toggle: name: Info toggle initial: false icon: mdi:information mower_zone_enable: name: Enable multizone initial: false icon: mdi:vector-difference # Booleans for views in Lovelace mower_view_config: name: Configuration icon: mdi:tools mower_view_setzones: name: Multizone icon: mdi:vector-difference # Automations ####################################################### automation: - id: mower_notify_status alias: Mower Notify Status initial_state: false trigger: - platform: state entity_id: vacuum.mower condition: - condition: template value_template: "{{ trigger.to_state.state != trigger.from_state.state }}" action: - service: persistent_notification.create data: title: 🏎️ Landroid M500 message: "{{ trigger.from_state.state }} -> {{ trigger.to_state.state }} - {{ now().strftime('%Y-%m-%d, %H:%M') }}" - id: mower_notify_error alias: Mower Notify Error initial_state: true trigger: - platform: state entity_id: vacuum.mower attribute: error condition: - condition: template value_template: "{{ trigger.to_state.state != trigger.from_state.state }}" action: - service: persistent_notification.create data: title: 🏎️ Landroid M500 message: "{{ trigger.from_state.state }} -> {{ trigger.to_state.state }} - {{ now().strftime('%Y-%m-%d, %H:%M') }}" - id: mower_sync_values alias: Mower sync values initial_state: false trigger: - platform: homeassistant event: start - platform: state entity_id: sensor.mower_lastupdate action: # Get rain delay - service: input_number.set_value target: entity_id: input_number.mower_raindelay data: value: "{{ state_attr('vacuum.mower','raindelay') | int(0) }}" # Get time extension - service: input_number.set_value target: entity_id: input_number.mower_timeextension data: value: "{{ state_attr('vacuum.mower','timeextension') | int(0) }}" # Get mower zone - service: input_select.select_option target: entity_id: input_select.mower_zone data: option: "{{ state_attr('vacuum.mower','mowing_zone') }}" # Scripts ########################################################### # Services # landroid_cloud.configure landroid_cloud.config (can be used to set rain delay and time extension) # landroid_cloud.partymode (if a partymode capable device was found) # landroid_cloud.setzone # landroid_cloud.lock # landroid_cloud.restart # landroid_cloud.edgecut (only for models with the function available in the app) script: mower_set_config: alias: Mower set rain delay and time extension sequence: service: landroid_cloud.config target: entity_id: vacuum.mower data: raindelay: "{{ states('input_number.mower_raindelay') | int(0) }}" timeextension: "{{ states('input_number.mower_timeextension') | int(0) }}" mower_setzone: alias: Mower set mowing zone mode: restart sequence: - service: input_select.select_next target: entity_id: input_select.mower_zone - delay: "00:00:03" - service: landroid_cloud.setzone target: entity_id: vacuum.mower data: zone: "{{ states('input_select.mower_zone') | int(0) }}" mower_setzones: alias: Mower set multizone distances sequence: service: landroid_cloud.config target: entity_id: vacuum.mower data: multizone_distances: >- {% if is_state('input_boolean.mower_zone_enable', 'on') -%} [{{ states('input_number.mower_zone0_distance') | int(0) }}, {{ states('input_number.mower_zone1_distance') | int(0) }}, {{ states('input_number.mower_zone2_distance') | int(0) }}, {{ states('input_number.mower_zone3_distance') | int(0) }}] {%- else -%} [0,0,0,0] {%- endif %} multizone_probabilities: >- {% if is_state('input_boolean.mower_zone_enable', 'on') -%} [{{ ((states('input_number.mower_zone0_probability') | int(0)) / 10) | round(0) }}, {{ ((states('input_number.mower_zone1_probability') | int(0)) / 10) | round(0) }}, {{ ((states('input_number.mower_zone2_probability') | int(0)) / 10) | round(0) }}, {{ ((states('input_number.mower_zone3_probability') | int(0)) / 10) | round(0) }}] {%- else -%} [0,0,0,0] {%- endif %} mower_views_toggle: description: "View configuration panel like tabs" mode: restart fields: entity_id: description: "Current switch" example: "input_boolean.mower_view_config" sequence: - service: input_boolean.turn_off data: entity_id: > {% for item in states["input_boolean"] if item.object_id.startswith("mower_view_") and item.entity_id != entity_id -%} {% if not loop.first %},{% endif %}{{ item.entity_id }} {%- endfor %} - service: input_boolean.turn_on data: entity_id: "{{ entity_id }}"