Can a Shelly1 to SEND MQTT to the broker instead of using http on button press.

  • Hi,

    Just got into the world of Shelly, what a great device!

    I guess the purpose of MQTT on the shelly1 is to control IT but did wonder if on the switch being activated a MQTT topic/message can be SENT.

    Currently, I have it as a contact relay at the moment, if I get 12v across the terminals it sends an http: command, which is works well.

    I would also like it to send a MQTT payload/message to the broker so I can pick it up in a python script that would then send a message to my phone.

    I can do all the rest but it needs it to send the mesages MQTT to the broker.

    Is this possible?

  • How did you confugure the shelly?

    This is, what some of my shelly sent to the MQTT-broker:

    PlugMQTT.jpg

    This is a Shelly Plug-S

    Shelly1MQTT.jpg

    This is a Shelly1

    Shelly1AddOnMQTT.jpg

    This is a Shelly 1 with Temperature AddON

    Shelly1PMMQTT.jpg

    This is a Shelly 1PM

    ShellyI3MQTT.jpg

    This is a Shelly I3

    ShellyI3onMQTT.jpg

    ans this is the same I3 with Input 1 ON

    Viele Grüße,

    Wolfgang

    .Nach einem Job mit viel Kurzarbeit, dann Corona bin ich seit einiger Zeit wieder in meinem erlernten Beruf als Elektriker in der boomenden PV-Branche gelandet. Da bleibt kaum noch Zeit mich um die eigenen Smarthome-Ideen zu kümmern... Naja - nicht mehr lange... der Ruhestand winkt schon am Ende des Jahres 2025...

  • Hi,

    Thanks for your reply,

    I think OK now.

    I did not really understand the principle of the MQTT on the Shelly1, quite new to both.

    Once enabled in the settings I figured it was just for receiving and assumed would need something under the Send on button press/long press etc.

    but now realize it automatically sends to the broker without doing anything else, settings or commands.

    Below is sent to the broker as soon an the Shelly1 is triggered.

    shellies/shelly1-98CDAxxxxxxx/relay/0 b'off'

    shellies/shelly1-98CDAxxxxxxx/input/0 b'0'

    Just programming now and working mostly,

    I think I should be able to work out but trying to see if I can find a difference between keepalive & Shelly1 OFF.

    They are both :

    shellies/shelly1-98CDAxxxxxxx/relay/0 b'off'

    shellies/shelly1-98CDAxxxxxxx/input/0 b'0'

    Shelly1 ON is fine & can test for but every 60 seconds (or whatever set to) get the above payload.

    I get the message when ON (which is unique) but cannot tell the difference between OFF & the keep alive, same message.

    Thanks again.