Cannot Flash Wemos ESP32 D1 Mini

I have just had an issue where I couldn’t flash my ESP32 Wemos D1 mini, It was giving me the following error:

Failed to connect to ESP32 invalid head of packet 0x65

which I believe is similar to other similar errors like:

Invalid head of packet (‘S’)

Invalid head of packet (‘w’)

Invalid head of packet (‘p’)

There were a number of different suggestions online including:

  • Try lowing the Baud rate
  • Try pressing the reset button on start
  • Try pressing the boot button (there isn’t one on the Wemos D1 Mini)

However, the one thing which worked for me to was short IO0 to GND while Arduino flasher was trying to connect to the board. That allowed it to programme.

Zigbee2MQTT on HomeAssistant in Docker with Supervisor and custom Devices.js

As usual with anything even remotely related to Linux – nothing is ever simple. I recently got a Raspberry Pi 4 8GB and wanted to install Home Assistant. I believe I did successfully install Home Assistant at least 4 different ways before deciding that the ‘Officially Unsupported’ ‘Supervised’ Raspbian install was what I was looking for. This allowed me to continue using the Raspbian GUI, but also allowed for Supervised Home assistant.

That install has been working fine, however, I’ve just bought a Tuya Zigbee Thermostatic Radiator Valve (TRV) from EBay and wanted to try to integrate it with Home Assistant. The one I bought doesn’t appear to be currently supported by Zigbee2MQTT library, however there are plenty of other Tuya TRVs which are.

So, I believe I need to set up a custom devices.js file. Which there are a lot of instructions for, none of which described my home assistant set up exactly. So – down the rabbit hole we go.

Ok – After many hours of browsing, attempting different configurations and general head banging – it turns out that there’s a bug in the latest version of Zigbee2MQTT (1.16.1) which causes it not to read the ‘devices.js’ file correctly. Which means the first way I tried would have worked, had I known there was a bug… Oh well. This is the second time a bug in HA/addons has royally confused me for hours before realising it wasn’t me

So, now the steps appear to be relatively simple – at least for the moment.

Step 1

Uninstall Zigbee2MQTT and install the ‘Edge’ version which is the latest dev version

Step 2

Create a ‘YOURDEVICENAME.js’ file in /usr/share/hassio/share/zigbee2mqtt (this is easy if you’ve already got SAMBA enabled, then it’s just \share\zigbee2mqtt) and copy the contents from one of the example files here (you can also follow the instructions from here from now I believe)

Step 3

Add the following to your Zigbee2MQTT Configuration:

  log_level: debug

Restart Zigbee2MQTT

Step 4

Go to the Zigbee2MQTT Log and read the messages, you’ll probably see something like:

Zigbee2MQTT:debug 2020-11-30 22:50:28: Received MQTT message on 'zigbee2mqtt/bridge/config' with data '{"commit":"15d04ed","coordinator":{"meta":{"maintrel":3,"majorrel":2,"minorrel":6,"product":0,"revision":20180507,"transportrev":2},"type":"zStack12"},"log_level":"debug","network":{"channel":11,"extendedPanID":"0xdddddddddddddddd","panID":6754},"permit_join":true,"version":"1.16.1-dev"}'
Zigbee2MQTT:info  2020-11-30 22:50:28: MQTT publish: topic 'zigbee2mqtt/bridge/config', payload '{"commit":"15d04ed","coordinator":{"meta":{"maintrel":3,"majorrel":2,"minorrel":6,"product":0,"revision":20180507,"transportrev":2},"type":"zStack12"},"log_level":"debug","network":{"channel":11,"extendedPanID":"0xdddddddddddddddd","panID":6754},"permit_join":true,"version":"1.16.1-dev"}'
Zigbee2MQTT:debug 2020-11-30 22:50:30: Received Zigbee message from '0x5c0272fffef143a4', type 'commandSetTimeRequest', cluster 'manuSpecificTuya', data '{"payload":[],"payloadSize":0}' from endpoint 1 with groupID 0
Zigbee2MQTT:warn  2020-11-30 22:50:30: Received message from unsupported device with Zigbee model 'TS0601' and manufacturer name '_TZE200_fhn3negr'
Zigbee2MQTT:warn  2020-11-30 22:50:30: Please see:
Zigbee2MQTT:debug 2020-11-30 22:50:36: Received Zigbee message from '0x5c0272fffef143a4', type 'commandSetTimeRequest', cluster 'manuSpecificTuya', data '{"payload":[],"payloadSize":0}' from endpoint 1 with groupID 0
Zigbee2MQTT:warn  2020-11-30 22:50:36: Received message from unsupported device with Zigbee model 'TS0601' and manufacturer name '_TZE200_fhn3negr'
Zigbee2MQTT:warn  2020-11-30 22:50:36: Please see:

Above you’ll see that it’s recognising a device called the TS0601, which appears to be a generic name for Tuya compatible devices. This and the manufacturer name are useful information for you to be able to ‘fingerprint’ the device.

