Shelly 4Pro. MQTT info

  • Hi All,

    I am unable to find the list of supported MQTT commands and what is sent out for the new 2Gen Shelly 4Pro plus. Also, I cannot find in the built in webserver, how to edit the MQTT name to set a custom name. The default one if very very long ....

    Thanks for your help!


    Martin Picard

  • Olsche

    Set the Label from Shelly 4Pro to Shelly Pro 4PM
  • Dear Olsche,


    I am assisting Martin (the person who started the thread) with device integrations.


    Pleased advice if there is a way to hook up the device to my MQTT server directly?

    Is there an MQTT protocol commands reference available i.e. payloads i can publish to certain topics the device subscribed to etc the common way for MQTT?


    The reference you gave is relying on HTTP-methods and RPC which is not what we are looking for.


    Another question is how to rename the device, but I think it should be available in MQTT-protocol commands reference if any.


    Cheers, Alex

  • please check the API Docs,
    https://shelly-api-docs.shelly…gen2/Overview/RPCChannels
    (related section is MQTT)

    1x Shelly4ProPlus, 10x Shelly1, 7x Shelly 1PM, 2xShelly 1L, 9x Shelly 2.5, 3x Shelly2, 1x Shelly EM, 2x ShellyDimmer, 3x ShellyDimmer2, 1x Shelly 3EM, 1x Shelly4Pro, 1x Shelly Button1, 4x Shelly Duo, 1x, ShellyDuo G10, 3x ShellyVintage, 1x Shelly Bulb, 8x ShellyDuoG10RGB, 1x ShellyPlug, 2x ShellyRGBW2, 5x Shelly PlugS. 1x Shelly Sense, 3x Shelly i3, 1x Shelly Gas, 4x Shelly H&T, 1x Shelly Flood, 2x ShellyDoor&Window2, 3x TempAddon, 1x ShellyMotion

  • please check the API Docs,
    https://shelly-api-docs.shelly…gen2/Overview/RPCChannels
    (related section is MQTT)

    that was very helpfull, thank you!


    - we managed to setup MQTT server connection

    - we are getting events info on events/rpc topic


    but next question appeared:


    - we are able to send RPC commands (via MQTT as JSON, src: user_1) to device (topic shellypro4pm-84cca87e3eb8/rpc) , and we are listening to topic "user_1/rpc" for responce


    we are getting response right after command sent, but its an error response


    "{"id":1,"src":"shellypro4pm-84cca87e3eb8","dst":"user_1", "error": {"code":401, "message":"{\"auth_type\": \"digest\", \"nonce\": 1630447058, \"nc\": 1, \"realm\": \"shellypro4pm-84cca87e3eb8\", \"algorithm\": \"SHA-256\"}"}}"


    Please advice how to handle it


    Commands we are sending are taken from your docs like:


    {"id":1,"src":"user_1","method":"Switch.GetStatus","params":{"id":0}}

    or

    {"id":123,"src":"user_1","method":"Switch.Set","params":{"id":0,"on":true}}

    or

    {"id":1,"src":"user_1","method":"Switch.Toggle","params":{"id":0}}

    or

    { "jsonrpc":"2.0", "id": 1, "src":"user_1", "method":"Switch.GetConfig", "params": { "id":2 } }



    Cheers, Alex

  • tested and working fine for me:
    mosquitto_pub -h localhost -p 1883 -u admin -P admin -t shellypro4pm-f008d1d87058/rpc -m '{"id":1, "src":"user_1", "method":"Switch.Set", "params":{"id":3,"on":false}}'
    From the Error 401 I'd assume you have authentication set for the RPC channel..

    https://shelly-api-docs.shelly…erview/CommonDeviceTraits
    Thus you need to pass authentication details :

    auth":

    {"realm": "shellypro4pm-f008d1d8b8b8", "username": "admin", "nonce": 1625038762,

    "cnonce": 313273957, "response": "4800bb7fade82aecb9210595bc938a044207816be6eca496e7d208dcbeaa651c",

    "algorithm": "SHA-256"}


    Password needs to be SHA-256 encrypted.

    1x Shelly4ProPlus, 10x Shelly1, 7x Shelly 1PM, 2xShelly 1L, 9x Shelly 2.5, 3x Shelly2, 1x Shelly EM, 2x ShellyDimmer, 3x ShellyDimmer2, 1x Shelly 3EM, 1x Shelly4Pro, 1x Shelly Button1, 4x Shelly Duo, 1x, ShellyDuo G10, 3x ShellyVintage, 1x Shelly Bulb, 8x ShellyDuoG10RGB, 1x ShellyPlug, 2x ShellyRGBW2, 5x Shelly PlugS. 1x Shelly Sense, 3x Shelly i3, 1x Shelly Gas, 4x Shelly H&T, 1x Shelly Flood, 2x ShellyDoor&Window2, 3x TempAddon, 1x ShellyMotion

  • I tried myself with a password protected Shelly and to be honest: it's unsuable with the current implementation.


    But good news: I had a talk with Kiril (lead developer) from Allterco..
    the current additional digest authentication will go away from MQTT rpc channel, so you can simply use the

    mosquitto_pub -h localhost -p 1883 -u admin -P admin -t shellypro4pm-f008d1d87058/rpc -m '{"id":1, "src":"user_1", "method":"Switch.Set", "params":{"id":3,"on":false}}
    without the the additional auth params.


    Until this is getting fixed I'd recommend to temporary disable authentication within the Shelly.

    1x Shelly4ProPlus, 10x Shelly1, 7x Shelly 1PM, 2xShelly 1L, 9x Shelly 2.5, 3x Shelly2, 1x Shelly EM, 2x ShellyDimmer, 3x ShellyDimmer2, 1x Shelly 3EM, 1x Shelly4Pro, 1x Shelly Button1, 4x Shelly Duo, 1x, ShellyDuo G10, 3x ShellyVintage, 1x Shelly Bulb, 8x ShellyDuoG10RGB, 1x ShellyPlug, 2x ShellyRGBW2, 5x Shelly PlugS. 1x Shelly Sense, 3x Shelly i3, 1x Shelly Gas, 4x Shelly H&T, 1x Shelly Flood, 2x ShellyDoor&Window2, 3x TempAddon, 1x ShellyMotion

  • New Beta Version 0.8 is out, MQTT commands can be send without digest auth..


    Note: it's also possible to use custom topics :love:

    Code
    mosquitto_pub -h localhost -p 1883 -u admin -P admin -t house/livingroom/rpc  -m '{"id":124, "src":"user_1", "method":"Switch.Set", "params":{"id":3,"on":true}}'

    1x Shelly4ProPlus, 10x Shelly1, 7x Shelly 1PM, 2xShelly 1L, 9x Shelly 2.5, 3x Shelly2, 1x Shelly EM, 2x ShellyDimmer, 3x ShellyDimmer2, 1x Shelly 3EM, 1x Shelly4Pro, 1x Shelly Button1, 4x Shelly Duo, 1x, ShellyDuo G10, 3x ShellyVintage, 1x Shelly Bulb, 8x ShellyDuoG10RGB, 1x ShellyPlug, 2x ShellyRGBW2, 5x Shelly PlugS. 1x Shelly Sense, 3x Shelly i3, 1x Shelly Gas, 4x Shelly H&T, 1x Shelly Flood, 2x ShellyDoor&Window2, 3x TempAddon, 1x ShellyMotion

  • New Beta Version 0.8 is out, MQTT commands can be send without digest auth..


    Mit welchem Befehl setzt man den Wert "status_ntf=true" auf true?


    Bekomme es einfach nicht hin.


    (Geht das überhaupt mit einem einfachen http-Befehl?)


    With which command do you set the value "status_ntf = true" to true?

    I just can't do it.

    (Is that even possible with a simple http command?)

    Quote


    status_ntf: boolean, if true notifications are published on <device_id|topic_prefix>/status/<component:[id]>, false disables publishing. Default false.

    Quelle: https://repo.shelly.cloud/firm…nents/Mqtt/#mqttgetconfig



    (Arbeite mich gerade erst in MQTT ein)

    (Just getting started with MQTT)

  • Mit welchem Befehl setzt man den Wert "status_ntf=true" auf true?

    ja klar, das geht..


    Code
    curl -X POST -d '{"id":1, "src":"user_1", "method":"Mqtt.SetConfig",
     "params":{"config":{"status_ntf": true}}}' http://192.168.178.93/rpc

    oder, wenn der Shelly mit Authentifizierung konfiguriert ist:


    Code
    curl -X POST -d '{"id":1, "src":"user_1", "method":"Mqtt.SetConfig",
     "params":{"config":{"status_ntf": true}}}' --anyauth -u admin:meinpasswort  http://192.168.178.93/rpc

    Achtung: der Shelly behauptet er brauche keinen Reboot, das stimmt aber zumindest für die grafische Anzeige im Admin-Interface nicht.. ;)

    1x Shelly4ProPlus, 10x Shelly1, 7x Shelly 1PM, 2xShelly 1L, 9x Shelly 2.5, 3x Shelly2, 1x Shelly EM, 2x ShellyDimmer, 3x ShellyDimmer2, 1x Shelly 3EM, 1x Shelly4Pro, 1x Shelly Button1, 4x Shelly Duo, 1x, ShellyDuo G10, 3x ShellyVintage, 1x Shelly Bulb, 8x ShellyDuoG10RGB, 1x ShellyPlug, 2x ShellyRGBW2, 5x Shelly PlugS. 1x Shelly Sense, 3x Shelly i3, 1x Shelly Gas, 4x Shelly H&T, 1x Shelly Flood, 2x ShellyDoor&Window2, 3x TempAddon, 1x ShellyMotion

    Edited once, last by Seven of Nine ().

  • mhh, abschalten geht aber anschalten der status_ntf irgendwie nicht.. ich teste mal weiter aber das sieht irgendwie nach einem Bug aus..

    1x Shelly4ProPlus, 10x Shelly1, 7x Shelly 1PM, 2xShelly 1L, 9x Shelly 2.5, 3x Shelly2, 1x Shelly EM, 2x ShellyDimmer, 3x ShellyDimmer2, 1x Shelly 3EM, 1x Shelly4Pro, 1x Shelly Button1, 4x Shelly Duo, 1x, ShellyDuo G10, 3x ShellyVintage, 1x Shelly Bulb, 8x ShellyDuoG10RGB, 1x ShellyPlug, 2x ShellyRGBW2, 5x Shelly PlugS. 1x Shelly Sense, 3x Shelly i3, 1x Shelly Gas, 4x Shelly H&T, 1x Shelly Flood, 2x ShellyDoor&Window2, 3x TempAddon, 1x ShellyMotion

  • Achtung: der Shelly behauptet er brauche keinen Reboot, das stimmt aber zumindest für die grafische Anzeige im Admin-Interface nicht..

    Danke erstmal. Wie schon erwähnt versuche ich mich da rein zu arbeiten. Der Shelly hat kein restrict Login.


    Reboot habe ich manuell gemacht.


    Aber nach:

    Code
     curl -X POST -d '{"id":1, "src":"user_1", "method":"Mqtt.SetConfig","params":{"config":{"status_ntf": "true"}}}' http://192.168.1.183/rpc
    
    {"id":1,"src":"shellyxxxxxxxxxxxx48","dst":"user_1","result":{"restart_required":false}

    ergibt:

    Code
    http://192.168.1.183/rpc/mqtt.GetConfig

    immer noch:


    Quote
    {"enable":true,"server":"192.168.1.92:1883","user":"shelly","pass":"passwort","topic_prefix":null,"rpc_ntf":true,"status_ntf":false}

    Bestimmt ein Anfängerfehler? :/


    Edit: Unsere letzten Beiträge haben sich überschnitten.

  • Bestimmt ein Anfängerfehler?

    nee, das scheint tatsächlich ein Bug zu sein.. anschalten geht bei mir tatsächlich auch nicht, ausschalten aber schon ;) ich warte mal auf Rückmeldung der Entwickler..

    1x Shelly4ProPlus, 10x Shelly1, 7x Shelly 1PM, 2xShelly 1L, 9x Shelly 2.5, 3x Shelly2, 1x Shelly EM, 2x ShellyDimmer, 3x ShellyDimmer2, 1x Shelly 3EM, 1x Shelly4Pro, 1x Shelly Button1, 4x Shelly Duo, 1x, ShellyDuo G10, 3x ShellyVintage, 1x Shelly Bulb, 8x ShellyDuoG10RGB, 1x ShellyPlug, 2x ShellyRGBW2, 5x Shelly PlugS. 1x Shelly Sense, 3x Shelly i3, 1x Shelly Gas, 4x Shelly H&T, 1x Shelly Flood, 2x ShellyDoor&Window2, 3x TempAddon, 1x ShellyMotion

  • AUS ist doch der Standardwert.


    Wie hast Du den Status EIN denn zuvor hinbekommen? :/

  • in der GUI.. Firmware 0.8 Beta2


    pasted-from-clipboard.png

    1x Shelly4ProPlus, 10x Shelly1, 7x Shelly 1PM, 2xShelly 1L, 9x Shelly 2.5, 3x Shelly2, 1x Shelly EM, 2x ShellyDimmer, 3x ShellyDimmer2, 1x Shelly 3EM, 1x Shelly4Pro, 1x Shelly Button1, 4x Shelly Duo, 1x, ShellyDuo G10, 3x ShellyVintage, 1x Shelly Bulb, 8x ShellyDuoG10RGB, 1x ShellyPlug, 2x ShellyRGBW2, 5x Shelly PlugS. 1x Shelly Sense, 3x Shelly i3, 1x Shelly Gas, 4x Shelly H&T, 1x Shelly Flood, 2x ShellyDoor&Window2, 3x TempAddon, 1x ShellyMotion

  • so, Rückmeldung von Andrey und Kiril, es geht beides (wenn man es richtig macht ;) )
    war mein Fehler, korrekt sollte es so aussehen (hab den Beitrag weiter oben auch mal editiert)


    Code
    curl -X POST -d '{"id":1, "src":"user_1", "method":"Mqtt.SetConfig",
    "params":{"config":{"status_ntf": true}}}' http://192.168.178.93/rpc

    Entscheidend: das true darf nicht in Anführungszeichen stehen, denn es ist JSON Boolean und kein String..

    1x Shelly4ProPlus, 10x Shelly1, 7x Shelly 1PM, 2xShelly 1L, 9x Shelly 2.5, 3x Shelly2, 1x Shelly EM, 2x ShellyDimmer, 3x ShellyDimmer2, 1x Shelly 3EM, 1x Shelly4Pro, 1x Shelly Button1, 4x Shelly Duo, 1x, ShellyDuo G10, 3x ShellyVintage, 1x Shelly Bulb, 8x ShellyDuoG10RGB, 1x ShellyPlug, 2x ShellyRGBW2, 5x Shelly PlugS. 1x Shelly Sense, 3x Shelly i3, 1x Shelly Gas, 4x Shelly H&T, 1x Shelly Flood, 2x ShellyDoor&Window2, 3x TempAddon, 1x ShellyMotion

  • Super. :)


    Danke Dir. :thumbup: :thumbup: :thumbup: