Barma-lej / halandroid

Worx Landroid package for Home Assistant based on Landroid Cloud by @MTrab
MIT License
112 stars 49 forks source link

Landroid Cloud Version updated with new functions. #31

Closed a-jey closed 2 years ago

a-jey commented 2 years ago

https://github.com/MTrab/landroid_cloud/releases/tag/v1.8.0

Any chance to get the new functions and services integrated? Thanks in advance.

fanningert commented 2 years ago

Here the modified yaml of Barma-lej and the lovelace yaml (sorry only the German version). Installation like https://github.com/Barma-lej/halandroid describe. Tested with MTrab version 1.8.0

lovelace.yaml

```yaml type: custom:stack-in-card mode: vertical cards: - type: vertical-stack cards: - type: picture-elements image: /local/mower/landroid_flower.png elements: - type: state-icon title: WLAN Qualität entity: sensor.mower1_wifi style: top: 0% left: 0% transform: none '--paper-item-icon-color': rgb(3, 169, 244) - type: state-label title: WLAN Qualität entity: sensor.mower1_wifi style: top: 1% left: 9% transform: none font-weight: bold color: rgb(3, 169, 244) - type: state-icon title: Akku Status entity: sensor.landroid_poolbereich_battery style: top: 0% right: 0% transform: none '--paper-item-icon-color': rgb(3, 169, 244) - type: state-label title: Akkuladung entity: sensor.landroid_poolbereich_battery style: top: 1% right: 8% transform: none font-weight: bold color: rgb(3, 169, 244) - type: state-label title: Status entity: sensor.landroid_poolbereich_status style: top: 7% left: 0% transform: none font-size: 150% font-weight: bold color: rgb(3, 169, 244) - type: state-label title: Status entity: sensor.landroid_poolbereich_error style: top: 13% left: 0% transform: none font-size: 150% font-weight: bold color: rgb(3, 169, 244) - type: state-icon title: Nicken entity: sensor.mower1_pitch style: top: 9% right: 0% transform: none '--paper-item-icon-color': rgb(3, 169, 244) - type: state-label title: Nicken entity: sensor.mower1_pitch style: top: 10% right: 8% transform: none font-weight: bold color: rgb(3, 169, 244) - type: state-icon title: Rollen entity: sensor.mower1_roll style: top: 18% right: 0% transform: none '--paper-item-icon-color': rgb(3, 169, 244) - type: state-label title: Rollen entity: sensor.mower1_roll style: top: 19% right: 8% transform: none font-weight: bold color: rgb(3, 169, 244) - type: state-icon title: Gieren entity: sensor.mower1_yaw style: top: 26% right: 0% transform: none '--paper-item-icon-color': rgb(3, 169, 244) - type: state-label title: Gieren entity: sensor.mower1_yaw style: top: 27% right: 8% transform: none font-weight: bold color: rgb(3, 169, 244) - type: state-icon title: Partymodus entity: sensor.mower1_partymode style: top: 34% right: 0% transform: none '--paper-item-icon-color': rgb(3, 169, 244) - type: state-label title: Partymodus entity: sensor.mower1_partymode style: top: 35% right: 8% transform: none font-weight: bold color: rgb(3, 169, 244) - type: state-icon title: Gesperrt entity: sensor.mower1_locked style: top: 42% right: 0% transform: none '--paper-item-icon-color': rgb(3, 169, 244) - type: state-label title: Gesperrt entity: sensor.mower1_locked style: top: 43% right: 8% transform: none font-weight: bold color: rgb(3, 169, 244) - type: state-icon title: Mähzone entity: sensor.mower1_mowing_zone style: top: 50% right: 0% transform: none '--paper-item-icon-color': rgb(3, 169, 244) - type: state-label title: Mähzone entity: sensor.mower1_mowing_zone style: top: 50.5% right: 8% transform: none font-weight: bold color: rgb(3, 169, 244) - type: state-icon title: Gesamte Distanz entity: sensor.mower1_dist style: top: 26% left: 31% transform: none '--paper-item-icon-color': rgb(3, 169, 244) - type: state-label title: Gesamte Distanz entity: sensor.mower1_dist style: top: 27% left: 40% transform: none font-weight: bold color: rgb(3, 169, 244) - type: state-icon title: Gesamte Arbeitszeit entity: sensor.mower1_totaltime style: top: 41% left: 31% transform: none '--paper-item-icon-color': rgb(3, 169, 244) - type: state-label title: Gesamte Arbeitszeit entity: sensor.mower1_totaltime style: top: 40% left: 40% transform: none font-weight: bold color: rgb(3, 169, 244) - type: state-label title: Gesamte Arbeitszeit entity: sensor.mower1_totaltime attribute: time_formatted style: top: 45% left: 40% transform: none font-size: 10px font-style: italic font-weight: bold color: rgb(3, 169, 244) - type: state-icon title: Klingenarbeitszeit entity: sensor.mower1_bladetime style: top: 56% left: 31% transform: none '--paper-item-icon-color': rgb(3, 169, 244) - type: state-label title: Klingenarbeitszeit entity: sensor.mower1_bladetime style: top: 55% left: 40% transform: none font-weight: bold color: rgb(3, 169, 244) - type: state-label title: Klingenarbeitszeit entity: sensor.mower1_bladetime attribute: time_formatted style: top: 60% left: 40% transform: none font-size: 10px font-style: italic font-weight: bold color: rgb(3, 169, 244) - type: image title: Konfiguration entity: input_boolean.mower1_sched_settings image: /local/mower/timer-off.png tap_action: action: toggle state_filter: 'off': brightness(100%) saturate(1) 'on': brightness(90%) saturate(1) state_image: 'on': /local/mower/timer.png style: bottom: 4% left: 45% transform: translate(-280%, 25%) scale(0.7, 0.7) - type: icon title: Mähen icon: mdi:play tap_action: action: call-service service: script.mower1_start style: bottom: 4% left: 41.5% transform: translate(-260%, 0%) scale(1.6, 1.6) color: rgb(250, 250, 250) - type: icon title: Pause icon: mdi:pause tap_action: action: call-service service: script.mower1_pause style: bottom: 4% left: 37% transform: translate(0%, 0%) scale(1.6, 1.6) color: rgb(250, 250, 250) - type: icon title: Stop & Nach Hause fahren icon: mdi:home tap_action: action: call-service service: script.mower1_home style: bottom: 4% left: 33% transform: translate(260%, 0%) scale(1.6, 1.6) color: rgb(250, 250, 250) - type: icon title: Edge cut icon: mdi:robot-mower tap_action: action: call-service service: script.mower1_edgecut style: bottom: 4% left: 45% transform: translate(260%, 0%) scale(1.6, 1.6) color: rgb(250, 250, 250) - type: image title: Information entity: input_boolean.mower1_info_toggle image: /local/mower/info-off.png tap_action: action: toggle state_filter: 'off': brightness(100%) saturate(1) 'on': brightness(90%) saturate(1) state_image: 'on': /local/mower/information.png style: bottom: 4% left: 42% transform: translate(240%, 25%) scale(0.7, 0.7) - type: conditional conditions: - entity: input_boolean.mower1_sched_settings state: 'on' card: type: entities title: Konfiguration show_header_toggle: false entities: - type: custom:paper-buttons-row buttons: - entity: switch.mower1_partymode icon: mdi:party-popper name: Partymodus layout: icon|name - entity: switch.mower1_lock icon: mdi:lock name: Sperren layout: icon|name - type: custom:fold-entity-row head: type: section label: Regenverzögerung entities: - entity: input_number.mower1_raindelay name: Regenverzögerung - entity: input_number.mower1_timeextension name: Daueranpassung - type: custom:fold-entity-row head: type: section label: 'Multizonen: Entfernung' entities: - entity: input_number.mower1_zone1_distance - entity: input_number.mower1_zone2_distance - entity: input_number.mower1_zone3_distance - entity: input_number.mower1_zone4_distance - type: custom:fold-entity-row head: type: section label: 'Multizonen: Wahrscheinlichkeit' entities: - entity: input_number.mower1_zone1_probability - entity: input_number.mower1_zone2_probability - entity: input_number.mower1_zone3_probability - entity: input_number.mower1_zone4_probability - entity: script.mower1_set_config name: Einstellungen speichern - type: custom:fold-entity-row head: type: section label: Nächste Mähzone setzen entities: - entity: input_select.mower1_mower_zone name: Nächste Mähzone - entity: script.mower1_setzone name: Mähzone setzen show_header_toggle: false title: Mähzone setzen - type: conditional conditions: - entity: input_boolean.mower1_info_toggle state: 'on' card: type: entities title: Information show_header_toggle: false entities: - type: custom:fold-entity-row head: sensor.mower1_lastupdate entities: - entity: sensor.mower1_ip - entity: sensor.mower1_sn - entity: sensor.mower1_mac - type: attribute entity: sensor.landroid_poolbereich_status attribute: firmware_version name: Firmware icon: mdi:information-variant - type: section label: Konfiguration - type: attribute attribute: raindelay entity: sensor.landroid_poolbereich_status icon: mdi:weather-lightning-rainy name: Regenverzögerung suffix: min - type: attribute entity: sensor.landroid_poolbereich_status attribute: timeextension name: Daueranpassung suffix: '%' icon: mdi:clock - type: custom:fold-entity-row head: type: section label: Automatisierungen entities: - entity: automation.mower1_notify_error - entity: automation.mower1_notify_status - entity: automation.mower1_sync_values ```

