Skip to main content

Flashing the SonOff USB Zigbee dongle

A while ago I purchased a SONOFF ZigBee 3.0 USB Dongle Plus on aliexpress. Finally I am coming around to using it for domotica around the house via Home Assistant.

Last week I had an interesting call with a friend of mine. He switched from ZHA to Zigbee to MQTT and he boasted about it having better device support. Since I had some issues with my smart radiator valves, I thought I'd give zigbee2mqtt a try.

Looking at the adapter list of zigbee2mqtt I was in luck to find my Zigbee USB dongle in there. Since I was moving away from ZHA, I decided to update (firmware upgrade) my USB dongle as well. The documentation references a DOCX and is quite Windows centric. Time for a Linux writeup.

boot mode

To update the firmware you need to put the USB dongle into boot mode (e.g. make it writeable), which can apparently be done with hardware switches (you will need to screw open the device for that, which I did not try). But there is also the possibility of using software to put the dongle into boot mode. This is done with uartLog.py, which did not work on Linux. After a tiny modification it worked (I'm calling it uartLog_linux.py). Note: after each read or write (e.g. modification) the boot mode will be disabled and you will need to enable it again (if needed).

user@host:~/$ python uartLog_linux.py
This is a debug log
This is an info log
This is critical
An error occurred

/dev/ttyUSB0 - Sonoff Zigbee 3.0 USB Dongle Plus
选择串口(输入串口序号即可):0
>>>>>>>>>>>>>>>> /dev/ttyUSB0 is opened.....
<queue.Queue object at 0x7f70c8649930>
<queue.Queue object at 0x7f70c86499f0>
Write  processing...
Write  processing...
Read processing...
Log Print processing...
>>>>>>>>>>>>>>>> end

reading and writing data

Decided to use cc2538-bsl to modify the firmware, which worked like a charm. First I tried to make a backup of the current data, just in case something went wrong. In the end I did not use this backup file, so I am unsure if it even would have been useable or not. The ERROR at the end seemed quite common and as such I ignored it.

user@host:~/git/cc2538-bsl master$ ./cc2538-bsl.py -p /dev/ttyUSB0 -b 115200 -r 20220508.bin
Opening port /dev/ttyUSB0, baud 115200
Connecting to target...
CC1350 PG2.0 (7x7mm): 352KB Flash, 20KB SRAM, CCFG.BL_CONFIG at 0x00057FD8
Primary IEEE Address: 00:12:4B:00:24:C1:66:F8
Reading 524288 bytes starting at address 0x0
ERROR: Timeout waiting for ACK/NACK after 'Mem Read (0x2A)'

Then I continued with flashing the new firmware (after putting the stick into boot mode again):

user@host:~/git/cc2538-bsl master$ ./cc2538-bsl.py -p /dev/ttyUSB0 -b 115200 -evw ~/Downloads/CC1352P2_CC2652P_launchpad_coordinator_20220219.hex
Opening port /dev/ttyUSB0, baud 115200
Reading data from /home/user/Downloads/CC1352P2_CC2652P_launchpad_coordinator_20220219.hex
Firmware file: Intel Hex
Connecting to target...
CC1350 PG2.0 (7x7mm): 352KB Flash, 20KB SRAM, CCFG.BL_CONFIG at 0x00057FD8
Primary IEEE Address: 00:12:4B:00:24:CB:DC:23
    Performing mass erase
Erasing all main bank flash sectors
    Erase done
Writing 360448 bytes starting at address 0x00000000
Write 104 bytes at 0x00057F988
    Write done
Verifying by comparing CRC32 calculations.
    Verified (match: 0xddfc152d)

It seems to have worked like a charm (the stick still works).

A big thank you to all the people to made the software, the firmware and the instructions possible.

closing thoughts

My thoughts on Zigbee2MQTT (compared to ZHA) are:

  • Zigbee2MQTT enabled me to do more and better debugging
  • it has better device support (my radiator valves have more options and properties to use)
  • and provides Over The Air (OTA) updates (which only worked for my smart power plugs, the radiator valves are a corner case apparently, for now)
  • it also integrates excellently with HomeAssistant
  • ZHA is dead to me (but still a big thank you to everyone, the creators, the maintainers and the contributors)

Microsoft Teams on Linux woes

At work we use Microsoft Teams to communicate. Of course I try to use this natively on Linux, since that is my platform of choice. Today I looked into an issue, that causes me to get an empty pop-up when receiving a call. Which effectively means that I can not answer incoming calls. (TL;DR: was not able to fix it)

Obligatory stats: Ubuntu 21.10 with awesome wm, running Microsoft Teams version 1.4.00.26453 using snaps.

Updates

I looked for an update, but the snap has been updated 7 October 2021 and I'm running that latest version. I'm glad there is a Linux version at all, to be honest.

Cache

Although it's a Windows tip, I still tried to clear my cache data of the snap. It resulted in my having to reset my preferences, but that is it.

Web version

Then I remembered that there was a web-version of Teams, so I tried to use that with Mozilla Firefox. When trying to initiate a call I get this lovely message:

Try a different browser
This feature isn't available yet for your browser. Try the web app with Microsoft Edge or Google Chrome, or switch to the desktop app.

So I installed User-Agent switcher and manager and pretended to use Chrome on Linux. That worked, so I can now can initiate and receive calls and get a notification thereof, which I can accept.

Then I tried to share my screen and receive a screenshare, but no such luck. Receiving screenshares did work in the snap version, but not sharing screens.

Screen sharing

Looking at the Share content in a meeting in Teams page it states:

  1. If you're using Teams on the web, you'll be able to share your screen only if you're using Google Chrome or the latest version of Microsoft Edge.
  2. Window sharing isn't available for Linux users.

So I am basically still SOL and so I switch back to the snap.

Known issues

Looking around a bit, I also found this gem with 'known issues' on Linux. The discovery date of the issues are "12/05/19" and the resolution is that Microsoft is looking at it. Looking at the date, the issues have probably zero priority and will receive no love.

Where is the love?

That made me think of "Microsoft ♥ Linux" from years ago. A quick DuckDuckGo search gave me this blogpost at Microsoft. Apparently it's server love. Would be great if this would still be a thing... (also for desktop apps / web apps / desktops)

HikVision HWP-N2404IH-DE3 PTZ controls

Recently I came into the possession of a HikVision HWP-N2404IH-DE3 mini PTZ camera. It has POE, RTSP, ONVIF, can pan/tilt/zoom remotely, has optical zoom etc.. Hardware wise the camera is great. Proper build quality, nothing to complain about here. But the IT part looks better on paper than IRL. Worst thing is that I could not use the PTZ controls in the webinterface, because they require some Windows .exe to be installed to get that working. But I have a workaround.

Read more…

Thinkpad T420 - CMOS battery replacement

A long time ago I bought several Lenovo Thinkpad T420 laptops (used of course). But my wife's laptop gave her the dreaded error (after power loss):

Real Time Clock Error - Check Date and Time settings.
Press Esc to continue or F1 to enter Setup.

Finally I got fed up with it, so I swapped out her old CMOS backup battery with a new one. Then I also did the same for my other T420's.

Read more…

Evoluent Vertical Mouse 4 - Disable blue LED light

For a while I've been using the Evoluent VerticalMouse 4 Right. At first I had to get used to this type of mouse, but after a day or so, I already got used to it. The strain on your wrist/arm is much less with a vertical mouse, so I can really recommend it.

But I cannot recommend the blue LED light at the front of the mouse (facing the user). It's a very bright LED with no added value to the user. I'm used to working at different times of the day and also in low lighting conditions, so I use redshift for my monitors. But the bright blue LED on the mouse is really a PITA, since it's brighter than my screen...

Since I'm repairing (or modding) more and more devices, I wanted to disable the LED (in hardware) by opening the mouse. Drobilla.net had the same idea a few years ago so this should easily be doable. The blogpost got updated in 2020 with the news that Evoluent has a software/firmware fix for the blue LED light. So I went for the quick win and it worked like a charm. Just press and hold the "-" of the "pointer speed" button, while plugging in the mouse and the blue logo LED will be turned off.

GRUB - grub_register_command_lockdow not found

Recently the OS disk of one of my servers failed. Since the OS disk is a USB stick and I have had good experiences with Diet Pi for my raspberry pi's, I thought I'd take a look if it is also available for AMD64. Guess what, it is!

So I fired up dd to push the downloaded image to the USB stick, popped the USB stick into the server and ran the OS for the first time. So far, so good. But then I rebooted...

Read more…

freenode requires irc.com

Last weekend I wanted to check in again on my Freenode IRC account. I logged into my trusted irssi IRC client and was confronted with these errors:

21:01 [freenode] !*.freenode.net *** You must use TLS/SSL and authenticate via SASL to connect to freenode please visit https://irc.com/login/sso in order to create an account. SASL Configuration: https://freenode.net/kb/answer/sasl -
          Webchat: https://webchat.freenode.net/
21:01 [freenode] -!- Capabilities requested: multi-prefix
21:01 [freenode] -!- Capabilities supported: account-notify account-tag away-notify batch cap-notify chghost draft/relaymsg echo-message extended-join inspircd.org/poison inspircd.org/standard-replies invite-notify labeled-response
          message-tags multi-prefix sasl server-time setname userhost-in-names
21:01 [freenode] !*.freenode.net *** Found your hostname (XXXXXXXXXX.domain.tld)
21:01 [freenode] -!- Capabilities acknowledged: multi-prefix
21:01 [freenode] !*.freenode.net *** Could not find your ident, using ~USERNAME instead.
21:01 [freenode] -!- ERROR Closing link: (~USERNAME@XXXXXXXXXX.domain.tld) [You must use TLS/SSL and authenticate via SASL to connect to freenode please visit https://irc.com/login/sso in order to create an account. SASL Configuration:
          https://freenode.net/kb/answer/sasl - Webchat: https://webchat.freenode.net/]

So I tried to check out the webchat, but it seems to be broken as well:

webchat.freenode.net on 08-08-2021

The only option was to go to the IRC.com website and create an account. With that account I was able to access Freenode again, but I am not happy with this severe change. This triggered me to now finally dropping my nick on Freenode and permanently upgrading to Libera.chat.

P.S. I've requested account and data removal on IRC.com via their contact form (there does not seem to be another way to do that). Hope they are GDPR compliant.

input output errors

One of my servers went belly-up. It is always unfortunate when you are confronted with a failing server. If you ever get messages like this, the hard disk on which your Operating System is installed, is probably K.I.A.. In the end I did a hard reset and was greeted with busybox (which was expected). Just wanted to share the kind of 'weird' messages you can see when you have I/O errors due to a failing drive (in this case it was a USB stick, not a HDD or SSD).

:user@hostname:~$ ssh cyberdyneinc.net.sukar
Linux sukar 4.19.0-14-amd64 #1 SMP Debian 4.19.171-2 (2021-01-30) x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
You have new mail.
Last login: Tue Jul 27 13:03:33 2021 from 10.83.1.239
-bash: /usr/bin/id: Input/output error
-bash: [: : integer expression expected
-bash: /etc/bash_completion.d/docker: Input/output error
-bash: /etc/bash_completion.d/docker: Input/output error
user@sukar:~$ sudo -i
[sudo] password for user:
-bash: /usr/bin/id: Input/output error
-bash: [: : integer expression expected
-bash: /etc/bash_completion.d/docker: Input/output error
root@sukar:~# journalctl -f
Bus error
root@sukar:~# df -h
-bash: /bin/df: Input/output error
root@sukar:~# reboot
-bash: reboot: command not found

postfix can deliver e-mails again towards Microsoft addresses

Recently I upgraded to my new, freedom-loving, pro-privacy Internet Service Provider Freedom Internet. I was already running a mailserver before I switched: postfix. For years I had no issues sending out e-mails towards other mailservers. After I upgraded though, it seemed I was unable to send e-mail to Microsoft e-mail addresses. I noticed it only after a few months, when I tried to reach someone with an @live.nl e-mail address.

TL;DR

So I decided to change my reverse DNS record from something.connected.by.freedominter.net to something.domain.tld And behold, my e-mail was now being accepted again by Microsoft.

So although Microsoft's policies and guidelines state "Email servers must have valid reverse DNS records.", that is not the entirely true. I assume that Microsoft rejects e-mail servers with rDNS records with more than 2 dots. Beware if you use multiple DNS zones.

Read more…