Shelly1PM - MQTT Information

(Alex) #1

Hi,

because I just received my Shelly1PM (Power Metering) shipment, I wanted to add them via MQTT to my openHAB. Unfortunately, the official API documentation is not up to date right now.
https://shelly-api-docs.shelly.cloud/

So I poked around and it took me some time but I managed to get the information through MQTTLens so that I can hopefully help someout out there who doesn’t want to dig for this information.

The Shelly1PM publishes the following information to the Broker:

shellies/shelly1pm-/relay/0/power
Power-Reading as Number

shellies/shelly1pm-/relay/0/energy
Energy-Reading as Number

shellies/shelly1pm-/temperature
Internal Temperature as Number

shellies/shelly1pm-/overtemperature
Overtemperature-Warning as Number (0 and 1)

shellies/shelly1pm-/relay/0
Switch-Status as String

As of now I could not properly figure out how to toggle the switch-status. The Shelly v1 requires lowercase “on” and “off” as strings published to it but this 1PM doesn’t seem to like that. Maybe someone has it working and can chime in on this one?

The overtemp-information can be redirected into a Switch-Command. You only need to add the custom_on and custom_off values in PaperUI when you set the Channel up.

Hope this helps someone out in order to get their setup working.

Edit: Corrected the temperature and overtemperature strings accordingly.

1 Like

(Rolf Vermeer) #2

I believe that should be at the device level, so shellies/shelly1pm-xxxxxx/temperature.

Via shellies/shelly1pm-xxxxxx/relay/0/command as the command topic.

0 Likes

(Alex) #3

Ah yes - sorry that was my bad. I forgot to edit the pasted lines here. Yes it is on the device level and not under relay.

For the toggle-switch: I tried it with the /command just like my shelly v1 and send an on or off but it doesn’t like that.
Right now I don’t want to mess with it because the attached dishwasher is running. Will update this thread if I find something new :slight_smile:

0 Likes

(Hervé Pernet) #4

Hi,

Did you find a way to send command to your shelly1pm?

I have the same problem with my shelly1pm. I cannot figure out how to switch it on and off

Thanks

0 Likes

(Rolf Vermeer) #5

What part of my answer above exactly is not working for you?

0 Likes

(Hervé Pernet) #6

I tried to replicate the command of the shelly1 for the shelly1pm using:
shellies/shelly1pm-xxxxxx/relay/0/command with on and off commands but it’s not working.

0 Likes

(Rolf Vermeer) #7

How did you set it up? Via PaperUI or via thing/items file?

0 Likes

(Hervé Pernet) #8

Updating the files directly.

Here is my setup:

mqtt.things

Bridge mqtt:broker:mosquitto "Mosquitto" [ host="127.0.0.1", port=1883, secure=false, username="herve", password="xxx", clientID="openHAB2", qos="1"]
{

  // Shelly 1 24D663 - IP 192.168.1.70
  Thing topic Shelly1_24D663 "Shelly1_1" @ "Test" {
   Channels:
     Type switch : power "Power" [ stateTopic="shellies/shelly1-24D663/relay/0", on="on", off="off", commandTopic="shellies/shelly1-24D663/relay/0/command", on="on", off="off" ]
 }


  // Shelly 1 PM 608CD1 - IP 192.168.1.72
  Thing topic Shelly1PM_608CD1 "Shelly1PM_1" @ "Test" {
   Channels:
     Type switch : power "Power" [ stateTopic="shellies/shelly1pm-608CD1/relay/0", on="on", off="off", commandTopic="shellies/shelly1pm-608CD1/relay/0/command", on="on", off="off" ]
 }
}

shelly.items

Switch Shelly1_24D663_MQTT "Shelly 1_24D663" {channel="mqtt:topic:mosquitto:Shelly1_24D663:power"}
Switch Shelly1PM_608CD1_MQTT "Shelly 1PM_608CD1" {channel="mqtt:topic:mosquitto:Shelly1pm_608CD1:power"}

It’s working well with the shelly1 using the switch “Shelly1_24D663_MQTT” but not for the shelly1PM

0 Likes

(Rolf Vermeer) #9

Not sure if this is going to solve it (I do not use textual configuration for MQTT), but your Thing definition has 1PM while the item has 1pm as channel name. Might very well be case sensitive.

0 Likes

(Hervé Pernet) #10

OMG!

It was as simple as that.

It’s clearly case sensitive…

Thank you so much Rolf!

0 Likes