Sonoff-TASMOTA Updates

Theo has (as usual) been very busy with TASMOTA and has pushed out two releases in the last couple of weeks.  The first, at the very end of October (the “Halloween-een” 5.9.0 release) was a fairly massive update, with portions of the code being updated to follow Google’s C++ style guide as well as rewrites of some of the code to use command look-up tables and JavaScript.  In addition to those, there are seventy-odd other fixes, changes and additions.  Phew!  A couple of the notable items are:-

  • Addition of support for the Arilux AL-LC01 RGB LED controller.
  • Addition of support for the Magic Home RGBW LED controller.
  • Addition of support for the KMC 70011 Power Monitoring Smart Plug.
  • Addition of support for the VEML6070 I2C Ultra Violet sensor.
  • Addition of support for ‘inverted’ PWM.
  • Addition of support for the Luani HVIO (230v dual power control) board.
  • Addition of sea-level pressure calculation and a new ‘altitude’ command.
  • Addition of support for up to 8 relays (possible new product hint?).
  • Fixes for timezone and southern hemisphere STD/DST times.
  • Fix for a large flash erase issue.
  • Fix for ‘all-off’ issue when SaveState is inactive.
  • Fix for a pressure calculation issue with some BMP sensors.

…and lots more (check out the _releasenotes.ino file in the sonoff directory for the full listing).

The second release, 5.9.1, on the 7th of Nov, doesn’t have quite so many updates, but does add functionality to make addition of external sensors even easier and also adds support for the ADS1115 I2C AtoD chip, which a lot of people are going to find very useful.

That’s just a short round-up (I have no idea where Theo gets the time to do all of this magic …he must type at the speed of light) and, as already mentioned above, there are a lot more changes and fixes in there, so I’d recommend that you stroll over to GitHub and pull the latest version (it’s almost guaranteed to have even newer additions by the time you get there).

 

 

Advertisements

A Bluetooth LE upgrade to OpenMQTTGateway

Florian Robert has been making regular additions to his OpenMQTTGateway package over the past few months.

OpenMQTTGateway is, as the name suggests, a bi-directional gateway between MQTT and other hardware and/or protocols that may be running in or around your smart home.  It supports most of the ESP8266 range of hardware, as well as an Arduino equipped with a Wiz W5100 ethernet adapter.  The basic idea is that your ESP (or Arduino) interfaces with MQTT on the main network and provides seamless communications with (for instance) 433MHz or IR devices which otherwise are not directly connected.

A while back Florian made the package easily upgradeable by adding module support, where contributors can add support for other hardware and protocols by adding additional module files, rather than having to mess with the core functionality.  This usually comes down to adding a single “ZgatewayXX.ino” or “ZsensorXX.ino” file (where “XX” is a unique identifier) and possibly an additional .h file, depending upon how complex your Z file is.

The latest addition is for a Bluetooth Low Energy based plant sensor (the Mi Flora) and provides a useful example of interfacing to BLE devices.

Automatic OTA Updates

Most OTA schemes just allow you to push an update to your ESP8266, but Xose Pérez’s latest offering, “NoFUSS”,  is a plug-in for your ESP8266 project which enables your ESP8266 to regularly check in with a specified server and automatically download an update if there’s one  available.  Neat!

In addition to the simple update functionality, NoFuss allows you to configure whether updates will be offered to specific groups of ESPs (for instance, temperature sensors which might all use the BME280 module) and to configure a specific load sequence (so that the SPIFFS filesystem on the target ESP might be updated before the actual project firmware).

The requirements for implementing this on your home network are fairly simple.  The server side requires a web-server capable of supporting PHP.  The ESP side requires that you add Xose’s NoFUSSClient library to your ESP project.  The configuration for both sides is explained in Xose’s original article and the git repository for the project is available here.

ESPurna updated to 1.9.4.

Tinkerman (Xose Pérez) has just updated his ESPurna package (an alternative to Theo’s TASMOTA) to version 1.9.4.  The change log shows additions for the Huacanxing H802 LED controller and the V9261F and ECH1560 energy metering ICs as well as fixes to ensure that all ESP8285 based devices are forced to use esp01_1m  (limited memory) and updates to MQTT handling.

If you’re using any version less than 1.9.0, it’s probably worth upgrading anyway, as that was the last major update, where Xose added support for a whole bunch of newer Sonoff products (including the RF Bridge, T1 light switch and 4CH Pro).

