Fun with Mycroft and Home Assistant!

Not sure if this is the right category. Please move if it belongs somewhere else.

I’ve been using Mycroft for over a year now. He’s still booting from microSD but I’m going to do a USB boot this weekend. That said, I’ve been integrating him more and more into my Home Assistant ecosystem. I figured I’d share some automations that utilize Mycroft. Of course, you can always just call scenes by saying turn on this or that, or call automations by saying activate this or that. Then, of course, you can just trigger individual devices and sensors by their own friendly name. These automations make Mycroft feel like he’s actually alive and part of the home. Some are little tongue in cheek, and more for my own personal pleasure. I’m going to post each one as a new comment to this original post. If you have any questions with the integration, feel free to ask. And have fun!

7 Likes

Hopefully now, I will never forget to charge my phone. At least, Mycroft won’t let me…

alias: ChargeYourPhone
description: ''
trigger:
  - type: battery_level
    platform: device
    device_id: 52ea4cf51e484a766db41226624686c6
    entity_id: sensor.pixel6_battery_level
    domain: sensor
    below: 16
condition:
  - condition: zone
    entity_id: device_tracker.pixel6
    zone: zone.home
action:
  - service: notify.picroft
    data:
      message: (yournamehere), you need to charge your phone.
  - delay:
      hours: 0
      minutes: 2
      seconds: 0
      milliseconds: 0
  - condition: state
    entity_id: sensor.pixel6_battery_state
    state: discharging
  - service: notify.picroft
    data:
      message: Please begin charging your phone.
  - delay:
      hours: 0
      minutes: 2
      seconds: 0
      milliseconds: 0
  - condition: state
    entity_id: sensor.pixel6_battery_state
    state: discharging
  - service: notify.picroft
    data:
      message: Don't make me angry. Start charging your phone now.
mode: single

2 Likes

You don’t want to run your 3D printer filament dryer 24/7. This will turn it off after a certain amount of time and Mycroft will let you know it’s finished drying.

alias: Filament Drying
description: ''
trigger:
  - platform: device
    type: turned_on
    device_id: c38fce85af700c88ddac132c8f78fac6
    entity_id: switch.filament_dryer_socket_1
    domain: switch
    for:
      hours: 6
      minutes: 0
      seconds: 0
condition: []
action:
  - type: turn_off
    device_id: c38fce85af700c88ddac132c8f78fac6
    entity_id: switch.filament_dryer_socket_1
    domain: switch
  - service: notify.picroft
    data:
      message: The filament has finished drying.
mode: single

2 Likes

I still need to finesse the motion sensitivity of the Hue sensor, but this will alert me when the bandits are outside snooping around my property.

alias: Front Motion
description: ''
trigger:
  - type: motion
    platform: device
    device_id: b4c30260f0cea9f3bdfa1953276ba7f7
    entity_id: binary_sensor.hue_outdoor_motion_sensor_1_motion
    domain: binary_sensor
condition:
  - condition: time
    before: input_datetime.motionstop
    after: input_datetime.motionstart
action:
  - service: light.toggle
    data:
      flash: short
    target:
      entity_id:
        - light.livingroom1
        - light.livingroom2
        - light.hue_white_lamp_1_2
        - light.hue_white_lamp_1
  - repeat:
      count: '2'
      sequence:
        - type: toggle
          device_id: a2caea58b4772b83dd72bcf1366c07a4
          entity_id: switch.30375283c4dd57371202
          domain: switch
  - service: notify.picroft
    data:
      message: Motion sensed on front porch.
mode: single

2 Likes

Mycroft tells me to have a good day, before I leave.

alias: HaveALovelyDay
description: ''
trigger:
  - platform: event
    event_data:
      domain: scene
      service: turn_on
      service_data:
        entity_id: scene.leaving_home
    event_type: call_service
condition: []
action:
  - delay:
      hours: 0
      minutes: 0
      seconds: 5
      milliseconds: 0
  - service: notify.picroft
    data:
      message: Have a lovely day!
mode: single

1 Like

Regarding the front motion sensor, you don’t want to let it run out of batteries. This could work on any battery operated device, that issues a state of its own battery level.

alias: FrontMotionBattery
description: ''
trigger:
  - type: battery_level
    platform: device
    device_id: b4c30260f0cea9f3bdfa1953276ba7f7
    entity_id: sensor.frontmotion_battery
    domain: sensor
    below: 16