Step 5

I started to follow the instructions on this page for adding a Tuya device. However, with their example device configuration I got an error on the tuya.SetTime line, so I commented it out for now

    onEvent: tuya.setTime, // Add this if you are getting no converter for 'commandSetTimeRequest'
ReferenceError: tuya is not defined

This allowed the Zigbee2MQTT plugin to finally start up with my custom configuration and start giving me the debug info I need to follow the instructions for setting up a new Tuya device

Failed Attempt #3

Step 1 (read Step 2 first)

Install Portainer according to these instructions (first time I ran the command it didn’t work, tried again, and it worked…)]

Once installed, navigate to http://YOURIP:9000 to load up the Portainer interface

Step 2

Find my Zigbee2mqtt docker container ‘data’ directory by browsing through my portainer Containers, and to Zigbee2MQTT. Mine was located at /usr/share/hassio/addons/data/7ad98f9c_zigbee2mqtt. So perhaps you could skip step 1 and try navigating to here directly.

Step 3

Identified the correctly compatible version of a donor ‘devices.js’ file by following the instructions here

Navigated to /usr/share/hassio/addons/data/7ad98f9c_zigbee2mqtt and Ran wget

to copy the devices.js file in to my data directory. Gave up here – this didn’t do what I expected, and then after more researching, found it was a bug in Zigbee2MQTT – see instructions above

FIXED: Windows 10 Logitech MK850/M720 Triathlon Mouse Freeze/Unresponsive

I have just bought a new Logitech MK850 keyboard and mouse combo – primarily for the multiple device support – and so far so good (The keyboard is a little mushy though – especially the backspace key, but hoping I’ll get used to it).

However – one problem I did find was that when sometimes, when my PC was either heavily loaded or reading a lot of data from internal disk, the mouse would and keyboard would freeze and become unresponsive.

I’m using the Unifying receiver in this case, and have it plugged into a USB 3.0 Hub port on the front of my PC. Searching online appeared showed a thread where someone had a similar issue, and suggested making sure it’s plugged in to a USB 2.0 not USB 3.0 port on the PC. I’ve just moved the port, at this appears to fix it!

TLDR; Plug into a USB 2.0 port, not a USB 3.0 port!

UPDATE 03/09/2020
My freezing and unresponsive issues seem to have returned, but I don’t know what I’ve changed. I’ve now tried moving the unifying dongle from the USB port in the front hub to the rear instead, but that doesn’t appear to have fixed the issue.

FIXED: Arduino IDE High CPU Usage

I’ve been using the Arduino IDE for some project development recently, and finding that I’m getting very high CPU usage from Java to the point that it’s slowing my machine down, and then Arduino IDE becomes unresponsive. I couldn’t find any info on any of the forums related to this, but from my own research I believe I have found the problem.

It seems that my problem comes after a long time connected to the Serial Monitor and receiving data from the Arduino. It then gets worse and worse until things start getting unresponsive. The solution for me appears to be to basically just close the Serial Monitor, and reopen it. this can sometimes take a long time, and has caused Arduino to become unresponsive before, causing it to crash and restart. However, this appears to have been the only time I have seen this problem online.

PC Components Price Increases! Due to Coronavirus?

Just last week, I bought a new set of PC components, and I think I got a fairly reasonable price, but it’s now gone up by £15, and all the other components I bought are no longer available.

I wonder whether Coronavirus is having an impact on PC component availability and prices. Certainly I know my work place have had to purchase a load of new Laptops in order to support home working arrangements.

There’s an interesting Ebuyer Price tracker available here:

Which shows the recent price fluctuations – had I have bought in January, I could have got it £20 cheaper!

How to: Honda Civic Type R EP3 Anti Roll Bar Bush Change

I had to change the anti roll bar bushes on my Civic EP3. I was getting a knocking noise, and upon investigation it turned out that they were really loose, and you could basically move the anti roll bar by hand. I got the parts from Eurocarparts (probably not the best quality – would suggest a better Motorfactors), and they were easy to change within 5 minutes with just a 14mm socket!

Check out the video below

FIXED: Realtek Audio Front Panel Issue/ASRock B450M

I have just built a new PC with an ASRock B450M Steel Legends motherboard, which has Realtek ALC892 onboard audio. I’ve also installed a front panel audio input, and connected it to the header on the motherboard. I’ve then got Windows 10 installed, and faithfully installed the Realtek motherboard drivers from the ASRock Website (I knew I shouldn’t have done that!)

However, I have been having an issue that audio from Windows was only coming through from the device which was plugged in on power up – so if I plugged in the headphone, it wouldn’t detect them, or if I unplugged them once booted, it would not switch to speakers – I also didn’t get two outputs in the sound bar part of the task bar like so:

Expected display of audio output options

In order to fix this, I ended up rolling the drivers back to the Microsoft version, and this appears to have fixed it.

Rollback Realtek drivers to Windows 10 version