If you haven’t visited Xose’s site yet, it’s definitely worth checking out his recent RF Bridge article, as well as his tutorial on how to secure your IOT communications with an nginx reverse proxy and Let’s Encrypt certificates, both of which are very good reads.

Sonoff-TASMOTA Updated to 5.8.0

Theo has just released version 5.8.0 of the Sonoff-TASMOTA package into the wild, with a fairly varied collection of additions, updates and fixes.

There are several changes related to WS2812 LED control, a fix for a watchdog timeout problem, as well as other fixes for MQTT, language support and Domoticz and addition of support for the Yunshan Wifi Relay and Witty Cloud.  The complete changelog is available here:- https://github.com/arendst/Sonoff-Tasmota/blob/master/sonoff/_releasenotes.ino.

Owen Duffy has a nice rundown on the pros and cons of the Yunshan WiFi Relay board on his blog (and it’s worth taking a look at some of his other ESP stuff, too).

Yay! ESP32 SPIFFS Arrives.

This is one that seems to have been blocking a few projects up until now (going by the number of “any updates?” emails to the forum thread).

The official SPIFFS implementation is now available from the Arduino-ESP32 repository.

That’s the good news.  The bad news is that it’s flagged as “initial” and doesn’t seem to have things like “info” support yet.  Never mind, we have SPIFFS;  thanks Hristo and Ivan!

 

T-bao R8 15.6″ $185 Laptop – Installing Linux

-Preface-   I’ve hit a couple of roadblocks (specifically regarding partial hangs of the system when mounting large filesystems via NFS) which have delayed this post for a couple of weeks now.  Rather than delay any further, I’m posting this cut-down article on the basic installation details and will create a new article on running Linux once I’ve found a fix for my issues.


The T-bao R8 comes with Windows 10 preloaded on the internal, 64GB EMMC.  I’m not going to say anything more about Windows 10 as I’m completely unable to drive it (I just don’t “get” the Windows paradigm) and am therefore unqualified to give an informed opinion, one way or the other.  I intended from the outset that this would be a replacement for my existing, ailing laptop, which runs Elementary OS, a very usable version of Linux.

