Page 1 of 1

Shelly PRO 2PM not recognized as device

Posted: Tuesday 17 January 2023 1:49
by jrachwol
I installed the latest version of Shelly MQTT.
After Shelly MQTT hardware configuration, the Shelly PRO 2PM does not appear on device list.
On the hardware list there is no port number for Shelly MQTT.
"Shelly MQTT" is configured with 127.0.0.1:1883, the same as "MQTT Client Gateway with LAN interface".

What is possible to do with that?

Re: Shelly PRO 2PM not recognized as device

Posted: Sunday 29 January 2023 1:29
by mk01
jrachwol wrote: Tuesday 17 January 2023 1:49 What is possible to do with that?
your device is gen2 device. check this topic - 3,4 last messages.

viewtopic.php?p=297821#p297821

mk

Re: Shelly PRO 2PM not recognized as device

Posted: Monday 08 May 2023 15:46
by Huib
Hi, have you been able to solve the problem with the Shelly Pro 2PM shutter switch and Domoticz?

Thanks.

Re: Shelly PRO 2PM not recognized as device

Posted: Sunday 09 July 2023 9:48
by lwolf
Huib wrote: Monday 08 May 2023 15:46 Hi, have you been able to solve the problem with the Shelly Pro 2PM shutter switch and Domoticz?
https://github.com/enesbcs/shellyteacher4domo/issues/13

Re: Shelly PRO 2PM not recognized as device

Posted: Saturday 19 August 2023 12:54
by Xavier82
I got it fixed with this script code (which needs to be entered in ShellyPlus2PM script:

Code: Select all

let CONFIG = {
  shelly_id: null,
};

Shelly.call("Shelly.GetDeviceInfo", {}, function (result) {
  if (result && result.id) {
    CONFIG.shelly_id = result.id;
    MQTT.subscribe(
      buildMQTTStateCmdTopics("rpc"),
      DecodeDomoticzFaultyJSON
    );
  } else {
    console.log("Failed to get Shelly device info:", result);
  }
});

function buildMQTTStateCmdTopics(topic) {
  let _t = topic || "";
  return CONFIG.shelly_id + "/" + _t;
}

/**
 * @param {string} topic
 * @param {string} message
 */
function DecodeDomoticzFaultyJSON(topic, message) {
  try {
    let trimmedMessage = message.trim();
    if (trimmedMessage) {
      let req = JSON.parse(trimmedMessage);
      for (let r in req) {
        if (r.indexOf("GoToPosition") !== -1) {  // Check if "GoToPosition" is present in the key
          SetCoverPosition(req[r]);
          break;
        }
      }
    }
  } catch (error) {
    console.log("Error parsing JSON:", error);
  }
}

function SetCoverPosition(position) {
  Shelly.call("Cover.GoToPosition", {
    id: 0,
    pos: position,
  });
}
This works on ShellyPlus2PM firmware 1.0.0

Blind/Cover devices are being detected in Domoticz when using ShellyTeacher4Domo.
Keep in mind that you need to add the devices through Users \ set devices in Domoticz V2023.2 to be able to see them as device.
With this script also able to control cover with slider in Domoticz.
Devices are being updated based on MQTT.

Re: Shelly PRO 2PM not recognized as device

Posted: Thursday 02 November 2023 10:00
by ella5
How to fix the Shelly PRO 2PM not being recognized as a device in Domoticz using the ShellyPlus2PM script? I would be very happy if you could let me know, thanks

Re: Shelly PRO 2PM not recognized as device

Posted: Tuesday 07 November 2023 17:26
by lwolf
ella5 wrote: Thursday 02 November 2023 10:00 How to fix the Shelly PRO 2PM not being recognized as a device in Domoticz using the ShellyPlus2PM script? I would be very happy if you could let me know, thanks
You have to use ShellyTeacher script.
https://github.com/enesbcs/shellyteacher4domo

There is a video about it:
https://www.youtube.com/watch?v=3PvYhFIsVN4

In case you also need ShellyPlus2PM position device, you need Domoticz 2023 beta 15601 or later and enable "MQTT Control" option at the Shelly device side.
https://github.com/enesbcs/shellyteache ... r-Position