#-------------------------------------------
# @CCOSTAN
# Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig
# Neato Support for D7 Connected Botvac - control my [Neato Vacuum](http://amzn.to/2kqnnqu) with Home Assistant.
#-------------------------------------------
# homeassistant:
#   customize_glob:
#     "*.*_sleep_hours":
#       unit_of_measurement: hours
#       icon: mdi:sleep
#       emulated_hue_hidden: True
#       hidden: False
#-------------------------------------------
neato:
  username: !secret neato_username
  password: !secret neato_password
#-------------------------------------------
group:
  Neato:
    entities:
      - camera.carloneato_cleaning_map
      - switch.carloneato_schedule
      - vacuum.carloneato
##############################################################################
###  Automations - Detect when things are not right. Like any Good Watchdog.
##############################################################################
automation:
  - alias: 'Vacuum -Tweet'
    trigger:
      - platform: state
        entity_id: vacuum.carloneato
        to: 'off'
        from: 'on'

    condition:
      - condition: template
        value_template: "{{ states.vacuum.carloneato.attributes.battery_level |int < 20 }}"

    action:
      - service: script.tweet_engine
        data_template:
          tweet: >
            {{ [
            "#Neato returning to base. Vacuumed up a TON. (http://amzn.to/2CKHZya)",
            "Everyday I have the Neato Botvac go out and clean the house on its own.",
            "Since we have a cat that sheds all day, we have @Neato go out daily to clean.",
            "Time to recharge the @Neato Vacuum."
            ] | random + " Battery Level:{{states.vacuum.carloneato.attributes.battery_level }} #Robots"}}