Zigbee Development – The Really Big Update inc ZZH

Sonoff Dongle

Some time ago I wrote about the Sonoff inexpensive Zigbee dongle and various Zigbee hubs etc. At the time I was experimenting with HA (Home Assistant) and a load of other new things and didn’t really give Zigbee the attention it deserved. In here I then came back to Zigbee with a vengeance, armed with the latest v3 Sonoff USB Zigbee dongle (which costs just a few €/£/$) and with Zigbee2MQTT on my RPi4 (out of the box). I’d originally left the dongle in a cupboard – so I yanked it out – and updated the firmware to the latest, not expecting a lot at first.

This time around I DO have actual uses for battery powered temperature sensors and a light sensor…. the wife won’t let me put wires in the bathroom and we have a heater in there which works on a simple timer (Spain has moved to 3 charging zones for electricity) regardless of whether it is needed or not. I also want the heater to come on only if the bathroom is cool. Finally I had a couple of cupboards sharing ONE supply and switch – can’t be having that.

Sonoff Zigbee Smart Switch
Sonoff Zigbee Smart Switch

I should start by saying my knowledge of Zigbee is (was) very low – I found the zigbee2mqtt topics page really useful. I plugged in the Sonoff Zigbee dongle to my Raspberry Pi 4 (RPi4) and using Node-Red as my preferred platform to get MQTT access, checked out the dongle. It worked no problem but would not talk to the little Sonoff SNZB-02 temperature sensor (which simply reports temperature and humidity from time to time).

Well, it did but not reliably – or so I thought. It turns out there were three issues:

First and foremost there’s an issue that the RPi4 tends to interfere with Zigbee communications – I didn’t know this. Armed with that info, I put the Zigbee USB dongle on the end of a 2 metre USB extension lead – “problem one” sorted.

CR2450 Lithium Battery
CR2450 Lithium Battery

The battery in the SNZB-02 sensor was low – and also I was assuming fixed period reporting – wrong.

I sent off to Amazon for replacement 2450 Lithium batteries and inserted one into the SNZB-02. Partial success. The sensor now started responding – but not regularly – that’s when I twigged – the sensor reports when there is a change – not just for the sake of it – just breathing on it is enough to elicit a response. Now I was excited – but I’d already realised that Zigbee, like WiFi, has only limited range – and I remembered I had a Sonoff BASIC Zigbee device lying around. Some mains powered Zigbee devices like this, act as mesh nodes and can increase range. Problem sorted.

Now I was cooking…. from my Node-Red RPi4 installation I could read this horrendously-named temperature sensor and get reliable data. At that point, I took the time to read up on Zigbee and realised you can rename devices which I now do in all cases to give useful names. I’m quite happy using MQTT but I noted node-red-contrib-zigbee2mqtt and installed it in Node-Red. Why? Because it draws a pretty and very useful MAP which instantly increased my understanding of Zigbee and how to make life easy.

Zigbee MAP
Zigbee sensors

By now I’d added two more Sonoff sensors – a button and a window-sensor. Was this going to be another interesting but ultimately fruitless experiment?

Well, the map made it easy to remember which device is which so I could then easily rename and check devices. That helped a LOT.

As for Sonoff ZNB-01 buttons – here’s what you get in the payload once you have paired them with the “Zigbee coordinator” i.e. the dongle (5 seconds+ pressing the internal reset button):

action: “single”
battery: 100
linkquality: 117
voltage: 4100

“single” could also be “double” or “long” – the “long” message doesn’t appear for a while – I prefer the way the Aqara button does it with “hold” and “release” – but then – depending on postage and where you live, the Sonoff product might be the less expensive.

Next, I had a Lidl RGBW Zigbee lamp lying around from the FIRST time I attempted to use Zigbee – so I added this in – GREAT.