Anyway, the version of Elementary I’m running on my current laptop is fairly long in the tooth now (it’s based on Ubuntu 12.04 LTS), so it was time to upgrade the OS, too.  So, what we’re going to do here is:-

  • Break into the BIOS on the laptop and do some simple set-up.
  • Download a known, good ISO from the `net.
  • Boot the ISO image on our laptop.
  • Optionally back-up the pre-installed Windows-10 partition.
  • Install Linux.

What I discovered previously, with the Z8350-based Z83-II mini-PC (and the T-bao and Chuwi laptops are the same), was that the BIOS was strongly biased towards a Windows peculiarity where a native 64-bit system uses a 32-bit bootloader at switch-on.  This quirk, together with the UEFI requirement, means that many “UEFI enabled” distributions won’t actually boot on this device, as they only provide a 64-bit bootloader.  The answer to this boot problem for Atom equipped machines has been provided by Ian Morrison over at Linuxium in Australia.  Ian has developed a script, isorespin.sh, which will take the normal distribution ISO image file from several of the most popular Linux variants, unpack the ISO into a temporary directory structure, fix the bootloader, upgrade the kernel and add in required drivers for this type of machine (WiFi adapter and mouse-pad) and then roll the whole thing back up into a new ISO file which you can then dd to a USB thumb-drive to use as a combined bootable live demo and installation drive.  Ian has put a ton of work into this handy script and into re-spinning some ready-to-use example ISOs, so if you use his work, please be kind and buy him a beer.

Going back to the laptop, there are a couple of things you need to do and a couple of things you need to know to prepare for your install.  The BIOS on this laptop advertises itself as being a version from “American Megatrends”, but it has a very limited number of changeable settings.  You can get into the BIOS menu by hitting the escape key within a couple of seconds of powering on.  Do that first, go into general settings and set the “Num Lock” to “OFF” (if you don’t do this your keyboard will appear to be broken when you go into the UEFI shell, for instance).  You should also change the “Boot Delay” setting from “2” (seconds) to “5”, to give yourself a chance of reading any text displayed during the start-up process.  You may also find it helpful to change the boot messages option from “Quiet” to “Verbose” (which will give you the American Megatrends BIOS help messages at switch on).  Save those new settings and reset.


-IMPORTANT-

The boot device menu will not display any device that doesn’t have a 32-bit UEFI bootloader file.  This means that if you plug in a USB thumb-drive with (say) a standard 64-bit Ubuntu distribution on it, not only will the distribution be ignored, but the thumb-drive itself will not show up in the menu.  The same holds true for an external DVD-drive or any other bootable device.


Here’s where I wasted a lot of time during my initial attempts at building my chosen distribution.  I downloaded Ian’s script and ran it on my old Inspiron in an effort to build a bootable ISO for the new laptop.  I gained a lot of experience of running isorespin.sh from the command line, but never managed to produce an image which was bootable on the new laptop.  Strangely, all of Ian’s pre-built ISOs which I tried booted perfectly, so there was something about my ancient version of Linux (or just my ancient laptop) which didn’t cut the mustard in this case.

Anyway, to cut a tedious experience short, what I ended up doing was using one of Ian’s pre-built Ubuntu images to do a quick install on the T-bao R8 and then using the laptop itself to run isorespin.sh on the latest Elementary OS ISO to produce a bootable, working USB thumb-drive to do the “real” install.  This method worked perfectly first time. You don’t need to do this unless you want to install Elementary or some other version which Ian doesn’t have a pre-built ISO for.  The instructions below assume you’re doing a simple, straight install from Ian’s pre-built Lubuntu image (find the Lubuntu section and link to the image about 1/3 of the way down this page).

Load the image onto a USB thumb-drive (using dd) and connect it to your T-bao (L/H side connector is the USB-3.0 socket).  Power on and hit <F7> to get the boot selection menu and boot from USB.  Select the USB thumb-drive (if it’s not on the menu then, as per the info above, there’s something wrong with your download or copy procedure) and hit <CR>, followed by “Try Lubuntu without installing”.  Your machine should boot into the GUI within a couple of minutes.  At this point you should be able to play around with Lubuntu and get a feeling for how the keyboard and mouse perform before starting the actual install.

Once you’re comfortable with the keyboard and mouse, you can select “Install Lubuntu” either from the “System Tools” menu or by clicking on the install icon on the desktop.

A small warning here before you start the install …if you’ve chosen one of Ian’s other image files which has a “persistent” save area enabled on the thumb-drive and then have finger trouble when you enter (say) disk partitioning information, that same (bad) information will show up again the when you reboot from the thumb-drive.  It’s generally easier to reload the original, clean ISO image to the thumb-drive again, rather than try to work around it.

Note:-  The “disk” in the R8 is actually a 64GB eMMC memory module.  This is not the same as a SSD and is just one more of the compromises made when producing a budget laptop.  I found the eMMC on the Z83-II mini-PC to be quite slow and, although the T-bao unit isn’t a walking-through-waist-deep-treacle-nightmare, it still doesn’t break any speed records.

The Lubuntu install ISO which I linked to above will do a very good job of installing Linux onto the eMMC with the existing Windows-10 intact, without needing any special input from you.  In that case though, you’ll only end up with about 20GB of disk space dedicated to Linux.  You can choose to delete the Windows data and dedicate the whole disk to Lubuntu to get the whole 57-odd-GB of actual available disk space.

One other option you have while booted from the live ISO on the thumb-drive and before starting a Linux install, is to do a full copy of the eMMC drive using “dd” to another machine across the network (or to a local, USB disk drive), thus allowing you the option of restoring the machine to its default (Windows-10) state at any time in the future if, for instance,  you should decide to give it to your nephew for his school work.  This will take a bit of time (probably a couple of hours, depending upon your network and the target machine) and will use roughly 6GB of disk space on the remote machine if you use “xz” as the compression method (more for gzip, bzip2 or others).  If you have a very powerful remore server (muli-core CPU) you can compress remotely, otherwise I’d advise compressing on the laptop to get the added advantage of passing less data over your network.  A sample command (local compression on the laptop) might look something like this:-

dd   if=/dev/mmcblk0   bs=4M   |    xz   -T2   -c   |   ssh    UserName@SmallServer   "(   cd   /BigDisk/LotsaSpace   &   cat   ->   T-bao-Laptop_Windows-10_bkup_mmcblk0_dd.xz   )"

If you have some major iron on the server side and want to do the compression there instead, it might look like this instead:-

dd   if=/dev/mmcblk0   bs=4M   |   ssh    UserName@BigServer   "(   xz   -T4   -c   |   cd   /BigDisk/LotsaSpace   &   cat   ->   T-bao-Laptop_Windows-10_bkup_mmcblk0_dd.xz   )"

In the first example, the “-T2” option to the xz command tells it to use two threads for compression and the xz command itself comes before the ssh section and so is running on the laptop (a four core machine).  In the second version the xz command has moved into the ssh section and is being executed on the remote server.  Note that in this case the option has changed to “T4” to use four threads on that (imaginary) eight core machine.  In both cases the command is run as root on the laptop and the remote user “UserName” needs to have write permission in the /BigDisk/LotsaSpace directory on the remote server.

Installing from the live image on the thumb-drive after this doesn’t really require any explanation (as the prompts are informative and I’m also pretty sure you’ve already installed Linux once or twice yourself already).  The only place you need to pause and consider your answer is at the disk partitioning prompt; I don’t have any qualms about wiping Windows completely, but you might.

The actual install progresses very quickly and, as far as I can tell, selecting “download updates during install” doesn’t have any untoward effects on the (already updated) kernel and driver files from Ian’s respin (but please do let us all know in the comments if your experience differs from mine).

I had planned to limit the eMMC use on this machine purely to the initial boot of the kernel and have the laptop mount the live filesystems via NFS from one of my servers.  However, to date I’ve been unable to get the system to run reliably with even just /home mounted via NFS (the window manager appears to freeze, but shells on alternative console devices with, for instance, CTRL-ALT-F2, seem to carry on working).  This is obviously directly related to NFS traffic, as triggering multiple read/write operations on the /home filesystem with a non-trivial compile will reliably cause the hang.  “nfsstat” on the server shows an initial burst of activity which immediately gives way to just a single read operation (by the client) every couple of seconds.  Right now I’m stalled on this issue.


For anyone interested, the output from “dmesg” on the T-bao R8 running ElementaryOS 4.1 is available here.


More issues (as of 27th Oct 2017) — Well, I’ve wasted more hours, done more Linux installs and tried out more different distros  over the past month than I care to remember.  I have a couple of major problems which I can’t, so far, solve.  The first is to get Bluetooth working reliably and the second is to get sound working at all.  These sound fairly trivial, but together mean that radio, video and on-line communications channels like Line or Skype are all completely useless.

Important Note  —  The audio chipset on this (T-Bao R8) laptop is the bytcr-rt5651 (as opposed to the es8316, which seems to be common on the earlier Chuwi versions), which currently has very little support, even in the latest 14-rc6 kernel.  You can, however, stop the syslog file from filling up with millions of “no audio driver available” messages by downloading the UCM files for this chipset from https://github.com/plbossart/UCM/tree/master/bytcr-rt5651 and following Pierre’s straightforward installation instructions (in the README.md).  This will also cause the rt5651 to show up in the audio control panel (under settings->sound), although the actual sound output will still not work.

In addition to sound and Bluetooth, there are a host of other issues which make life with this laptop not just frustrating, but actually quite unpleasant when trying to use it on a daily basis:-

  • The WiFi reception is a lot less sensitive that all of the other devices we use in the house.  WiFi drops out completely in places which provide a “strong” signal on other laptops or tablets.
  • WiFi regularly just stops completely (even when there’s a signal shown in the toolbar) and usually won’t come back unless it is toggled off and back on again.  This is exacerbated by heavy network traffic (like downloading yet another distro).
  • YouTube and other videos play at several multiples of normal speed, so that it’s actually impossible to read subtitles (which you have to use, because there’s no sound).  It’s interesting that some people have reported that fixing the sound also fixes the frame-rate problem with their Chuwi laptops.
  • The SD card slot driver seems to be slightly weird, in that plugging in a card produces an error message (“SD card error -110 on initialization”) and the card remain inaccessible.  Various cards with various formats all produced exactly the same error.
  • The trackpad gets very confused with two-finger scrolling and regularly interprets a scroll as a zoom command, or as a one-finger button touch.
  • The trackpad isn’t accurate enough to allow scrolling on windows which have thin scroll-bars (which seems to be the rage, nowadays).
  • The trackpad will not respond to setting changes such as “side scroll enable”, “natural scroll disable” or “tap disable”, regardless of distribution.
  • Occasionally, the laptop goes into sleep/hibernate (on inactivity, or closing the cover) and then won’t restart, requiring a power-cycle to recover.

Of course I’m aware that some of these problems may be distribution related, but the ones mentioned above seem to be fairly consistent across multiple different versions of Debian/Ubuntu and Arch based distros.

On the plus side, I’m really grateful that the machine boots so quickly (roughly 30-seconds for a distro loaded on the internal eMMC).