Integration of Sense and Shelly Energy Monitoring Relays

Last year I wrote several articles for Residential Tech Today on Sense and have been a Sense owner ever since. I just finished writing an article for Residential Tech Today on Shelly’s (https://shelly.cloud/) product line of IoT relays; many of which include energy monitoring. Shelly relays are very small, inexpensive, and they can easily be fit inside of an electrical box. I believe the integration of these devices with Sense would be of great benefit to Sense owners.

While many of Shelly’s relays have internal power monitoring, the Shelly EM has two inputs for current transformers so it can be used to monitor the power being consumed by either two 120 VAC devices or one 240 VAC device.

Shelly’s relays with internal energy monitoring circuitry (the Shelly 1PM and Shelly 2.5 for example) could be used with devices like irrigation controllers and garage door openers that may be directly wired into an electrical box. They are also less expensive than the Shelly EM. In fact the Shelly 1PM is only $17 on Amazon.

Over the last year I have watched community posts by Sense owners who have issues with their dryers, pool pumps and some other appliances not being recognized properly, or at all, by Sense. The Kasa energy monitoring smart plugs solve many of these problems but for 240 VAC devices, or devices that are directly wired into a circuit and not plugged into an outlet, the Shelly EM, or one of the other Shelly relays with internal energy monitoring, is an ideal solution.

Shelly provides both a local REST API and a cloud API for communicating with their products. As part of the article I wrote, I developed a smart home driver that communicates with these Shelly products using the local REST API. To retrieve the power from a Shelly EM is as simple as sending the following http request:

“http://” + Device_IP + “/emeter/” + Channel + “/power”

Or, if the device is password protected

“http://” + Username + “:” + Password + “@” + Device_IP + “/emeter/” + Channel + “/power”

In the above http requests, Channel is either 1 or 2 depending on which current transformer you want to read the power from.

For those that are interested in learning more about these Shelly products you can find the article I wrote here: Shelly Offers Easy-to-Use Products for the DIY and Pro Smart Home

Hopefully others will agree that there would be great benefit to Sense owners if Sense integrated with Shelly’s line of energy monitoring relays.

Thanks

9 Likes

I think several Sense users have used Shelly EMs together with the open source SenseLink code to provide 240V power usage data to Sense. From a Sense perspective, Shelly EM + SenseLink looks like a TP-Link smartplug. The most recent success I have seen is @mattlebaugh , here:

For the intrepid, here’s the link the SenseLink code:

1 Like

Yup Shelly EMs can be easily used to monitor any circuit I currently have 5 monitoring all my 220 circuits. Shelly EM -> MQTT -> Senselink -> Sense. It works surprisingly well.

I would highly recommend them due to the price and ease of use.

1 Like

Man. This is not a rabbit hole I need to be going down right now :grinning:

Not a rabbit hole I want to go down either. Ideally Sense could have a native integration with Shelly EM.

Or if the rabbit hole were very shallow, like “just buy this other $20 device on Amazon, connect it to your LAN, no other configuration/SW necessary, it it will bridge Shelly EM to Sense”.

4 Likes

Just wondering if this integration is still working.

I have a decommissioned pair of Synology RS815+. I plan on setting up Home Assistant on the NAS cluster.

Yup, still running strong. Don’t really even need a home assistant if you just are trying to get shelly em to sense. Just an mqtt server and senselink.

1 Like

Excellent. Thanks.

I’m running HOOBS right now to integrate some Non HK devices with HomeKit.

I’m not sure how to add senselink to HOOBS, it does have MQTT.

I’ll dig around, hopefully taking a vacation soon and will get some time to research and tinker.

I suspect it’s actually a little more difficult that you’d think at first glace. Here’s how the kasa implementation works (I don’t know much about the wemo integration, but I think it’s the same).

Sense sends out a single multicast every 2 seconds and every plug on the network responds. This is also how Sense discovers new plugs on the network pretty much immediately with no input from the user.

  • Because of this, Sense does not need to keep track of any IP addresses.
  • I suspect there might be timing issues if Sense has to poll multiple devices individually.

It would be pretty cool if these could be integrated into Sense directly. I think an easy way to get data from 220v devices is a big wish list item for a lot of people, and if you’re like me and have solar, using DCM isn’t an option. I’ve been considering setting up a Pi for HA anyway, so I think I may get some of these Shelly devices and go that route.

1 Like

Shelly devices have “url actions” where the IP address of another device can be specified and the Shelly device will send updates to that IP address. Unfortunately, the EM has url actions for events such as its internal relay being turned on/off but not for changes in power readings. I have requested to Shelly that an additional url action be added for power updates but it hasn’t happened yet.

According to the Shelly API documentation the EM does support MQTT. I’m not well versed in MQTT so I’m not sure if that would be a better route for integration of the EM with Sense. MQTT is used for integration of Shelly devices with Home Assistant.

Hope this helps.

Hi, did you have any luck getting Sense to work with Hoobs? I just tried installing it the other day - there were two plugins. I tried the one that looked like it was actually being supported but nothing happened - no devices etc.

This is a bit of a noob question. I wanted to try the senselink software, but I can’t figure out how to get it running on my raspberry pi. Any suggestions would be helpful.

@ben.burbank I wrote SenseLink - free to PM me and I can possibly help out! You can run it directly as a Python script or use the Docker container. The Docker container is nice in that’s it’s all self contained (assuming you already have Docker set up), and is easier to run as a background “service”.

3 Likes

Does senselink work only for the Shelly EMs or does it also work for Shelly PM?

Hey @nancefamilytech - while it doesn’t integrate directly with any Shelly-specific API, if you can publish the power usage to MQTT from a Shelly you can do it that way. As far as I know that’s totally doable!

I also recently added the ability to drill down through JSON that’s published to MQTT, which I think is the way Shelly does it. See this issue for the explanation, as I still need to update the documentation

1 Like

Who can walk layfolk through the Senselink installation and making Shelly EM devices report through Sense?

Maybe there’s a Youtube video I’m missing?

I’ve successfully assembled and installed some Shelly EMs, installed my own Sense device, and use Home Assistant in a fairly primitive way, but I’m discovering that this is a few too many steps for me to figure out on my own.

If you have Home Assistant then you can use the integration: Emulated Kasa - Home Assistant which directly uses SenseLink. You have to configure it in the configuration.yaml, but it’s pretty easy

1 Like

I appreciate that.

I can’t figure out how to get the repository installed through HACS custom repositories. I’m an Amateur, apparently.

I’m there at the github emulated_kasa page.

Maybe I don’t know how to correctly enter a Repo path?

emulated_kasa is a built-in integration, but it’s not configurable through the UI, you need to edit the configuration.yaml file as described on the page I linked

1 Like