It’s Friday (August 2024 – see October 2025 update at the end) and I got up VERY early this morning and in this entry I have new devices from SHELLY – a pair of SHELLY MOTION devices (about which I’m quite excited) – and a not-so-new but handy Shelly RGBW PM Led Controller.. but I’ll get to these further down!
But first – Sonoff Zigbee
What’s new? Not new devices – but new uses… in the last blog entry I started to talk about my UK SMLight SLZB-06 ETHERNET Zigbee coordinator which I left functioning over there and I’m currently awaiting the same for here in Spain – expect a new article soon. As I have a pair of Sonoff Zigbee ZB-dongle-E USB devices and a ZB-dongle-P, I got out of bed first thing, eager to ponder what to do with these when the new Ethernet-based device turns up.
One option would be to sell them, another option: they can be converted to run as ROUTERS instead of COORDINATORS (if you’re new to Zigbee, it is natural to think of the COORDINATOR as a ROUTER and routers as REPEATERS but never mind – not my idea).
I’m not going to go into detail about how to flash these as ROUTERS – suffice it to say that using a Windows PC, the E dongle was DEAD EASY to flash as a router – the P-dongle not so… ultimately for the P-dongle – eventually I used this post and the embedded video which wasn’t that bad compared to others and in particular compared to Sonoff’s abysmal attempt to explain the process. In both cases the process is the same – just a different file for the firmware (be sure to get the ROUTER file, not the COORDINATOR file). That link above – for the P dongle – Python – no opening up / internal button pressing needed – the plan was for it to back up the original COORDINATOR code, flash the new ROUTER code and verify it – well, here I suffered – the backup procedure produced:
File "C:\Users\pete\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\serial\serialwin32.py", line 475, in exclusive
raise ValueError('win32 only supports exclusive access (not: {})'.format(exclusive))
ValueError: win32 only supports exclusive access (not: False)
So that failed – but I kept going and the verify failed with:
Connecting to target...
CC1350 PG2.0 (7x7mm): 352KB Flash, 20KB SRAM, CCFG.BL_CONFIG at 0x00057FD8
Primary IEEE Address: 00:12:4B:00:24:C2:77:2B
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: 0x9877ee56)
ERROR: int() can't convert non-string with explicit base
BUT HEY – the router code WORKS so I’m not worried – I put these backup and verify errors in here for your benefit.
I now have a SONOFF type E and a type P ROUTER. You’ll probably know if you use ZIGBEE that any mains powered ZIGBEE device is also, automatically, a router – and so extends the mesh.
GOOD – but your light bulbs and sockets might not be ideally placed for acting as repeaters (ROUTERS) – and so I ended up with the odd otherwise unused Zigbee smartplug acting merely as a router… because my main Sonoff COORDINATOR was (still is) on a Raspberry Pi 5 (USB) in the corner of my office – which in turn is in the far corner of the building. Not ideal. The new Ethernet coodinator will change all that as I can put it smack in the middle of the building – and these Sonoff devices (with aerials therefore presumably better than simple bulbs or sockets) can then be strategically placed to improve the upstairs and downstairs extremes of our solid-rock-based cavehome!! (as an aside I just improved WIFI upstairs by the use of a decent WiFi 6 router/access point downstairs – which worked a lot better than an attempt at using Powerline devices to extend the range).
And now – SHELLY!!
So this morning, a pair of SHELLYBlu MOTION smart motion detection devices arived along with their RGBW PM (Plus) device (12v or 24v) up to 240w capacity. This device is for non-smart LED strip(s).
I’m so glad I took that photo before opening the box – as I ended up shredding the lid – anyway, the device has power measurement – odd for a LED controller.
The device can control up to 4 different strips (light mode), a single LED strip (RGBW mode) and RGB strip (RGB mode).
No mention of my new favourite topic, using the setup Bluetooth for BLE beacon purposes (it is a powered device after all so why not) – but never mind.
I like this already – take a look at the device itself… the device will work in Shelly Cloud and of course locally and with Home Assistant – not tested that yet as I’m eager to get onto the motion sensors..
Shelly Blu Motion
I tried my best to show you the red light flashing on the motion device but failed. Out of the box the unit was flashing red on movement – which to me gives an indication of their confidence in the battery life. Oh, there’s a light (lux) sensor as well as the motion sensor – that’s good. AND yes it does (apparently) support BLE for broadcasts. There’s a button inside for setup and the device has it’s own web interface and works with the Shelly APP.
With Shelly devices, I’ve found I need to give them a fixed IP address to have them work with the Shelly integration for Home Assistant – but that’s easy enough. To install I put a screwdriver carefully into the slot indicated and removed the top half, there’s a button inside, I pressed it briefly and SHELLY BLU MOTION appeared in my device list in the APP. All went well until the final part – ADD device -“Please press device button” – again. Nothing happened for a worrying moment then the page popped up to let me change the device name if I wanted – fine.
And now I got the list of my devices with the “Shelly Blu Motion 1” showing as “pending connection”. First shocker “device is offline – ensure there are Shelly Bluetooth gateway devices around”. I’d been given the option to use one of my other Shelly devices as a BLE gateway but ignored it – bad move. It just so happens I have a Shelly Plus 1PM device so I backtracked. I plugged in my SHELLY PLUS 1PM which in the APP showed up as a BLE OBSERVER (you can use other shelly devices as gateways).. yet the motion sensor still showed up as pending for a few seconds then as I was writing this – it appeared properly (and detecting motion)… and with light value “78” whatever that means (lux?)…
Settings – update – well, you have to have the latest firmware don’t you 🙂 – so off with the back again as this required another button press. “Initializing update”… Not the fastest update so off I went for more coffee. Chat with my wife – coffee and… still initializing update… 10 minutes – 15 minutes – something wrong there surely?
I was about to give up – I had a dead Blu Motion but on emailing had a quick reply from Shelly – they pointed me to their shelly BLE debug APP but I needed more than that… so I created a support ticket and within minutes the support guys clarified that the Shelly BLE debug APP would get me out of a jam – it did – very quickly and I could run the other motion device and update it to the latest firmware.
Here’s an extract from their reply:
If the update hasn't been successfully completed, the device remains in bootloader state. You need to update it. To update your Shelly BLU Motion to the latest firmware version. You have to download Shelly BLU Debug App first from Google play or App Store. Then, follow these steps: 1) Remove the battery from the device 2) Hold the device's button 3) Insert the battery, without releasing the button for 2 seconds 4) Release the button 5) Go to Shelly BLU debug app, link your smartphone with the Shelly BLU Motion and click the OTA button
While I’m here – the battery is a monster – CR2477.
I need to do some long term testing of the MOTION devices but they also sent the Shelly RGBWPM (RGBW + Power Monitoring) device – and I’ve opened that up. I could of course have gone for the web interface – which is fine – but I was more interested in how it works in Home Assistant – my new fanatical interest.
Ok, so here’s the tile in HA with the RGB device – all I had to do was give it a fixed IP (I also turned on MQTT – not sure if that was essential – but I’m used to doing that for Tasmota)… you can hardly see the colour wheel here as I turned the brightness down – seems daft but there you go.
The actual RGB board is being fed 12vDC and I’ve a standard WS2812b roll or part of one attached – brilliance turned down just for the camera. The controls work perfectly and you have 3 options of how to use the RGBW channels… in HA, pretty much as I’d control other RGB lamps but this seems a bit more linear than usual.
It would have been nice if they could have squeezed another + connection for the strip – save me bodging the connection but then that’s common to many products – most ESP32 boards could do with far more grounds but that would make them bigger – you can’t win.
In case you are wondering – in the photo below that’s 12v not mains coming in…. OOH the power monitoring, how do I get to that? in HA I’m seeing entities for light, updating, 4 events and button – nothing about power monitoring…. over to Shelly for that….
Back to the Shelly APP… I’m seeing power consumption in the APP…1Wh – but then I do have it set to DIM… no power monitoring appearing in HA though – I guess that’ll be a firmware update needed – I’ve informed Shelly…
Year later update October 2025
I have a glass-fronted cabinet in the living room housing glasses and cups etc. at eye level. I already have LED strip lighting inside the cabinet to light it up at night. The lights turn off automatically when watching TV and the cabinet is not in the path of sunlight and hence can be a bit dark on a non-sunny day, so this morning I thought it would be nice to use one of the Shelly Blu units inside to light it up when I approach the cabinet. I’m no longer convinced of the usefulness of simple motion detectors in open rooms now we have radar devices… but for cupboards these units are ideal.
The Shelly Blu device has been in Home Assistant (sitting doing nothing) since last year when I did the above review… so I took a look…
Dead straightforward, stick the Shelly Motion device at the back of the cabinet glasses section at eye level – a quick automation in Home Assistant to turn on the lights in the case of movement…. EASY.
But no. Check out “motion — clear” in the image above. Sitting on my office desk, the unit performed perfectly and after the better part of a year, the battery says 100% – can’t be bad.
SO, I took the Shelly and it’s adhesive pad and put it in the livingroom cabinet. I came back to my office – “detected” – I sat for a minute or two – “detected”. What could be wrong? No indication of any issues – full battery – then it occurred to me, the living room is out of BT range of my Home Assistant box and since removing my failed BT presence sensing device for our phones and smart bands some time ago (Xiaomi scrapped the presence bit in their Mi 8 band), there’s no BT in the living room.
A sharp reminder of why I prefer Zigbee… I’ve lots of WiFi and Zigbee living room lights – the WiFi is self-explanatory – the light all act as repeaters for Zigbee (that’s just what mains-powered Zigbee devices do)..
But no such luck with BT. I was just about to abandon the idea when I headed back toward the living room where the sensor was sitting in the cupboard like a lame duck – still showing movement even though I was no-where NEAR the cabinet. Clearly DEAD. At that point I thought “good idea but no”.
But as I actually came into the room, this time with my phone in hand looking at Home Assistant – the very status page I showed above…. started to accurately reflect movement status.. so now I just needed a quick HA sensor to picked up on change of state from “clear” to “detected” (not steady state) to turn on the cabinet lights for, say, 5 minutes… that way, on leaving the room with my phone and the sensor failing to clear, no harm done.
So being lazy, I asked ChatGPT for the automation – simple – except that it looked for “detected” as I asked – no joy. It pointed me to the HA developer tools – I looked at the sensor – the Shelly Motion actually returns “on” and “off”. So, corrected automation – job done. If only life were this easy generally.
alias: Cabinet Light on Motion
description: Turn on cabinet light for 5 minutes when motion is detected
trigger:
- platform: state
entity_id: binary_sensor.bthome_sensor_6edc_motion
from: "off"
to: "on"
action:
- service: light.turn_on
target:
entity_id: light.cabinet
- delay: "00:05:00"
- service: light.turn_off
target:
entity_id: light.cabinet
mode: restart
Epilog – a Day Later – Playing with Gemini CLI AI
The above simple YAML was generated by ChatGPT (which keeps telling me my free time is up for the day) – and since then I’ve been playing with gemini-cli – early days but the latter looks like LOTS of fun.. This may be a fad but my guts tell me it’s going to be a useful tool… I’m assuming from here that you are using Windows 10 or 11 – if not – look no further (or look elsewhere for details for MAC, Linux etc)….
Installing Gemini CLI in PowerShell as Administrator
I’ve been exploring Google’s (normally web-based) Gemini and its alternative and powerful command-line interface, gemini-cli, which looks like a useful tool – and for my needs – free. Here’s a quick guide on how to install it in PowerShell, avoiding any common execution policy issues by running as an administrator:
Open PowerShell as Administrator:
Press the Windows key.
Type “PowerShell”.
Right-click on “Windows PowerShell” and select “Run as administrator”.
Install Gemini CLI
In the administrator PowerShell window, run the following command:
npm install -g @google/gemini-cli
Prerequisite: Node.js – if you don’t have that – you can get it from the Node.js website
I then (under my user folder) created a folder called (for the sake of it) mygemini – i.e. c:\users\pete\mygemini\
and once in there, created a blank file called GEMINI.md so Gemini has somewhere as a starting point. I went to that folder and simply typed:
gemini
That’s it. It needs an account on first setup – I just used my gmail account… and asked Gemini the following:
“I have a Home Assistant (HAOS) installation. I have a Shelly Motion movement sensor with a binary sensor called bthome_sensor_6edc_motion and after going from off to on, I want it to turn on a light for 5 minutes. The light is a light entity called cabinet – write the yaml automation for me.”
Ok, simple – here’s what came out. Hope you find this useful…. I could see me getting to like the command line Gemini – and unlike ChatGPT, free use doesn’t have severe daily limits. Everything below starting at the next paragraph was created by Gemini CLI and it even created a file and displayed the contents… in the Powershell window (which I’ve themed as I don’t like boring white on black etc). Brave new world!! Gemini initially chose mode: single as against mode: restart – I’ve since challenged that and it has re-written the file to use restart. So there it is.. and all of that is stored locally on my PC for future re-use…
I have created the YAML automation and saved it as motion_light.yaml. Here is the content:
1 alias: Turn on cabinet light on motion 2 description: '' 3 trigger: 4 - platform: state 5 entity_id: binary_sensor.bthome_sensor_6edc_motion 6 from: 'off' 7 to: 'on' 8 action: 9 - service: light.turn_on 10 target: 11 entity_id: light.cabinet 12 - delay: 13 minutes: 5 14 - service: light.turn_off 15 target: 16 entity_id: light.cabinet 17 mode: restart








Just a few typos – coodinator, devie, etc. Nothing too bad, just stands out a bit.
Fixed those and more, thanks… can’t complete the entry until I get more support from Shelly – in the past they’ve always been good.
Seems like you published this before you completed the section on the SHELLY devices?
I needed the link for cross-referencing – you’ll find I’ve done a lot more now on the Shelly devices – but still not finished as I decided to do a firmware update on the Shelly Blu Motion(for no good reason – I just like to have the latest firmware) – and 15 minutes later it’s STILL at it… I’m just about to contact Shelly to find out why it’s taking so long…. meanwhile if you spot any mistakes – feel free to drop me a note…