dykandDK

HA - Bosch Indego Card with countdown to next mow

Jul 25th, 2020 (edited)
361
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 7.27 KB | None | 0 0
  1. #################################################################
  2. # Sections below should be added to config.yaml file
  3. #
  4. # Indego sensor names must be updated to actual names used
  5. #################################################################
  6.  
  7. #----------------------------------------------------------
  8. # Local Date and time
  9. #----------------------------------------------------------
  10. sensor:
  11.   - platform: time_date
  12.     display_options:
  13.      - "time"
  14.       - "date"
  15.       - "date_time"
  16.       - "time_date"
  17.       - "time_utc"
  18.     scan_interval: 55 #once every 55 second
  19.  
  20.   #----------------------------------------------------------
  21.   # Fix Indego date formats and add countdown to next mow
  22.   #----------------------------------------------------------
  23.   - platform: template
  24.     sensors:
  25.       indego_last_mow:
  26.         value_template: "{{ as_timestamp(states('sensor.indego_XXXXXXXX_last_completed')) | timestamp_custom('%d.%m.%y %H:%M') }}"
  27.       indego_next_mow:
  28.         value_template: "{{ states('sensor.time') and as_timestamp(states('sensor.indego_XXXXXXXX_next_mow')) | timestamp_custom('%d.%m.%y %H:%M')}}"
  29.       indego_next_mow_countdown:
  30.         value_template: >-
  31.           {% set day_diff = (( states('sensor.time') and as_timestamp(states('sensor.indego_XXXXXXXX_next_mow')) - as_timestamp(now()) )/ (3600*24)) | int %}
  32.           {% set hour_diff =(( states('sensor.time') and as_timestamp(states('sensor.indego_XXXXXXXX_next_mow')) - as_timestamp(now()) - (24*day_diff*3600) )/ (3600)) | int %}
  33.           {% set min_diff =(( states('sensor.time') and as_timestamp(states('sensor.indego_XXXXXXXX_next_mow')) - as_timestamp(now()) - (24*day_diff*3600) - (3600*hour_diff) )/ (60)) | int %}
  34.           {% if day_diff>1 %} {{ day_diff }} dage, {% elif day_diff==1 %}{{ day_diff }} dag, {% endif %}{% if hour_diff>1 %}{{ hour_diff }} timer og {{ min_diff }} min. {% elif hour_diff==1 %}{{ hour_diff }} time og {{ min_diff }} min.{% else %}{{ min_diff }} min.{% endif %}
  35.  
  36. #----------------------------------------------------------
  37. # Limit log entries
  38. # (e.g do not store history for date/time sensors)
  39. #----------------------------------------------------------
  40. recorder:
  41.   exclude:
  42.     entities:
  43.      - sensor.date
  44.       - sensor.time
  45.       - sensor.local_time
  46.       - sensor.date_time
  47.       - sensor.time
  48.       - sensor.time_date
  49.       - sensor.time_utc
  50.       - sun.sun
  51.       - sensor.indego_next_mow
  52.       - sensor.indego_next_mow_countdown
  53.  
  54. #################################################################
  55. # Below must be added to your Lovelace file
  56. #
  57. # Indego sensor names must be updated to actual names used
  58. #################################################################
  59.  
  60.       #---------------------------------------------------------------
  61.       # Bosch Indego 400 Connect lawnmover
  62.       #---------------------------------------------------------------
  63.       - image: /local/assets/indego.jpg     # source: https://community-assets.home-assistant.io/original/3X/2/8/28547e0f7f61dcd441b4f2414861ceab4eac9392.jpeg
  64.         state_filter:
  65.          - null
  66.         type: picture-elements
  67.         elements:
  68.          # Lawn completion percentage
  69.           - type: icon
  70.             icon: mdi:progress-check
  71.             title: Lawn completion percentage
  72.             style:
  73.               top: 12%
  74.               left: 20px
  75.               '--iron-icon-fill-color': '#FFFFFF'
  76.               '--iron-icon-height': 40px
  77.               '--iron-icon-width': 40px
  78.           - type: state-label
  79.             entity: sensor.indego_XXXXXXXXX_lawm_mowed
  80.             style:
  81.               top: 12%
  82.               left: 50px
  83.               font-size: 15px
  84.               max-width: 50px
  85.           # Remaining battery percentage
  86.           - type: icon
  87.             icon: mdi:battery-80
  88.             style:
  89.               top: 12%
  90.               left: 90px
  91.           - type: state-label
  92.             entity: sensor.indego_XXXXXXXXX_battery_percentage
  93.             style:
  94.               top: 12%
  95.               left: 120px
  96.               font-size: 15px
  97.               max-width: 50px
  98.           # Total mow time
  99.           - type: icon
  100.             icon: mdi:update #mdi:calendar-arrow-right
  101.             style:
  102.               top: 12%
  103.               left: 160px
  104.           - type: state-label
  105.             entity: sensor.indego_XXXXXXXXX_runtime_total
  106.             style:
  107.               top: 12%
  108.               left: 170px
  109.               font-size: 15px
  110.               max-width: 1px
  111.           # Start mow command
  112.           - type: icon
  113.             title: Mow
  114.             icon: 'mdi:play'
  115.             entity: input_boolean.indego_mow
  116.             tap_action:
  117.               action: call-service
  118.               service: indego.command
  119.               service_data:
  120.                 command: mow
  121.             style:
  122.               top: 12%
  123.               left: 60%
  124.               '--iron-icon-fill-color': '#FFFFFF'
  125.               '--iron-icon-height': 40px
  126.               '--iron-icon-width': 40px
  127.           # Pause mow command
  128.           - type: icon
  129.             title: Pause
  130.             icon: 'mdi:pause'
  131.             entity: input_boolean.indego_pause
  132.             tap_action:
  133.               action: call-service
  134.               service: indego.command
  135.               service_data:
  136.                 command: pause
  137.             style:
  138.               top: 12%
  139.               left: 73%
  140.               '--iron-icon-fill-color': '#FFFFFF'
  141.               '--iron-icon-height': 40px
  142.               '--iron-icon-width': 40px
  143.           # Dock command
  144.           - type: icon
  145.             title: Home
  146.             icon: 'mdi:home'
  147.             entity: input_boolean.indego_home
  148.             tap_action:
  149.               action: call-service
  150.               service: indego.command
  151.               service_data:
  152.                 command: returnToDock
  153.             style:
  154.               top: 12%
  155.               left: 85%
  156.               '--iron-icon-fill-color': '#FFFFFF'
  157.               '--iron-icon-height': 40px
  158.               '--iron-icon-width': 40px
  159.           # Current status / state
  160.           - type: state-label
  161.             entity: sensor.indego_XXXXXXXXX_mower_state_detail
  162.             style:
  163.               top: 26%
  164.               left: 5px
  165.               font-size: 15px
  166.               max-width: 1px
  167.               text-align: left
  168.           # Moving mode
  169.           - type: state-label
  170.             entity: sensor.indego_XXXXXXXXX_mowing_mode
  171.             style:
  172.               top: 26%
  173.               left: 60%
  174.               font-size: 15px
  175.               max-width: 30px
  176.           # Last mow completion date/time
  177.           - type: icon
  178.             icon: mdi:calendar-check
  179.             style:
  180.               top: 68%
  181.               left: 5%
  182.           - type: state-label
  183.             entity: sensor.indego_last_mow
  184.             style:
  185.               top: 68%
  186.               left: 30px
  187.               font-size: 15px
  188.               max-width: 1px
  189.           # Next scheduled mow date/time
  190.           - type: icon
  191.             icon: mdi:calendar-arrow-right
  192.             style:
  193.               top: 82%
  194.               left: 5%
  195.           - type: state-label
  196.             entity: sensor.indego_next_mow_countdown
  197.             style:
  198.               top: 82%
  199.               left: 30px
  200.               font-size: 15px
  201.               max-width: 1px
  202.  
Add Comment
Please, Sign In to add comment