Whodunnit - Discover how, when, where and who triggered your devices

Whodunnit lets you know what actually triggered your devices. It creates a sensor that will tell you whether the device was changed by an automation, a script, a scene, the dashboard, or a physical switch, as well as the user who did it.

Handy for quick debugging using the Sensor’s attributes:

It also can be used in automations for overriding actions based on the source of the trigger:

automation:
  - alias: "Smart Off"
    trigger:
      - platform: state
        entity_id: binary_sensor.motion
        to: "off"
    condition:
      - condition: not
        conditions:
          - condition: state
            entity_id: sensor.office_light_trigger_source
            state: "manual"
    action:
      - service: light.turn_off
        target:
          entity_id: light.office_light

Viewing the sensor via a Dashboard card:

5 Likes

Nice work, sir. This will come in handy immediately.

I have a stupid number of automations - organized chaos, I promise - and I feel like my wife and kids just screw with me these days. Just tonight my youngest told me her colour-changing bulb didn’t do the right-before-bed-time-to-get-ready disco thing. And that’s because the button she presses to activate had it’s automation turned off. Which I bet was done by my oldest since they can reach the hallway dashboard and my youngest can’t. Happens frequently and pinpointing which device/source/when is sometimes annoying.

Today I’ve released version 1.2 of Whodunnit and it’s packed full of new features and improvements. Big thanks to the HA community for your support.

  • New Event: whodunnit_trigger_detected. It is fired on the HA event bus after every classification. Solves the repeated-state trigger problem (e.g. same script runs twice, light toggled on then off) where the sensor’s native_value doesn’t change and a standard state trigger would not fire. Payload carries all classification fields.
  • When a Script is called by an Automation, Whodunnit can now identify the true source
  • Added support for more domains : climate, water_heater, valve, number, select, button, input_button, input_number, input_select, input_text, alarm_control_panel, timer
  • Added attribute changes as a trigger source (such as when a light is dimmed)
  • Added support for ESPHome devices
  • Added support for multiple entities on a single device
  • Added service status for API events such as Node-RED
  • Added a history log
  • Improved accuracy
  • Added confidence attribute High/Medium/Low
  • Improved memory usage, speed, and stability
  • Improved documentation
  • and much more…