condition: []
action:
  - service: notify.picroft
    data:
      message: Front Motion battery is getting low.
  - service: notify.mobile_app_pixel6
    data:
      title: BATTERY ALERT!!
      message: Time to change the battery in front motion sensor.
mode: single

1 Like

For my own guilty pleasure, Mycroft gives me positive feedback when I remember to charge my phone…

alias: MycroftThanksYou
description: ''
trigger:
  - platform: state
    entity_id: sensor.pixel6_battery_state
    to: charging
    from: discharging
condition:
  - condition: zone
    entity_id: device_tracker.pixel6
    zone: zone.home
action:
  - service: notify.picroft
    data:
      message: You are so responsible, (yournamehere).
mode: single

1 Like

And of course, you don’t want to leave your phone continually on the charger. My good buddy Mycroft is there to remind me that I can begin discharging the battery again.

alias: PhoneIsCharged
description: ''
trigger:
  - type: battery_level
    platform: device
    device_id: 52ea4cf51e484a766db41226624686c6
    entity_id: sensor.pixel6_battery_level
    domain: sensor
    above: 95
condition:
  - condition: zone
    entity_id: device_tracker.pixel6
    zone: zone.home
  - condition: state
    entity_id: sensor.pixel6_battery_state
    state: charging
  - condition: device
    type: is_off
    device_id: 256b1be04f12d1acdbe125b15e938268
    entity_id: switch.bedcharge_socket_1
    domain: switch
action:
  - service: notify.picroft
    data:
      message: (yournamehere), your phone is charged.
  - delay:
      hours: 0
      minutes: 3
      seconds: 0
      milliseconds: 0
  - condition: state
    entity_id: sensor.pixel6_battery_state
    state: charging
  - service: notify.picroft
    data:
      message: Please remove your phone from the charger.
  - delay:
      hours: 0
      minutes: 3
      seconds: 0
      milliseconds: 0
  - condition: state
    entity_id: sensor.pixel6_battery_state
    state: charging
  - service: notify.picroft
    data:
      message: Are you ignoring me? Your phone is fully charged.
mode: single

2 Likes

I’ve created a monster…My lovely lady cannot fathom cooking the rice anymore without this automation.

alias: Rice Cooking
description: ''
trigger:
  - platform: device
    type: turned_on
    device_id: d824ea748dfbfd1fdd88ae49fc092faa
    entity_id: switch.therice_socket_1
    domain: switch
    for:
      hours: 0
      minutes: 20
      seconds: 0
condition: []
action:
  - type: turn_off
    device_id: d824ea748dfbfd1fdd88ae49fc092faa
    entity_id: switch.therice_socket_1
    domain: switch
  - service: notify.picroft
    data:
      message: The rice has finished cooking.
mode: single

2 Likes

And after a hard day at work, at least someone is happy to see me. Usually my dog is, and I’m pretty sure my lovely lady is too… But just in case they’re both mad at me for some reason I can trust that Mycroft won’t be.

alias: WelcomeBackHome
description: ''
trigger:
  - platform: event
    event_data:
      domain: scene
      service: turn_on
      service_data:
        entity_id: scene.back_home
    event_type: call_service
condition: []
action:
  - delay:
      hours: 0
      minutes: 0
      seconds: 5
      milliseconds: 0
  - service: notify.picroft
    data:
      message: Welcome back. I hope you had a good day.
mode: single

2 Likes

Last, but not least. With work out of my thoughts, while at home, I’m reminded twice a week to charge my tool batteries. I hate being in a repair situation and something doesn’t work because I forgot to charge the dang battery! I’m sure there will be more automations along the way, but this is most of what I have so far.

alias: WorkTruckBatteries
description: ''
trigger:
  - platform: time
    at: input_datetime.worktruckbatteries
condition:
  - condition: time
    before: '00:00:00'
    after: '17:00:00'
    weekday:
      - wed
      - sun
action:
  - service: notify.picroft
    data:
      message: 'You need to charge your work truck batteries '
  - service: notify.mobile_app_pixel6
    data:
      title: BATTERY REMINDER
      message: >-
        You need to go back outside to your truck, gather all the batteries, and
        charge them. 
mode: single

2 Likes

So COOL!!!

Keep those snippets coming. :muscle:

1 Like

lol they are great - that Mycroft can be a demanding master too!