Howto extend the device tracker component?

I would like to create a new component that has the ability to track outgoing internet connections of tracked devices specified in known_devices.yaml.

This enables a bunch of new automation rules, e.g.:

  • Turn off lights when Netflix is started on the FireTV
  • Turn on receiver when Spotify is started on the PC

While the coding I can do easily, I would like to know where to put this best in the framework.
First I want to implement this to the dd-wrt device tracker.

So my questions are:

  1. Does it makes sense / is it foreseen to add additional attributes to a device tracker, than the attributes hard code here?
  2. If 1. is not possible, one could just create a not specified component as e.g. the lirc component. Is this correct? I still would like to access the tracked devices. So generally speaking: how to implement a component that relies on another component?

I would be happy about some advice,


I’m having some trouble here understanding what you actually want to accomplish.

But you can extend the code where ever you seem fit and make a pull request if I’m not mistaken. I think it would be possible to add another attribute called “appplications” which contains a list of application running on that host.

Thanks for your reply! Sure I can just do a pull request, but before I waste time when it is rejected I wanted to know where to put the new code.

Let us assume I extend the existing tracker component with a new connections attribute. Then every tracker component will have this attribute, although e.g. the owntracks component does not need it. If that is ok with the maintainers I do that.


1 Like

Okay I see what you are getting at now. Sadly I can not provide you with an answer to this.


Don’t worry. I think I will just make my DD-WRT router work without extending the device tracker component and make a pull request. Seems to be the only way to get feedback from the core developers. Although this would enable this new feature only for DD-WRT routers…