integration.yaml

```yaml # Worx Landroid (M500 WR141E) package # https://github.com/Barma-lej/halandroid # Based on Landroid Cloud by @MTrab # https://github.com/MTrab/landroid_cloud # Cloud ############################################################# landroid_cloud: email: !secret mower1_mail password: !secret mower1_pass # Recorder ########################################################## recorder: exclude: entities: - sensor.mower1_ip - sensor.mower1_sn - sensor.mower1_mac - sensor.mower1_lastupdate - input_number.mower1_raindelay - input_number.mower1_timeextension - input_boolean.mower1_info_toggle - input_boolean.mower1_sched_settings - automation.mower1_notify_status - automation.mower1_notify_error - automation.mower1_sync_values - script.mower1_start - script.mower1_stop - script.mower1_pause - script.mower1_set_config - script.mower1_partymode - script.mower1_setzone - script.mower1_lock - script.mower1_restart - script.mower1_edgecut # Logbook ########################################################### logbook: exclude: entities: - sensor.mower1_ip - sensor.mower1_sn - sensor.mower1_mac - sensor.mower1_lastupdate - input_number.mower1_raindelay - input_number.mower1_timeextension - input_boolean.mower1_info_toggle - input_boolean.mower1_sched_settings - automation.mower1_notify_status - automation.mower1_notify_error - automation.mower1_sync_values - script.mower1_start - script.mower1_stop - script.mower1_pause - script.mower1_set_config - script.mower1_partymode - script.mower1_setzone - script.mower1_lock - script.mower1_restart - script.mower1_edgecut # Switch ############################################################ switch: - platform: template switches: mower1_mowing: value_template: "{{ is_state_attr('sensor.landroid_poolbereich_status', 'status_id', 7) }}" turn_on: service: script.mower1_start turn_off: service: script.mower1_stop mower1_partymode: value_template: "{{ is_state_attr('sensor.landroid_poolbereich_status', 'partymode_enabled', true) }}" turn_on: service: landroid_cloud.partymode data: id: "{{ state_attr('sensor.landroid_poolbereich_status','id') }}" enable: true turn_off: service: landroid_cloud.partymode data: id: "{{ state_attr('sensor.landroid_poolbereich_status','id') }}" enable: false mower1_lock: value_template: "{{ is_state_attr('sensor.landroid_poolbereich_status', 'locked', true) }}" turn_on: service: landroid_cloud.lock data: id: "{{ state_attr('sensor.landroid_poolbereich_status','id') }}" enable: true turn_off: service: landroid_cloud.lock data: id: "{{ state_attr('sensor.landroid_poolbereich_status','id') }}" enable: false # Sensor ############################################################ # sensor.landroid_poolbereich_battery # sensor.landroid_poolbereich_error # sensor.landroid_poolbereich_status template: sensor: # Info ############ - name: Mower1 IP unique_id: mower1_ip state: !secret mower1_ip icon: mdi:ip-network - name: Mower1 SN unique_id: mower1_sn state: !secret mower1_sn icon: mdi:numeric - name: Mower1 MAC unique_id: mower1_mac state: !secret mower1_mac icon: mdi:barcode # Status ########## - name: Mower1 Bladetime unique_id: mower1_bladetime state: "{{ state_attr('sensor.landroid_poolbereich_status', 'current_blade_time') }}" icon: mdi:fan unit_of_measurement: "min" attributes: time_formatted: > {% set t = state_attr("sensor.landroid_poolbereich_status", "current_blade_time") | int %} {% if t != 0 %} {{ "%0d d %0.02d h %0.02d min" | format(t // 1440, ((t % 1440) // 60), t % 60) }} {%- else -%} {{ '0 min' }} {% endif %} - name: Mower1 Totaltime unique_id: mower1_totaltime state: "{{ state_attr('sensor.landroid_poolbereich_status', 'work_time') }}" icon: mdi:bus-clock unit_of_measurement: "min" attributes: time_formatted: > {% set t = state_attr("sensor.landroid_poolbereich_status", "work_time") | int %} {% if t != 0 %} {{ "%0d d %0.02d h %0.02d min" | format(t // 1440, ((t % 1440) // 60), t % 60) }} {%- else -%} {{ '0 min' }} {% endif %} - name: Mower1 Dist unique_id: mower1_dist state: "{{ (state_attr('sensor.landroid_poolbereich_status', 'distance') | float(default=0)) / 1000 }}" icon: mdi:map-marker-distance unit_of_measurement: "km" - name: Mower1 lastupdate unique_id: mower1_lastupdate state: "{{ as_timestamp(strptime( state_attr('sensor.landroid_poolbereich_status', 'last_update'), '%H:%M:%S %d/%m/%Y')) | timestamp_custom('%d.%m.%Y %H:%M:%S') }}" icon: mdi:clock - name: Mower1 Partymode unique_id: mower1_partymode state: "{{ state_attr('sensor.landroid_poolbereich_status', 'partymode_enabled') }}" icon: mdi:party-popper - name: Mower1 locked unique_id: mower1_lock state: "{{ state_attr('sensor.landroid_poolbereich_status', 'locked') }}" icon: mdi:lock - name: Mower1 mowing zone unique_id: mower1_mowing_zone state: "{{ state_attr('sensor.landroid_poolbereich_status', 'mowing_zone') }}" icon: mdi:map-marker-circle # -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: Mower1 WIFI unique_id: mower1_wifi state: "{{ state_attr('sensor.landroid_poolbereich_status', 'rssi') }}" device_class: signal_strength unit_of_measurement: "dBm" icon: >- {% set strength = state_attr("sensor.landroid_poolbereich_status", "rssi") | float(default=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 %} - name: Mower1 Yaw unique_id: mower1_yaw state: "{{ state_attr('sensor.landroid_poolbereich_status', 'yaw') }}" icon: mdi:axis-z-rotate-clockwise unit_of_measurement: "°" - name: Mower1 Roll unique_id: mower1_roll state: "{{ state_attr('sensor.landroid_poolbereich_status', 'roll') }}" icon: mdi:axis-x-rotate-clockwise unit_of_measurement: "°" - name: Mower1 Pitch unique_id: mower1_pitch state: "{{ state_attr('sensor.landroid_poolbereich_status', 'pitch') }}" icon: mdi:seat-flat-angled unit_of_measurement: "°" # Input Number ###################################################### input_number: mower1_raindelay: name: Rain delay initial: 150 min: 0 max: 300 step: 30 unit_of_measurement: "min" icon: mdi:weather-lightning-rainy mower1_timeextension: name: Time extension initial: 0 min: -100 max: 100 step: 10 unit_of_measurement: "%" icon: mdi:clock-out mower1_zone1_distance: name: Multizone distance for Zone1 initial: 0 min: 0 max: 500 step: 1 unit_of_measurement: "m" icon: mdi:map-marker-distance mower1_zone2_distance: name: Multizone distance for Zone2 initial: 0 min: 0 max: 500 step: 1 unit_of_measurement: "m" icon: mdi:map-marker-distance mower1_zone3_distance: name: Multizone distance for Zone3 initial: 0 min: 0 max: 500 step: 1 unit_of_measurement: "m" icon: mdi:map-marker-distance mower1_zone4_distance: name: Multizone distance for Zone4 initial: 0 min: 0 max: 500 step: 1 unit_of_measurement: "m" icon: mdi:map-marker-distance mower1_zone1_probability: name: Multizone Probability for zone1 initial: 0 min: 0 max: 100 step: 10 unit_of_measurement: "%" icon: mdi:percent mower1_zone2_probability: name: Multizone Probability for zone2 initial: 0 min: 0 max: 100 step: 10 unit_of_measurement: "%" icon: mdi:percent mower1_zone3_probability: name: Multizone Probability for zone3 initial: 0 min: 0 max: 100 step: 10 unit_of_measurement: "%" icon: mdi:percent mower1_zone4_probability: name: Multizone Probability for zone4 initial: 0 min: 0 max: 100 step: 10 unit_of_measurement: "%" icon: mdi:percent # Input Select ##################################################### input_select: mower1_mower_zone: name: Mower zone options: - "0" - "1" - "2" - "3" - "4" initial: "0" icon: mdi:map-marker-circle # Input Boolean ##################################################### input_boolean: # Booleans for Lovelace mower1_sched_settings: name: Scheduler settings icon: mdi:file-hidden initial: false mower1_info_toggle: name: Info toggle icon: mdi:file-hidden initial: false mower1_partymode: name: Partymode enabled initial: false icon: mdi:party-popper mower1_lock: name: Lock enabled initial: false icon: mdi:lock # Automations ####################################################### automation: # Status notificaion - id: mower1_notify_status alias: Mower1 Notify Status initial_state: false trigger: - platform: state entity_id: sensor.landroid_poolbereich_status condition: - condition: template value_template: "{{ trigger.to_state.state != trigger.from_state.state }}" action: - service: persistent_notification.create data: title: 🏎️ Landroid Mower message: "{{ trigger.to_state.state }} <- {{ trigger.from_state.state }} - {{ states('sensor.date_time') }}" # Error notificaion - id: mower1_notify_error alias: Mower1 Notify Error initial_state: true trigger: - platform: state entity_id: sensor.landroid_poolbereich_error condition: - condition: template value_template: "{{ trigger.to_state.state != trigger.from_state.state }}" action: - service: persistent_notification.create data: title: 🏎️ Landroid Mower message: "{{ trigger.to_state.state }} <- {{ trigger.from_state.state }} - {{ states('sensor.date_time') }}" # Sync Landroid states - id: mower1_sync_values alias: Mower1 sync values trigger: - platform: homeassistant event: start - platform: state entity_id: sensor.mower1_lastupdate action: # Get rain delay - service: input_number.set_value data: entity_id: input_number.mower1_raindelay value: "{{ state_attr('sensor.landroid_poolbereich_status','raindelay') | int }}" # Get time extension - service: input_number.set_value data: entity_id: input_number.mower1_timeextension value: "{{ state_attr('sensor.landroid_poolbereich_status','timeextension') | int }}" # Scripts ########################################################### # Services # landroid_cloud.start # landroid_cloud.stop # landroid_cloud.pause # landroid_cloud.config # landroid_cloud.partymode # landroid_cloud.setzone # landroid_cloud.lock # landroid_cloud.restart # landroid_cloud.edgecut script: # Starts the mower mower1_start: alias: Mower1 Start sequence: service: landroid_cloud.start data: id: "{{ state_attr('sensor.landroid_poolbereich_status','id') }}" # Stops the mower and sends it home mower1_home: alias: Mower1 Home sequence: service: landroid_cloud.home data: id: "{{ state_attr('sensor.landroid_poolbereich_status','id') }}" # Pause the mower mower1_pause: alias: Mower1 Pause sequence: service: landroid_cloud.pause data: id: "{{ state_attr('sensor.landroid_poolbereich_status','id') }}" # Set rain delay and time extension mower1_set_config: alias: Mower1 set config sequence: service: landroid_cloud.config data: id: "{{ state_attr('sensor.landroid_poolbereich_status','id') }}" raindelay: "{{ states('input_number.landroid_raindelay') | int }}" timeextension: "{{ states('input_number.landroid_timeextension') | int }}" multizone_distances: "[{{ states('input_number.mower1_zone1_distance') | int }},{{ states('input_number.mower1_zone2_distance') | int }},{{ states('input_number.mower1_zone3_distance') | int }},{{ states('input_number.mower1_zone4_distance') | int }}]" multizone_probabilities: "[{{ states('input_number.mower1_zone1_probability') | int }},{{ states('input_number.mower1_zone2_probability') | int }},{{ states('input_number.mower1_zone3_probability') | int }},{{ states('input_number.mower1_zone4_probability') | int }}]" # Partymode mower1_partymode: alias: Mower1 Partymode sequence: service: switch.toggle target: entity_id: switch.mower1_partymode # Partymode mower1_setzone: alias: Mower1 set zone sequence: service: landroid_cloud.setzone data: id: "{{ state_attr('sensor.landroid_poolbereich_status','id') }}" zone: "{{ states('input_number.landroid_mower_zone') }}" # Lock mower1_lock: alias: Mower1 Lock sequence: service: switch.toggle target: entity_id: switch.mower1_lock # Restart the mower mower1_restart: alias: Mower1 Restart sequence: - service: landroid_cloud.restart data: id: "{{ state_attr('sensor.landroid_poolbereich_status','id') }}" # Edge counter mower1_edgecut: alias: Mower1 EdgeCut sequence: service: landroid_cloud.edgecut data: id: "{{ state_attr('sensor.landroid_poolbereich_status','id') }}" ```

Replace "poolbereich" with the id out of the landroid app. Replace "mower1" with a unique Id for your mower

For the 'set_zone' I get currently a execption. (Could be a problem with the active party mode or the deactivated schedule plan) The partymode and lock function need some seconds, because of the status poll request.

Update 2021/10/25: I add Multizonen setting support (not tested).

Barma-lej commented 2 years ago
  # Partymode
  mower1_setzone:
    alias: Mower1 set zone
    sequence:
      service: landroid_cloud.setzone
      data:
        id: "{{ state_attr('sensor.landroid_poolbereich_status','id') }}"
        zone: "{{ states('input_number.landroid_mower_zone') }}"

There is an eror here. You don't have a sensor named input_number.landroid_mower_zone. I think you wanted to use input_select.mower1_mower_zone

Barma-lej commented 2 years ago

I updated package now