Shelldown - use shelly plus (gen2) using old shelly (gen1) API

Hi, I was using standard shelly (gen1) and loved the one topic - one value principle. New, plus devices, are sending everything on single topic and use json. This is cumbersome to use and stands against what is good about mqtt and topic.

So I’ve created program to get back those old APIs back. Program basically listens on new mqtt topics and republishes messages on old mqtt API topics.

So for messages:

shellyplus1pm-4417939a5610/events/rpc {"src":"shellyplus1pm-4417939a5610","dst":"shellyplus1pm-4417939a5610/events","method":"NotifyStatus","params":{"ts":1708326851.41,"switch:0":{"id":0,"output":true,"source":"MQTT","voltage":224.18}}}
shellyplus1pm-4417939a5610/events/rpc {"src":"shellyplus1pm-4417939a5610","dst":"shellyplus1pm-4417939a5610/events","method":"NotifyStatus","params":{"ts":1708326852.50,"switch:0":{"id":0,"apower":918.63}}}
shellyplus1pm-4417939a5610/events/rpc {"src":"shellyplus1pm-4417939a5610","dst":"shellyplus1pm-4417939a5610/events","method":"NotifyStatus","params":{"ts":1708326854.50,"switch:0":{"id":0,"apower":1800.50}}}
shellyplus1pm-4417939a5610/events/rpc {"src":"shellyplus1pm-4417939a5610","dst":"shellyplus1pm-4417939a5610/events","method":"NotifyStatus","params":{"ts":1708326875.04,"switch:0":{"id":0,"apower":0,"output":false,"source":"MQTT","voltage":0}}}

Program will republish these as:

/iot/saloon/heat/relay/0 on
/iot/saloon/heat/relay/0/voltage 224.18
/iot/saloon/heat/relay/0/power 918.63
/iot/saloon/heat/relay/0/power 1800.50
/iot/saloon/heat/relay/0/power 0.00
/iot/saloon/heat/relay/0 off
/iot/saloon/heat/relay/0/voltage 0.00

/iot/ is a prefix that can be passed as argument to the program, and saloon/heat is my id of a shelly.

Configuration and running are simple. The design is very human.
First you need to create map to link shelly and your custom id, one entry per line (/etc/shelldown-id-map)

shellyplus1pm-4417939a5610    saloon/heat

And start the program. Example starts with custom prefix /iot/, if prefix is not specified, shellies/ will be used instead. -r flag is so that messages are published with retain mqtt flag.

shelldown -t /iot/ -r

And that’s it. I am using it for almost 2 years now, with my shelly1pm and shelly-i4. But still, I would say project is very young and lacks features. You can request features on github, or write pull request. Depending on interest (and my budget for new shellies) I will be adding new thingies.

Project can be downloaded and build from github:

Hope it will make your life easier with new shellies :slight_smile: