How do I create a custom scripted device for device triggers without MQTT?

The homekit integration can expose device triggers to HomeKit as stateless programmable switches. But I can’t figure out how to make a custom device w/triggers without writing my own custom component. The closest I’ve found (though not actually tried yet) is device_trigger.mqtt, but this means going through MQTT for configuration and triggering.

In my case, I want to invoke actions in HomeKit based on HA automations/scripts, which means I need to fire a device trigger from an automation/script. Having to round-trip that through an MQTT server seems quite unnecessary, I shouldn’t need that complexity or latency, but I can’t figure out any other way to implement a custom device with device triggers.

I’m really hoping that I’m missing something here, that either there’s a way to just declare a custom device in configuration.yaml with device triggers controlled by a service, or that there’s some integration out there that will let me script a custom device. The python_scripts integration documentation says access to the API is limited and does not mention the device registry. The pyscript custom component doesn’t show anything to do with devices either (searching the docs site for the word “device” has zero results). Is there another integration or custom component, or perhaps a way to do this with the existing integrations that simply isn’t documented?

1 Like

All roads lead to MQTT. :slightly_smiling_face: