Best way to integrate homebrewn smart plugs?

Hi folks, please bear with me if this is a dumb or RTFM question. I am a complete beginner with HA and am trying to find my ways with it.

I got several smart plugs here that are running my own firmware. The plugs are communicating by Modbus TCP and have several features in addition to just switching on and off - timers, auto-off, power metering, history data etc.

What would be the best way to integrate those into HA? A simple switch device is no problem of course, but how to set up a kind of hybrid device with all those nifty features?

I know nothing about Modbus, but it must surely be an RTFM moment. :slight_smile:

The Modbus part is not the question, rather how to have a switch plus numerous sensors and setting options integrated into one device template that can be used for several devices of the same type.

It’s unclear what your request is.
Do you want “meta-templates” for the YAML code to be generated for your modbus devices?

There is nothing out-of-the-box, but I deviced a (convoluted) homebrew solution for this:

1 Like

That is pointing into the direction I was looking for.

I have >10 smart plugs with identical firmware that will have to be treated the same way. I was wondering if there was a way to specify the YAML just for this device type and refer to that specification for each physical device to not have to copy and paste the complete code again and again (and do 10+ modifications in 10 files if necessary).

But I take from your answer there is no such “device template” mechanism in HA?

In the meantime I came across emrichen that looks like it does what I am looking for. It will take a YAML template with variables inside and generate YAML again with the variables instantiated.

Yeah, that’s exactly what my solution is doing, but any template engine will do, at the end of the day.

1 Like