Getting Sonoff SNZB-01 to work locally

Hello everyone,

After a few months tinkering with wifi devices, I decided to buy an Aeotec SmartThings Hub and start working with zigbee and Z-Wave.

I recently bought (and likely ruined, idk) a Philips Hue bulb, connecting it directly to the Aeotec Hub (so without the Hue Bridge… this may be bad, but it works for now) and then I bought this button to control it.

I installed a Device Handler, this, manually setting it in place of the generic “Ikea Button” I got before, so that it would run locally, and it seems to work. It’s recognized, I am able to detect the battery level, when it’s pressed, all is cool.

If I use the button to control one of the old Wifi bulbs I had, so going through Smart Life, it works perfectly. It also works if I set the Ikea Button as Device Handler, which causes the entire button to work on cloud. However, once I use it to control the Philips Hue bulb, with the custom DH and hence only running locally, it doesn’t.

The hub isn’t too far from the Bulb, it’s in another room but the rooms are next to each other with a large door that is almost always open inbetween. They are roughly 5-10m or so apart.

My newbie brain tells me that if it works on cloud, but not locally, despite the presses being detected, then the issue is not of the button itself or how it’s set up, but I may be wrong.

Any clues as to why? Thanks in advance, and I hope this topic was relevant to the category!

Sorry, I’m confused. :thinking:

At the present time, all custom Groovy DTHs run in the cloud. They are not eligible to run locally.

Many of the stock groovy DTHs (the ones written and distributed by Samsung itself) do work locally. And custom edge drivers can work locally. But not custom Groovy code.

So I’m having a hard time following the description of the problem.

As far as connecting a hue bulb directly to a Samsung/Aeotec hub, technically you can but neither company will support it because it will tend to mess up your Zigbee Network as it is an unreliable repeater. See the community FAQ code.

FAQ: Do I need the Hue Bridge/Hub to Use a Hue Bulb with SmartThings?

1 Like

I am not sure then. The first time I added it, it was unpublished and said it ran on cloud. Then, I published it for myself, and now it says it runs locally. I really am not sure on what’s happening, I am absolutely new to all of this.

As far as the bulb, I simply scanned with the SmartThings App to see if it would be detected, I didn’t know it would automatically pair. Is there any way to fix this? Like, if I were to buy a bridge, would it be recognized by it? Or perhaps using a different DH?

Sorry about the massive confusion, and perhaps it’s not even relevant in this context, but as you can imagine moving from “Alexa turn on the lights” to DHs, Smart apps, zigbee, ZHA, ZLL… it’s… quite confusing ^^"

1 Like

No problem, you’re doing fine. Welcome to the Rabbit Hole! LOL! :sunglasses:

As far as the hue bulb, you would need to delete it from your account, then add it to the hue bridge, then add the hue bridge to your smartthings account. If it was me, I would, but that’s just me. I would always be nervous about a potential network issue. A lot of people, though, would leave it in place until they started having problems and then change it at that point if they needed to. So it’s up to you.

So let’s just take a couple steps back and look at the problem you are having.

As I understand it, have a sonoff zigbee button, and you are using the Darren Blanchard custom DTH for it.

If you create a SmartThings routine, it will then work with a Wi-Fi bulb that you have linked to your smartthings account through SmartLife integration, is that correct? Could you post a screenshot of that routine?

But if you create another smartthings routine so that the button triggers turning on the hue bulb, the bulb does not turn on? Could you post a screenshot of that routine as well?

Then we can start figuring out what’s going on.

Also, does the hue bulb turn on and off just from the smartthings app?

1 Like

Okay, so.

Bulb: I read that once I pair it with the Aeotec Hub, it permanently changes the Zigbee protocol from ZLL to ZHA and this is permanent, unless you do some… complicated reset techniques which I didn’t understand.
If buying a bridge is all I need to do to make it work fine again, I probably will, though it’s also up to how much into Philips Hue I want to get, I didn’t think you’d require a bridge because of this video, at 0:25. But I digress.


This is the screenshot of the “Local” routine. The wifi bulb version is identical, except I’m using the wifi bulb instead of the Philips Hue bulb. It’s in Italian, “Interruttore Lampada” is the Sonoff Zigbee Button with a custom name, and the action is “Activate or deactivate”, which I assume in English would be better said as something like Turn on or off.

This one right now is with the Ikea Button DTH, so that it would work in the meantime, but the Darren Blanchard custom DTH routine is identical, too.

As far as controlling the Bulb from the SmartThings App, yes, it works just fine, I can also adjust hue and brightness.

Also, if I create a routine where I use the Darren Blanchard custom DTH, but instead of turning on/off just the Hue bulb I also turn on/off one of the Wifi bulbs, then both bulbs are turned on/off. So, I assume the issue is running locally vs running on cloud, but that’s just my very unexperienced and confused assumption.

Thanks again for all the help you’re providing!

1 Like

On line 21 in Darren Blanchard’s code there is an error. It says “runLocally: true” but it should read “runLocally: false”. As @JDRoberts said above custom DTH can not run locally. This can mess things up, so you should change it.

2 Likes