At that point I was dragged out of the house to go shopping. Back to Lidl – and would you believe it – they had some “Zigbee 3” hardware on special offer including a 3.6KW smart socket for a stunning €3.50 – could that be any good? Lidl Silvercrest smart plug is the official name and YES, it retains it’s power status on power cycling and yes it acts as a mesh repeater (router) – what a bargain (sadly they were all out of discount stock next time I went to the store – this was back in July 2021 – it is now mid-September and sadly, they’ve not had any Zigbee bargains since.

My test Lidl Zigbee lamp
My test Lidl Zigbee lamp

The Lidl plug WORKS. The Ikea Zigbee hardware that I’ve tried, works with this arrangement as well.

I don’t know how clear the map above is to you, but you should be able to see the coordinator in RED and note that the Sonoff BASIC Zigbee and the Lidl light and plug are absolutely forming a mesh – I’ve no idea yet why the little contact sensor on the bottom right of the map has no “wires” connecting it (on the map) but trust me – it works. Also, if I temporarily unplug the BASIC controller, the network reconfigures itself – it is all working marvellously well.

Obviously, battery powered devices don’t act as range extenders – that would be daft. Some of my Zigbee devices are in my office but I have the Sonoff smart plug and temperature sensor in the bathroom through a doorway and two walls and I now have an AQARA temperature/humidity sensor upstairs in a bedroom – see the PART 2 blog entry which concentrates on Aqara Zigbee sensors and this entry in which I rave about the Aqara Zigbee battery powered, connection-freewall switches which are in constant use use controlling my office and living room RGBWW lights.

Zigbee Smart Plug and temperature sensor

In each case, simply long-pressing either a reset button or the control button (see bathroom smart-plug – manual on-off on the top – which also reports back any change of state) allowed the device to automatically be added into the network (you can turn that off in the gateway but for now I’m keeping things simple).

Node-Red has another contributed node set for Zigbee – I’ve noted it but at this time I’m happy using MQTT directly – worth looking at though.

I’m still getting to grips with updating the devices by OTA – it seems that none of my devices support OTA updates.

Sonoff ZBMINI

I’ve just now added a pair of Sonoff ZBMINI devices – simple. Here’s my flow page for the new Zigbee devices in Node-Red. At the top, the dongle – you can see on the status, the last thing it did was pair a device. Those ZBMINI devices have a pairing/toggle recessed button on the top – you can use that at any time as long as pairing is activated in the coordinator, There is also a pair of contacts (see grey connectors above) which act as a switch.

Right now the only device that is giving me any trouble is the Sonoff snzb-03 movement sensor – in that top node I can see any movement in the logs – but I can’t seem to read it in MQTT – of course it is entirely possible I’ve made a mistake somewhere.

Node-Red flow page for my Zigbee devices

For now I don’t yet know how to get any of these Zigbee devices to appear in Alexa. No doubt that’ll come.

And another link – one of the many useful compatible devices for Zigbee2MQTT – thanks to subscriber Gary for that.

Update June 9, 2021 – Livarnolux and ZBMini

Just hit my first snag – looking for feedback – already had some. You’ll note I’ve fitted a LIDL Livarno Lux RGB E27 lamp…. here’s the problem – I can turn it on and off via MQTT directly or using a little Sonoff Zigbee button… no problem… but… if I turn it OFF, then remove power to the lamp and re-apply – it always defaults to ON after applying power – unlike their PLUG as mentioned above.

Not sure what I’m supposed to see but when I remove power from the lamp – and turn it back on – I’m not seeing any debug data – in fact any data from the zig node or the lamp node… but as soon as power is re-applied, the lamp turns on instantly (then of course I can turn it on or off by MQTT – but I need it to retain it’s last state when power is cycled)… I do this all the time with Tasmota’d normal WiFi smart lamps…. so this is completely new to me.

It gets worse… My Sonoff ZBMINI-2 – on power up – THAT defaults to OFF. Again in the info I can get from the MQTT status (looking at the whole message) I’m seeing nothing about power up default states.

For these two items to have DIFFERENT power up default states seems ridiculous yet from feedback to date, it seems this kind of behaviour is not unusual in the world of Zigbee?

Update June 15, 2021 – Still using the Sonoff Zigbee Dongle but continuing to learn

Zigbee2mqtt (which I’m running on a Raspberry Pi) now has a UI (with light and dark modes – comes up in a browser on my PC). I added the following to my (Raspberry Pi 4 – based) /opt/zigbee2mqtt/data/configuration.yaml (text) file.. it creates a map, shows devices, allows some configuration.yaml alteration without getting your hands dirty…

experimental:
  new_api: true
frontend:
  port: 9099

Another possible addition to comms if needed (and it IS needed for the Electrolama dongle shown further down:

advanced: 
  rtscts: false

And in a browser – in my case the local address of my RPi4… 192.168.1.19:9099 (that port can be changed). What other customisations specials do I yet have to discover…

Some Sonoff Links:

snzb-02:
sonoff basic:
zbmini:
snzb-03:
sonoff sensor:

I’ve just had a couple of Aqara buttons and an Aqara temperature sensor arrive, paired, renamed, working. Need to check range and of course battery life will take ages to determine.

Aqara sensors
Aqara sensors
Zigbee temperature and humidity sensor

The tiny CR3032-powered Aqara Atmos temperature, humidity and pressure sensor SWDCGQ11LM – no mention of pressure anywhere – but trust me it’s in the array of items in the payload – see below.

battery, humidity, link quality, pressure, temperature, voltage

Good size, once it has been running for a while I’ll report back on battery life. I’ve also ordered more of these.

This page, for me is also very useful – devices compatible with Zigbee2mqtt.

Let me show you the state of my two zigbee-button-and-NR-dashboard-controlled cupboard lights as of Jun 14, 2021. I gave up on Zigbee lights as the only one I had spare was full RGB (a waste for a cupboard) and defaults to ON – how dumb is THAT.

So, first things first, I put a couple of Sonoff ZB-MINI controllers behind one of the light fittings and a couple of Aqara buttons () from Banggood on the wall (these buttons are supposed to work only with the Aquara multi-functional hub but are working just fine with Zigbee2MQTT. Then there was the problem of how to achieve local control by EITHER the button OR my phone (so I could turn off the lights in bed (or at a distance (using NR Dashboard on my phone) when reminded I’d left them on).

If you look at the code below, you could be forgiven for asking why the delay nodes – well, all I can say is without them I was getting unreliability in state control. It could also be that I cloned the gloryhole node to the washroom without resetting node-Red – that’s been known to cause problems in the past. Anyway, here goes…

The light blue nodes above are NR-Dashboard buttons. The purple nodes are MQTT (in and out), the ORANGE nodes are Zigbee nodes (I could have used MQTT just as easily) and the light-brown nodes are Node-Red function nodes. Sticking with the washroom (the two sets are virtually identical) – firstly the function node on the button input – I entered …

if (msg.payload.click=="single")
{
  msg.topic="zigbee2mqtt/zbmini-2/set";
  msg.payload={"state":"TOGGLE"};
  return msg;
}

Then the function node after the incoming MQTT status of the ZB-MINI…

node.status({fill:"blue",shape:"dot",text: "Washroom " + msg.payload.state + global.get("handyDate")});
msg.payload.myIcon="fa-power-off fa-3x";
if (msg.payload.state=="ON") msg.payload.back="green";
else if (msg.payload.state=="OFF") msg.payload.back="black";
flow.set("washroom",msg.payload.state);
return msg;

And the function node on the output of the ZB-MINI node…

if (flow.get("bathroom")=="OFF")  msg.payload={"state":"ON"};
else if (flow.get("bathroom")=="ON") msg.payload={"state":"OFF"};
node.status({fill:"blue",shape:"dot",text: msg.payload + global.get("handyDate")});
return msg;

Node-Red properties dialog

Finally the settings in the washroom NR button node. I hope this is useful to anyone playing with Zigbee,

As you can see instead of a fixed icon, I’m programming that in (didn’t need to in this case) as with the background colour – green for ON, black for OFF.

This happens regardless of whether the light is controlled by NR Dashboard or the Zigbee button.

After many weeks, all seems to be working well. If you’ve only ever used msg.topic and msg.payload in the past this might be a worthwhile eye-opener.

It’s also kind of handy having the ZB-MINIs working in a central location as they act as mesh repeaters (routers?)

Two new buttons

End result? Two new buttons on my phone… the two bottom ones – light up when ON – see the bottom left button on the photo on the left.

There is a bed showing on the bathroom radiator button (left) because the radiator does not operate in summer months.

Update June 20, 2021 – Even more new stuff:

All of the above is running smoothly and that gave me a little time to get experimental with Node-Red on my RPi4. SO, as I’m interested in both temperature and humidity, I store both in a Node-RED global variable along with an efficient timestamp so I also know WHEN, say, the little Aqara sensor last returned a reading.

Timestamps are efficient but of course not very human-readable so I’ve been using a date-formatting function in Node-Red every time I want to see a temperature reading. After a while that got to be cumbersome and this morning, though very familiar with Node-Red global variables, I figured it was about time I got to grips with initialising and using global FUNCTIONS.

Initialising and using a Node-Red global function on a global object

What you see above is firstly a simple initialisation of my new global date-handling function I keep in my first Node-Red flow called INIT. Secondly you see a typical example of use – showing the time the last reading was returned, NOT the time I used that INJECT node which in both cases is merely used as a trigger. The global object used here called bedroom-environment contains temperature and humidity as well as a timestamp stored when the sensor last returned data.

context.global.myDate = function(x) {
  var hour = x.getHours();
  hour = (hour < 10 ? "0" : "") + hour;

  var min  = x.getMinutes();
  min = (min < 10 ? "0" : "") + min;

  var sec  = x.getSeconds();
  sec = (sec < 10 ? "0" : "") + sec;

  var year = x.getFullYear();

  var month = x.getMonth() + 1;
  month = (month < 10 ? "0" : "") + month;

  var day  = x.getDate();
  day = (day < 10 ? "0" : "") + day;

  var weekday = new Array(7);
  weekday[0] =  "Sunday";
  weekday[1] = "Monday";
  weekday[2] = "Tuesday";
  weekday[3] = "Wednesday";
  weekday[4] = "Thursday";
  weekday[5] = "Friday";
  weekday[6] = "Saturday";

  return("handyDate"," at " + hour + ":" + min + ":" + sec + " on " + day + "/" + month + "/" + year);
}
node.status({fill:"red",shape:"dot",text:global.get("bedroom-environment.temperature")+"\xb0C and " + global.get("bedroom-environment.humidity") + "%" + context.global.myDate(global.get("bedroom-environment.when")) });

Update June 21, 2021 – ElectroLama ZZH enters the picture

Electrolama ZZH

I received an Electrolama ZZH Zigbee dongle a little while ago (that’s the USB dongle+antenna, not the bsae, in the leftmost photo) but no matter what I did, I could not get it to work – unlike the Itead unit, the Electrolama unit does not come pre-programmed – and somehow I managed at first to put in the ROUTER firmware instead of the COORDINATOR firmware – all of this is detailed on the Electrolama site – you should take a look at their documentation. Here’s a specific Electrolama link concerning zigbee2mqtt

It turns out that once I got over that issue, it was not because of an issue with the ZZH that it would not work for me – ElectroLama have been more than helpful, but my Itead dongle was using /dev/ACM0 and the ZZH wanted /dev/USB0. See the zigbee2mqtt link

Then I discovered that Zigbee itself, If you have an existing setup and change the coordinator, insists you make sure that any routers (repeaters – mains-powered Zigbee devices) are disconnected while first starting up the new coordinator – and the whole lot needs re-pairing (generally long-press) to the new coordinator.

Thankfully I’ve found that I did NOT need to mess with the configuration file, other than changing the port from /dev/ACM0 to /dev/USB0 for reasons beyond me (same actual connector) – and because of the change of coordinator – I had to add an ADVANCED entry into the configuration.yaml file – one-liner – forcing a “pan_id” address to avoid conflict even though the Itead unit was no longer connected … hopefully readers would not hit this issue – but I have to say that Electrolama were very helpful with me (as a Zigbee newbie). Also notice that the advanced section option in configuration.yaml which I showed earlier:

rtscts: false

is essential for the ZZH.

Why go to the bother of using Electrolama’s product? Well, the chip that Sonoff use (it seems) in their dongle has a tendency to be awkward once you get over 20 devices – wisdom out there says that the more powerful chip used in the ZZH doesn’t suffer from this problem – and their dongle also has an external antenna as against a PCB antenna so should have more range.

Update June 30, 2021 – Xiaomi Mijia Smart Light Sensor

This Zigbee 3.0 sensor works well – part number GZCGQ01LM “for the Xiaomi Smart Multimode Gateway” – but more importantly in this case, compatible with Zigbee2MQTT – watch… despite the rather large box – the unit is in fact quite small and neat and comes complete with adhesive fastner. Even though the manual was in Chinese – it wasn’t needed as the device is self-explanatory – the MQTT payload shows what it does – lux level – battery state, signal quality.

  battery: 100
  illuminance: 19868
  illuminance_lux: 97
  linkquality: 156
  voltage: 3200
Mijia light sensor

The two “illuminance” figures vary according to light level – and there is pairing and quick test button on the top of the unit. Banggood sell this unit though I didn’t notice reference to that part number. Meanwhile my experiments with an AliExpress-supplied light sensor have gotten me no-where so I’m really pleased about the Mijia unit (I need a sensor to detect sunlight levels for internal lighting to supplement my timers which can’t account for a cloudy, miserable day).

Update June 21, 2021 – Tuya Zigbee Mains Controller

Ok, here’s one for you: I just received a . The module shown on the left supposedly controls a mains load of up to 10A. This is reminiscent of similar looking WiFi products by the likes of Blitzwolf – and on the top, just out of sight is the usual Zigbee long-press reset button. In the front (see photo) is a terminal for a switch – wire that to live and the load turns on – release, the load turns off.

I’m concerned as I’m not sure what the “Max load: LED 250W 10A” is all about – should that not be nearer (non-inductive) 1KW at 100v or 2KW at 220v? If not, why state 10A? 250W makes no sense at all.

It’s a nice looking module with a wall mounting clip-on bracket, it paired to my Zigbee2MQTT setup no problem and the output includes “state” and “Linkquality” – all standard stuff. It seems that the switch option and Zigbee control work in harmony but I was concerned that despite the accompanying sheet stating that “the last adjustment remains in memory”, the unit, when left in the OFF state, reverts to ON in the case of power cycling (just like the Lidl Livarnolux lamp – not a lot of use if you are out of the country and there’s a power failure)., unlike the Lidl Silvercrest Smart Plug mentioned higher up which retains it’s state on power cycling. And right now it is squeezed minus the bracket into a lamp shade to give me (a) control over a living room lamp and (b) another mesh node – always handy with Zigbee. Very handy as it is so small.

Update July 5, 2021 – Zigbee2MQTT – a New Software Upgrade

See bottom of THIS page for details – save it in favourites if interested. I know I have..

Update July 21 – the Xiaomi Multimode Zigbee 3.0 WiFi Bluetooth Mesh

Xiaomi Multimode Zigbee 3.0

I just recently received the Xiaomi Unit and have not yet had a chance to give it a hammering but – direct from Banggood. Even with VAT and postage it is still well under €30 for anyone who wants a boxed product that would look fine on a coffee table (my ZZH wouldn’t).

The brand is Xiaomi MIJIA and the device is a smart gateway handling Zigbee, WiFi, Bluetooth and Bluetooth Mesh – and in one neat round unit. For more on this unit right now, I suggest checking out the above Bangood link – I think it’s on offer right now.

Update August 9, 2021 – Zigbee2MQTT Updated

Zigbee2MQTT release 1.21.0 came out a few days ago and thanks to the excellent design, it turns out I already have an update.sh file in the /opt/zigbee2mqtt folder – so I just ran that and a few moments later – all was done – for good measure I rebooted the Raspberry Pi. All working fine, using the little ZZH dongle referred to earlier.

Update December 23, 2021 – The Native Zigbee2MQTT Map

I keep going back to find out more about ZIGBEE and now I’m back temporarily in the UK, I’ve made a new Zigbee set-up for here – I’ve noticed that the map in the Zigbee2MQTT interface on (default) port 9099 is in itself useful and is part of a web page menu with lots of setup and controls for a Zigbee installation as well as device updates where available (most devices I’ve come across up to now do not seem to support updates). The map makes it very clear which devices are being used as repeaters and to which non-repeater devices they connect. In the image below however, I’m at a loss as to why the two items on the left appear to be on their own and why the unsupported device (Z) remains on the net. The device with the big blue star is in fact the Sonoff inexpensive Zigbee dongle acting a main router. Not sure why that doesn’t get named.

TVOC is an AQARA device, the Smart socket is Sonoff as is the newzbmini-1.

Beware that Zigbee updates take several minutes because of the low data rate. Just tonight, I downloaded the latest update (November 2021) for the Tradfr1 repeater (to 2.3.086) but could not find any update for the Ikea button – actually looking at the Ikea site, for reasons beyond me it seems that exact button (rectangular with 0 and 1 engravings on the top and bottom halves) is no longer available despite working well.

43 thoughts on “Zigbee Development – The Really Big Update inc ZZH

    1. Good – glad you’re getting somewhere. Now If I could just find someone to help me understand adding devices sufficiently to add in my AliExpress light/temperature/humidity sensor…

  1. I have actually installed zigbee2mqtt and spent hours reading everything. I’m suspecting the usb sniffer. Anyway I’m going to wipe everything and start rebuilding from the ground up.
    Thanks for your patience.

  2. No I haven’t. I plugged in the USB device and loaded node-red-contrib-zigbee2mqtt. I thought that was all that was needed. Node red log shows
    14 Jul 09:15:30 – [info] [zigbee2mqtt-server:JMZ] MQTT Connected
    14 Jul 09:15:30 – [info] [zigbee2mqtt-server:JMZ] Refreshing devices
    14 Jul 09:15:35 – [info] [zigbee2mqtt-server:JMZ] MQTT Subscribed to: “zigbee2mqtt/#
    I have opened bridge and enabled join but not getting any paired devices.

    1. Nooooo. You need to install zigbee2mqtt – see install guide…
      https://www.zigbee2mqtt.io/
      But surely that MUST be installed…
      See the notes in the link and my blog for getting the config right in /opt/zigbee2mqtt/data/configuration.yaml – notepad or similar will edit that – just text format.

  3. I’ve done all that but no with luck. Is the zigbee2mqtt-bridge node supposed to show “online” because no matter what settings I use, “localhost” etc I cannot achieve that.

  4. Thanks for that Pete. There are so many confusing variations on this.
    To instigate pairing do you press a button on the USB device as well as the remote switch?

    1. You need to read the front page of the Zigbee2MQTT site – I linked to it in the blog.

      The dongle (via Zigbee2MQTT) needs to be accepting pairing and the sensor (or whatever) device depending on which one will need a long-press to get it paired.

    1. The Sonoff dongle is ready to go with Zigbee2MQTT – no additional firmware required – note that this is the first iteration, there’s another – and another on the way with improved shield and external antenna. NONE of them should be plugged directly into a Raspberry Pi 4 but rather via a USB extension lead. The use of Zigbee2MQTT goes WAY beyond using Sonoff sensors – I have Aqara and Sonoff sensors as detailed – all work with that board and with Zigbee2MQTT and the list is expanding all the time.

  5. Zigbee beginner here.
    I have node-red, mqtt etc in place on RPI4
    I have installed node-red-contrib-zigbee2mqtt
    I have latest CC2531 USB
    I have Aqera push button.
    Question. Do I have to install firmware on the USB device?
    thanks
    John

  6. The unidentified controller looks like a Tuya ZigBee 1 Gang Dimmer Module Light Switch Module as sold by TomTop and AliExpress.

    1. I beat you to it. It is indeed a Tuya Zigbee dimmer module light switch – see the TomTop link near the end of the blog entry. I’d almost forgotten about TomTop when out of the blue…

  7. Hi Neil
    Lamp9 and Lamp10 worked just fine but eventually I went for living-room-lighting and mancave-lighting. Quite the opposite – N-R-C-V-S turns out to be EASY – just one NODE to contend with for each device or in my case group of devices.

    So, taking a look at the image included, my living room lighting (four Athom 15W RGB lamps – chosen for bright warm white… and of course RGB colour – as good as any though I wish they’d make the RGB more powerful too)… the NR segment you see included gives me both NR-Dashboard and Alexa control over the lights (never a good idea to actually RELY on an outside connection so it’s good to have a backup)… I can say “Alexa, set living room lighting to orange. If I pick white, the Lights all go to full warm white and if I say BLACK they turn OFF – I COULD have added in power OFF but black does just as well.

    As for my “transform rgb to rgbww” – trivial..

    if (msg.payload==”#ffffff”) msg.payload=”#00000000ff”;
    else msg.payload+=”0000″;
    return msg;

    And yes this is off topic as the lights are not Zigbee.

  8. Hi Pete, if you have node-red running and the server is not running anything on port 80 (netstat -ntl) then you can run with the amazon-echo-hub nodes. Basically any any MQTT topic can become a device. 🙂

    Node-Red will need to be run as root as port 80 is a privileged port. I’ve played around with running a amazon-echo-hub flow on a different port but Alexa seems to not see it. I haven’t tried Apache port redirect yet.

    1. Hi Neil

      I’ve used the amazon-echo-hub in the past… I thought that along with others were now dead. It’s been sitting on my NR for many months on port 8980
      As you can see there’s a device called “the shelf light”… Amazon says “Did you mean man-cave”…. I pretty much gave up on this – it used to work. Do you have very recent experience of it working – and yes I have reserved port 80 for this externally. The hub is running port 8980 on my Pi – But a few months ago I put a new router in and didnt put any port redirects in – fixed that now – but Alexa is still not finding my “the shelf light” – any tips?

      1. I don’t know might be your funny accent (badda bump bump). 😉 Sorry work with people from around the world so that becomes funny when someone complains.

        I’d get rid of the ‘The’ and the ‘My’ fewer words for Alexa to mess up. I do know that Alexa and Google Home can easily be confused to the point of making no sense at all. I’m hyper and I know that doesn’t work well with either.

        Here’s my second instance, the first is using the lower nodes that are not connected. The router redirect seems weird since it’s Alexa that talking to the port, not the Amazon service (I think).

        My experiment on 10080:
        http://ushomeautomation.com/images/alexa-echo-hub.png

        I’ll give Apache URL redirect a go and see if Alexa can see the devices.

        BTW, I manually turn on voice assistants. They do pick up things they shouldn’t and I work from home.

        Now I’ve got to fix Google Home and Node-Red. Grrr.

        1. Erm, nope – I renamed the two nodes to lamp9 and lamp10 – made no difference. The hub is/was on port 8980 as it has always been – on the Pi. I have no port redirects on the router… and then, a MIRACLE – I realised I had the virtual smarthome node on the Pi – scrapped alexa-echo and used that.. Using the CHANGE node I used MOVE to rename the msg.payload.powerState coming out of the Alexa node to simply msg.payload.state – straight into mqtt for the the zbmini. Tomorrow I’ll tackle colours.

          1. Your Alexa found the devices when your node-red flow was on 8980? Weird.
            I’ve not used names like Lamp9 and Lamp10. But if I were I’d go lamp nine and lamp ten.
            Yikes, node-red-contrib-alexa-virtual-smarthome looks like a lot of work. I just built my own Certificate Authority in my home and that was difficult enough. But good luck with the setup.

            1. Hi Neil
              Lamp9 and Lamp10 worked just fine but eventually I went for living-room-lighting and mancave-lighting. Quite the opposite – N-R-C-V-S turns out to be EASY – just one NODE to contend with for each device or in my case group of devices.

              So, taking a look at the image included, my living room lighting (four Athom 15w RGB lamps – chosen for bright warm white… and of course RGB colour – as good as any though I wish they’d make the RGB more powerful too)… the NR segment you see included gives me both NRF-Dashboard and Alexa control over the lights (never a good idea to actually RELY on an outside connection so it’s good to have a backup)… I can say “Alexaa, set living room lighting to orange. If I pick WHITE, the Lights all go to full warm white and if I say BLACK they turn off – I COULD have added in power off but BLACK does just as well.

              As for my “transform rgb to rgbww” – trivial..

              if (msg.payload==”#ffffff”) msg.payload=”#00000000ff”;
              else msg.payload+=”0000″;
              return msg;

            2. Port 8980 was recommended as an alternative to avoid using ROOT which is against the recommendation of the NR guys. I had to do something with IP tables to redirect that to port 80 for Alexa.. can’t rememember but a moot point as I’ve switched to the N-R-C-virtual-smarthome node as you’ll see. It’s simple and doesn’t need any of that port messing about.

  9. For these two items to have DIFFERENT power up default states, I must be missing something, SURELY. IDEAS?

    Yes, you are. You’re missing that every “smart home device” has different company-specific customizations, and next to none are consistent in how they work. Most also assume that a) The power never goes out and b) you’ll always have fast internet (although for your use-case, internet is irrelevant)

    I think Hue bulbs allow you to set the power-on state.

    Different firmware will have different default states, and since generally the chips used in these devices are next to impossible to access (due to construction methods) even if you can get a hold of an SDK for the chips, it’s unlikely you’ll be able to alter it.

    In other words, the devices are working as intended by their creator. And often they deem 100% Brightness in the bedroom at 3am after a 1s power blip to be the correct option :rolls-eyes:

    1. I stand corrected on package sizes – and look forward to seeing a sample of the ZZH most likely at the end of this coming week in which case I’ll update the blog – thanks for the feedback guys. Keep it coming…

      “D” – thanks – I find that somewhat eye-watering that a manufacturer would assume any other than previous state to be appropriate after power loss. As someone who spends his time on two continents I expect equipment to recover gracefully from inevitable power outages/blips and/or occasional Internet failure. It isn’t usually practical to put UPS on everything.

      My controlling Raspberry Pi (RPi4) is on UPS but house lighting and other appliances is a non-starter and as for Internet – who gets 100% reliability 24/7/365 outside of specialised industrial situations…

      Here in rural Spain, 1-second outages with no excuses and no apologies are commonplace (thanks, Endesa) and back in rural UK, though things are much better with warnings being the norm, the power ocasionally goes out for several minutes for repairs – and if you’re away from home in either case, warnings are of no use anyway.

      From the time I co-developed ESP-GO, through Espurna and fast forward to current Tasmota setups, not to mention typical devices working with SmartHome and other proprietary software, until I started playing with Zigbee, I thought power-up-state unpredictability was a thing of the past 🙂

      Depending on future feedback, I may have to re-think the use of Zigbee for anything other than simple sensors (and using the likes of Sonoff ZBMINI as a simple mesh repeater ignoring the power control ability).

      For those not familiar with Tasmota – an extract from the online COMMANDS section of the FAQ:

      PowerOnState – Control power state when the device is powered up

      0 / OFF = keep power(s) OFF after power up
      1 / ON = turn power(s) ON after power up
      2 / TOGGLE = toggle power(s) from last saved state
      3 = switch power(s) to their last saved state (default)
      4 = turn power(s) ON and disable further power control
      5 = after a PulseTime period turn power(s) ON (acts as inverted PulseTime mode)

      asmota also has options to turn off the otherwise useful ability to reset a bulb to defaults after several quick power-cycles – the LAST thing you might want in a rural power environment.

    1. Both of the top items are out of stock and also more expensive by some way than the Itead dongle…. unless you know something I don’t…. Also I just checked – the first one is UK based and presumably due to Brexit – the postage alone is nearly €11 – how do they arrive at that for something that’ll fit in an envelope?

      1. Hi Pete – Omer from Electrolama here. I’ve just replied to your email but thought it’s worth clearing up the confusion about shipping fees here as well, as there’s really no magic behind how we arrive at the figures we set.

        Due to the thickness of the plastic case plus the padding of the envelope, we have to use the “Large Letter” format when shipping, not the standard (and cheaper) “Letter” format. Royal Mail offers various International services, we use “International Tracked & Signed” which (at the time of writing) is priced at £8.55 to Europe. This translates to $12.13, we charge $13.00 on Tindie for this service and the excess goes to cover (partially, I should add) Tindie’s seller fees, supplies and the time we spend packing/dropping off orders.

        Royal Mail does offer a cheaper service that does not come with tracking but given the chaos we are seeing even with tracked packages getting lost/significantly delayed due to the effects of the global pandemic _still_ wreaking havoc on global postal services, we are not using this service.

        We’re all spoiled by the significantly subsidised shipping for packages we get from the likes of Aliexpress sellers and it is unfortunate that as a business operating in UK, shipping to Europe, we just can’t compete with this.

        Hope this clears up any confusion.

        The good news is that we should be able to secure better rates now that we are shipping a fair number of packages and this is something we are working on as we speak. We will be launching our own online store to comply with the new EU regulations on VAT coming into effect in July and we are looking forward to offering better shipping rates when we launch!

    2. I agree and recommend –
      zzh! CC2652R Multiprotocol RF Stick
      The cc2531 will have problems dealing with a network larger than 20 devices and some devices will cease to connect.

      1. Hi Brian – I have my ZZH! stick – teething problems – I’m awaiting an update from the company – as soon as I have it working I’ll cover it in here. Thanks.

      2. Just to clarify that this limit on devices is a limit on direct connections to the coordinator – end devices connecting to routers are subject to separate limits. Personally I have always found the CC2531 to work well although recently I have been taking advantage of the zigbee coordinator built into the latest amazon echo devices. I have also kept my 40+ Ikea light bulbs and their associated dimmers and sensors on the Ikea hub to keep traffic to manageable levels.

  10. BTW do remember that the ZBmini like the regular Sonoff mini (and unlike the Sonoff Dual R3) has low voltage switch contacts so do disconnect the switches from the mains.

  11. Re your issues with the lamp and the zbmini – these were a problem with both Hue and Ikea bulbs and you would find that even a momentary power cut would have you suddenly startled awake in the middle of the night with every light in the house on full brightness. The explanation was that the device had no way of differentiating a power cut from someone just flicking the switch on the wall. A few months back both Philips and Ikea came out with firmware updates to allow you to choose your preferred procedure – retain last state or switch on – depending on whether you regularly used wall switches or not. There are ways that are fairly obvious of storing last state centrally and re-issue that command every minute or so but for a clean solution I think you have to hope that Lidl will also issue a firmware update in due course which can then be set through whatever app they recommend. Similarly for the Zbmini which uses a Silabs chip which does get firmware updates regularly for security issues and maybe this feature is buried already in the Ewelink app.

  12. Thanks Pete. It really is quite powerful, flexible and in the main, not bad looking in most brands and with zigbee2mqtt bridges so easily!
    First thought is that most mains powered devices are routers so I have a couple in the network for this reason alone. For example a Lidl smart extension in the attic allows me to restart two RPi’s up there and a CCTV DVR if the need arises but mainly to help with range on the smaller battery powered buttons and sensors.
    I also copy/pasted the Swedish character (whole word) but if its an ASCII then their is probably an “Alt+01XX” possibility too!
    With regard to IKEA, they have a Dublin, Ireland shop and a .ie domain so I ordered some stuff early this year. Actually all the kit came from UK, 6 week lead time with Brexit, import duty, country of origin… I was a bit sour, wouldn’t have ordered a thing if it hadn’t said all was in stock and priced in €!
    Thanks again for the inspiring work!
    G

  13. Good stuff Pete!

    Our paths have aligned again and I find myself saying I personally find it so handy to take already polished devices with slick Swedish/Appleish styling, robust electronics and superb battery and power management, then simply “bridge” these into my existing MQTT/NodeRED automations. I am not sure if you concur?

    Like yourself (and following more recent “SD card recoveries” using your script) I have had all sorts of home automations running for years, now however these really came to be as development or learning exercises, I only picked up coding/networking/linux via this stuff, now they are utility, work reliably and bloody handy too!

    In the old days my Garden shed for example had solar power to charge a battery in a deep sleeping MQTT node with an interrupt to wake it if the door ever opened. Everything from here was NodeRED including sending the node back into deep sleep. Now I have a more reliable solution with a Xiaomi reed switch on the door and a Xiaomi PIR inside the shed. My Pi “Server” is physically in my home alarm with opto-isolated GPIO to the alarm PCB so now if the shed door opens when the house alarm is set, the shed is itself an alarm Zone and sets the house to DEFCON5! If the PIR spots a human I get a Telegram message on my phone. In fact I believe there are >25 Zigbee devices paired, doing all sorts of stuff. You might recall the zigbee button to control my home heating with a Tasmota display, an odd pairing but very effective in fact.

    I have to say that while I learned a lot developing home automation stuff and it ultimately led me into LoRaWAN where I have become very proficient, zigbee with its meshed devices boasting very developed aesthetic and really good function including rich and easy to access data, well, they are so good!

    To answer a question in your post and by way of a tip; yes the Ikea TRÅDFRI stuff works, their circular multi-buton remote control exposes a massive list of actions from such a compact and stylish widget. One could control half of an average home with this alone!
    https://www.zigbee2mqtt.io/devices/E1524_E1810.html

    Thanks again for sharing!

    Garry

    1. Great reply, Gary 🙂 I picked up my Linux skills from putting this stuff together – had no reason to touch Linux before the RPI and other small micros – but before I settled on the RPi, I got sent lots of SBCs and to write about them I had to learn enough Linux so as not to appear as a complete idiot 🙂

      I touched on ESP8266 deep-sleep ages ago then abandoned it, as it was more important to me to have the extra output in GPIO16. Then the guys at ThingsOnEdge.com started sending me Crickets which make specific use of deep sleep to get months out of a battery. The jury is out as to whether their stuff will last longer on a battery than the Sonoff sensors (which have the advantage of pretty boxes)… I mention the Sonoff temperature sensor above which uses a relatively huge CR2450 battery and still only gets a few months..

      I’d put no IO on the RPI until I got the urge to give it an utterly pointless OLED display – and now the USB connection to the Sonoff dongle 🙂

      Lorawan I’ve not yet touched. No idea why.

      Sadly we are quite a distance to the nearest Ikea here in rural Spain – couple of hours or so. Back in the UK our home is only 1/2 hour to Ikea – but you can’t have everything – it’s rarely ever sunny in the Northeast of England so we had to make a trade, sunshine or gadgets…

      As it happens I realised last night I’d bought a TRÅDFRI single USB mains socket which happens to be a Zigbee repeater – but I think I threw it out last week in a spring-clean of none-QC3 USB sockets – forgetting it’s primary function 🙁 and it doesn’t appear in the Ikea web page.

      Finally, how did you get that symbol in your comment? I just copied/pasted the entire word from your comment to get it.. TRÅDFRI

      1. Hi Pete

        Å is Alt + 143 using the numeric keypad.

        The other Swedish characters are:-
        Alt + 134 = å
        Alt + 132 = ä
        Alt + 148 = ö
        Alt + 142 = Ä
        Alt + 153 = Ö

        BillP

  14. If you are persisting with the HA experimentation it is very worthwhile to install the zigbee2mqtt addon in HA which comes with a very comprehensive webui dashboard which allows overview and management of your zigbee devices – just don’t try to make sense of the route allocation – why some devices are paired with some routers can be mystifying.

    1. Well, I’m not doing HA, quite happy with NR Dashboard…. so I have the node-red-contrib-zigbee2mqtt set of nodes for that. Indeed, route allocation isn’t obvious..

      Last time I tried HA, some of it was WYSIWYG and some wasn’t.

Comments are closed.