###################################
##  LOG Medicine
###################################
- alias: 'Log Medicine Activity'
  mode: single
  id: 5e250206-029e-42fb-993f-fc3f04760de3

  trigger:
    - platform: event
      event_type: medicine_dash
    - platform: state
      entity_id: input_boolean.medicine
      to: 'on'
      from: 'off'

  action:
    - service: input_boolean.turn_on
      entity_id: input_boolean.medicine
    - service: logbook.log
      data:
        name: "Medicine Push"
        message: "Took Medicine today."

    - service: mqtt.publish
      data:
        payload: '{{ states("sensor.date") }}'
        topic: 'dash/medicine/medicine_time'
        retain: true

    - service: script.notify_engine
      data:
        title: 'Medicine Reminder Completed'
        value1: 'Carlo Took his Medicine today.'
        who: 'parents'
        group: 'Medicine'
    - delay:
        minutes: 1