Oh, I see! Though, is there any way to run this Zigbee Button locally then?
My understanding of why hubs with zigbee and/or z-wave are better than simply using wifi alternatives is that they run locally, and are hence faster and more secure… so, if it runs on cloud… what’s the point?

I run it using an Edge Driver instead of the DTH, so it runs locally. See the following for a link to the driver.

1 Like

Both zwave and Zigbee are networking protocols maintained by independent third-party organizations, and you are right, both were originally designed assuming that they would run locally.

But it’s up to each hub manufacturer to decide exactly what, if any, cloud components they will include.

Back when smartthings was first designed, they made the decision to put almost all of their architecture in the cloud. I don’t think they’ve ever publicly discussed why, but it’s what they decided to do. (Now, however, they are transitioning to a new version of the architecture which will run much more locally.)

Anyway, even in a design like smartthings, there are still some significant advantages to Zwave or Zigbee versus Wi-Fi for home automation. The most obvious is that Wi-Fi uses way more power than either of those, maybe 10 times as much, which is why you see so few battery powered Wi-Fi sensors and handheld remotes. Up until about a year ago, a typical Wi-Fi sensor would need new batteries every two or three months as opposed to a Z wave or a Zigbee sensor with the same capabilities that probably wouldn’t need new batteries for a year or two.

There are some advances being made in power management for Wi-Fi that are just starting to come onto the market now, but not many devices available to take advantage of them yet.

The power advantage would apply to anyone, even someone with just two or three devices.

Another advantage for people with more complex systems is that both zwave and Zigbee can handle more individual devices than a typical home Wi-Fi network. If you expect to use between 100 and 200 devices, zwave or Zigbee can usually handle those easily, but you might need a special and more expensive Wi-Fi router to go above 50 or so.

But the main advantage is the power draw, and that applies whether it’s a cloud-based system or local. :sunglasses:

It wasn’t a permanent change, and it was about the channel rather than the profile, but it was a significant issue back in 2015 or so when the smartthings hub used the ZHA profile for Zigbee. However, by 2019 smartthings hubs (and the aeotec hub that came later) used the Zigbee 3.0 profile, and so do the Phillips hue bulbs. So that part is no longer an issue, fortunately.

I see, though it’s quite a bit more expansive to buy the items themselves, at least from what I’m seeing, though it might just be that I don’t know where to look haha. Either way, I think going for a hub for more advanced things was the right call, I doubt I’d have as much control with Wifi devices, or so I was told.

As for the bulb, I didn’t know things had changed, that’s good, and quite a relief I must say. That means that, theorically, I could buy as many Philips hue bulbs as I’d like, and only later buy the bridge if I wanted to expand even more? Cause it seems rather silly to buy the bridge for one or two bulbs… is it such a big deal?

Uhm… sorry for the I imagine incredibly basic question, but… what is an Edge Driver? I only knew of DTH (or DH as I previously called them… what does the T stand for?) and Smart Apps ^^"

DTH = Device Type Handler. Part of the original smartthings architecture written in the groovy programming language. See the old community FAQ for more about those and smartapps and Terminology.

All of this will be replaced soon in the new architecture. Instead of DTHs in groovy, there will be Edge Drivers written in the Lua programming language. And the biggest change is that the edge drivers will run on the local hub, not in the cloud. Here’s the official announcement on those:

Oh, I see. So, if I’m understanding this correctly, now a lot more things are going to run local, and to use the Edge Driver suggested above by Paul Oliver I should simply create a new DTH and use the LUA code instead? Or is there another procuedure that I need to follow?

No….Edge Drivers are written in the LUA programming language and will be used instead of a DTH but the architecture and the process is completely different.

In order to use an edge driver, you subscribe to the author’s channel by following a web link. Then you scan for nearby devices using the smartthings app and it should find the edge driver and automatically use it. So the whole idea is to make it much easier than the previous DTH method.

Because the edge driver has to be downloaded to your own hub, it can take some time before it shows up there, I have heard in some cases as much as 12 hours, but I don’t know for sure.

If you have any questions about a particular edge driver, you should ask in the author’s discussion thread in this forum.

But yes, the good news is that the edge driver will run local, they run on your own hub.

1 Like
  1. Follow the Channel Invitation in link in the I attached above and install the driver “RGD - Zigbee Button”.
  2. Either delete the custom DTH that you installed for the Sonoff Button or comment out the fingerprint (put // before fingerprint) in the custom DTH.
  3. Add new device by running Scan Nearby.
  4. make sure the button in near your hub.
  5. The device will appear in room not assigned.
1 Like

Theoretically, absolutely not. Use hue bulbs with a hue bridge and the official integration.

In practice, some people do use the bulbs without the bridge, it’s your choice.

All the details are in the FAQ that I already linked to so just read that if you want to know more.

2 Likes

Should I delete the one I currently have? I read that sometimes you have to keep it twice or something like that

I see. Thanks so much! So now I can use either DTH or an Edge Driver based on the device and my needs?

For now, yes.

Groovy DTHs Will stop working sometime soon (originally they said the end of 2020, but obviously we’re past that now). But edge drivers are still in beta and can be a little glitchy so a lot of people are willing to wait until the changeover is official. Again, your choice. :sunglasses: