iobroker-community-adapters / ioBroker.shelly

Integrate your Shelly devices into ioBroker via MQTT or CoIoT
Other
154 stars 62 forks source link

Adding support for shelly1pmminig3 #968

Closed svenbluege closed 3 months ago

svenbluege commented 3 months ago

Hey,

this is my simple attempt to add support for the shelly1pmminig3. It looked pretty complicated in the beginning, then the adjustments turned out pretty simple. I'm not even sure if there is already the need to gen3 since it is a simple copy of gen2. But I'm not deep enough in the details to judge this.

I'm using this code already in my iobroker instance and can switch/read the state of the shelly.

klein0r commented 3 months ago

Thank you, but I will drop the gen3-helper (api is identical to Gen2)

svenbluege commented 3 months ago

Makes sense, but something is different (and already für the shellyPlusPlugS).

Do you have a better solution for getting data via http-api than I have? Right now, it gets the hostname for the minig3 and the shellyplusplugs via some mqtt-events. But then it needs a restart of the adapter, so it can query the http-api with the hostname. I assume there is a much smarter way of doing this... but I don't know it ;)

klein0r commented 3 months ago

Makes sense, but something is different

What exactly?

svenbluege commented 3 months ago

Both devices do not get an IP/hostname initially. I made a change in the device files to get the IP when a mqtt-event happens: https://github.com/iobroker-community-adapters/ioBroker.shelly/pull/968/commits/5cd0df5ca61433b2b69a1052e2900a6944c306a6#diff-58d4bba5c90efa3b0334c028f8a5a09f87dc374dd48d86a369f8a70d18187106R11

All the other Gen1/Gen2-devices I have, get that information initial and can pull things like the device name without an issue. I did not dig deep enough to figure out how.