Help getting started with new component

I’ve spent a couple days on and off reading the dev docs, but I’m still a bit unclear on some things. My goal at the moment is to create a custom (for now) component to interface with a Particle Photon driven pool controller that communicates via MQTT.

Initially, I was going to add all of the sensors, switches, etc. manually via the existing mqtt component, but I figured this might be a good learning opportunity and would allow me to keep all of the associated entities better organized.

After going round and round on how to start and looking at the implementation of various existing components, I’m thinking the cleanest method might be to utilize the existing MQTT component to do all of the heavy lifting inside of my new component. I envision my component would simply be a container for the associated entities and pass configuration to the MQTT component entities as needed. I’d accomplish this either by subclassing the appropriate MQTT class (MqttSensor for example) or simply importing them and using them directly

Does this sound like the right approach, or am I way off base? I suspect there’s a “proper” way to do this while avoiding a ton of code duplication, but I’m not sure what that is…


There is no “pool” domain, so unless you are thinking of developing a whole new domain, you are simply looking at a series of components in existing domains, eg sensor, climate etc.

I guess that’s what I was thinking. Are there dev docs specific to creating a new domain or any good example components you could point me to?