Browse Author: Sauron

USW-Flex offline after adoption

Perhaps it will be useful for someone, I couldn’t find the solution for this.

So with fresh Unifi Flex switch, I’ve tried to adopt it with ssh “set-inform http://ip-of-host:8080/inform”. I’ve put IP address of my Unifi Controller in place of “ip-of-host” of course.

The switch shown as ready for adoption in Network Controller, but when adopted it became offline. It was steady blue light on it, so switch reported “adopted”. It was pingable from controller, I could ssh to it, ports where open and so on. Other AP’s on the same network vlan where also fine and previously configured without an issue.

I’ve tried to factory reset it and adopt again – same result.

But when I’ve looked in to the logs on flex I saw this:

Thu Aug 7 07:47:10 2025 daemon.err mcad: mcad[1204]: ace_reporter.reporter_fail(): Unable to resolve (http://unifi:8080/inform)
Thu Aug 7 07:47:10 2025 daemon.err mcad: mcad[1204]: ace_reporter.reporter_fail(): initial contact failed #2940, url=http://unifi:8080/inform, rc=1
Thu Aug 7 07:47:10 2025 daemon.info mcad: mcad[1204]: ace_reporter.reporter_next_inform_method(): next inform family: 10

So despite informing flex it should use IP to connect to the controller – and it used this information since it reported to it – after adoption process start it again wanted to use DNS name for connection. And it failed – since it was not defined this way on my domain/search domain.

So as a quick fix, I’ve added to the flex /etc/hosts line pointing unifi to the right IP and adoption finished. What’s surprising – later on, after adoption was finished correctly – the flex was using again the IP for connection, not the name… strange :/

How to prepare Android tablet for Home Assistant battery less console

First of all, it’s not full and proper howto – since I haven’t documented all the steps. It’s more like a key points guide for myself, when I’ll have to do it again 🙂 Never the less it should be quite useful for anyone struggling to do the same.

Why remove battery?

Since it will be all the time plugged in to power, battery would be charging and discharging all the time. This will kill the battery and could make it bulge or blow. Yet I still don’t get it, why it’s not designed to use only USB power, when connected and battery fully charged (same with laptops). Anyway, to make it safe, we need to get rid of battery.

What tablet to use?

First I wanted some Linux based (or Windows – and install Linux on it) – but variety of those and prices of new one, was not encouraging. So I was stuck with Android (let the google be cursed for what it did with it).

  • I wanted at least FHD display (for good quality of HA dashboard)
  • It should be IPS for good view angles, and sadly not Amoled, since it will display most of the time the same pattern and this is not good for it
  • It should have decent front camera – for movement detection
  • It should be possible to open
  • And it have to be rootable
  • quite new APU would be nice, to have HW acceleration of video decoders for camera views

So my first tablet was N-One NPad Plus – it’s under 100EUR 2K tablet with aluminum case. It was good because the case was closed with latches, not glued, and there was official firmware available, so rooting would be easier.

Sadly, when I wanted to buy another one (for second floor) it was completely out of stock… so I had to findLincPlus T3 tablet something else. I’ve found even cheaper LincPlus T3 tablet, but I guess it won’t be available long. Contrary to NPad, this had no firmware available and was glued 🙁

To open it, you have to use slick pry tool in quite steep angle under the screen, but push it more inside then under the screen – and go around screen, with suction cup pulling it up. It’s not that hard, and doesn’t require to use heat.

Next you have to unscrew two screws holding clamp on battery and screen port.

Tablet won’t run (it will start, but power off itself quickly) without thermistor (or just 10k resistor) on battery temperature line. But since all connection on the PCB are so tiny, it was extremely hard to solder to it and not rip off traces. So I cut of the battery BMS with connector from battery (under yellow kapton tape) and soldered +/- wire to solder joints on BMS board, leaving thermistor as it was.

I’ve made a hole on back of the case to move out wires for power supply.

Power

I’ve checked and it’s working well with 5V power supply (yes I know battery is 4,2V – but tolerance is higher – yet I don’t recommend it, since I don’t know if this wont have negative impact in the long run). It’s working on 5V/2A charger, but when connected to desktop power supply, tablet was able to crash when even 4V/6A limit was set – plain charger won’t cut off power when stressed, like bench power supply, but to remedy power spikes – I’ve added 1F 5,5V super capacitor inline. And it’s working fine.

Android, battery, charging…

Old ways of determining, if the battery is charged or not, was to just measure it’s voltage and extrapolate charge level. So if you use old tablet, with around Android 6 (don’t know exactly) – everything below doesn’t matter. But newer devices, measure current flow out and to the battery, when it’s charging and this way knows how much power has left. Because of this, even when battery is removed and tablet is powered with power supply, battery level will be dropping until 2% (or close to it) and Android will power off device – despite it doesn’t have to do it.

Of course we can’t simply ask Android not to do this and trust us, we know what we are doing. As usual the only way to change battery levels is to get root privileges, and of course Google knows better we shouldn’t do this (that company really sucks).

Rooting…

The easiest way is to use Magisk, it’s also beneficial because it has starting scripts – which we can use to disable battery daemon at startup. 

But every permanent root requires to modify the kernel image or add files to root device and most common way to do it, is to extract it from original firmware made for updates etc. Sadly Linc tablet doesn’t have those and even despite company replied to my email, they said they won’t provide the image.

So we can use DSU (Dynamic System Update) to boot temporary Android OS with root privileges, to be able to copy boot.img and patch it with Magisk.

Prior to this, you have to switch Developer mode and Android, unlock bootloader, and then use this guide to copy boot.img from the device.

Next step is to install Magisk, patch boot.img and install it with fastboot. If you are brave enough, you can use my boot.img already patched with Magisk (it will work only on LincPlus T3 tablet).

Magisk script

Finally we have to create a boot time script to set the battery level and preferably disable the power daemon.

I’ve used the “dumpsys battery” command to spoof battery being 100% and charging, but it’s not the best way, since in background, charging daemon still count discharge and it will show less and less after reboot. 

So add a file to “/data/adb/service.d/”

:/ $ su
:/ # cat /data/adb/service.d/update_battery_level.sh
sleep 20
echo "1" >/sys/devices/platform/soc/10026000.pwrap/10026000.pwrap:mt6366/mt6358-gauge/FG_daemon_disable
/system/bin/dumpsys battery set level 99
/system/bin/dumpsys battery set status 2
/system/bin/dumpsys battery set ac 1

Find in the /sys the FG_daemon_disable file (it’s different for android version and device) – and turn it on by setting it to 1. This is enough, and will set battery to 50% and won’t discharge it. If you wish to change charge level – dumpsys can be used for this purpose. But because it’s available in later state of booting – what’s why I’ve put “sleep 20” on the beginning.

Don’t forget to add +x right on the file.

 

Tronsmart Mega Pro 60 – battery design fail

What are the symptoms?

After a year or two (but not heavy usage – mostly lying around) speaker was unable to charge to 100% (also charging never finished) and Bluetooth showed at best 90%. Immediately after charging disconnect, it dropped to 60% or even less. While playing, it could barely withstand 30min of playback.

Wild guess would be the battery issue – I’ve assumed that manufacturer used some crappy lithium cells and that how it ended. I can’t confirm or deny this now – since definitely, by how they where charged, it damaged them a bit  – but they seems to be around 2500mAh, so decent.

So what is/was wrong?

Speaker have four 18650 lion cells, grouped by two. This gives around 7,4-8V total. Contrary, to what I’ve supposed before dissembling it, it had 2S lion protection board installed (on the first battery pack, under the shrinking tape) but it’s missing balancing feature. So one pair was charged to 4,4V and another was 3,3V. BMS (let’s call it this way for now) was cutting charging off (overcharge protection of one pair), but never reached top voltage (so charger IC was still trying to charge it – it’s a separate component on the main board – not on BMS). The other pair was all the time undercharge and quickly dropped to undervoltage protection, that’s why speaker could only play 30min or less.

In theory, if the cells are equal quality and used proportionally – this unbalancing could not have happened or took much longer time. But usually designers do some shortcuts (this is often in power cells for hand held devices – drills etc) and sometime power the low current BMS electronics with only one pair of batteries – because it’s easier – pushing cells to imbalance (I’ve seen this behavior in few Parkside and Makita devices). This is just an example – but it shows the idea.

Fix

Tronsmart Mega Pro - new BMS
Tronsmart Mega Pro – new BMS

So what it takes to fix the issue, is to use BMS with cell balancing and replace broken cells. In my case one of four cells where totally broken (unable to fully charge and was loosing charge).

I’ve used HX-2S-JH20 BMS board – plenty of those on Aliexpress for few bucks – because I had it at hand.

Oh and I forgot to mention – I have two of those speakers, and both face the same issue – so it’s not a fluke 🙂

PhotoTrap V2

ESP32-Cam based photo trap

So, we meet again – with esp32-cam board 😉 . My first encounter was rather disappointing. I’ve tried to used it for streaming, and the image was poor quality (OV2640) and what is more troublesome, the board itself was unstable.

Recently I had a need, for some kind of Photo Trap – to see what animals are finding food (that we left for them) close to my land. It could be moose or some kind of deer. Of course I could buy one, but where is the fun in it – and it would be probably much worst. The one I saw was old type, powered with four AA batteries etc. but it had also cellular modem used to send MMS with picture 🙁 in 21 century.

Continue Reading

Agregat prądotwórczy Smart (sm-01-3300inv) 3kW – krótka recenzja

Kilka moich spostrzeżeń na temat niniejszego agregatu. Szukałem czegoś relatywnie taniego i z sensownej jakości prądem na wyjściu. Szukałem czegoś powyżej 2,5kW by zasilić piłę (lub inne narzędzia w garażu).

Oczywiście najbardziej cieszył bym się z jakiejś porządnej Yamahy lub Hondy, a już zupełnie z dobrej instalacji fotowoltaicznej i akumulatorów LiFePo4, ale.. no nie ma warunków 🙂

Tak czy siak, Yamaha to dużo ponad 4kpln a taki Smart “tylko” 1,6kpln.

  • Generator działa – to pierwszy plus :), przetestowałem go na silnikach szczotkowych o mocy do 2000W – daje rade.
  • Przetestowałem całkowite, chwilowe obciążenie ciut ponad 3,5kW – piła, wyciąg, grzanie olejowe i ładowanie akumulatorów – było ok.
  • Działają zasilacze (laptop, modem, kamera), piły i kompresory – zarówno na silnikach szczotkowych jak i indukcyjnych.
  • Niestety wahania napięcia są wystarczająco duże, by było dostrzegalne miganie oświetlenia diodowego (jarzeniowe – mniej).
  • Jedyne co nie potrafiło pracować na nim w warsztacie, to przełączniki Sonoff (zwykłe S26 i x4) – ciągły reset, próbowałem zwiększyć im kondensatory na 5V – nie pomogło Okazuje się ze jednak działaja – mój błąd w konfiguracji.

Jakość sinusa jest przyzwoita (ale daleka od “sieciowego” czy z inwertera sinus), wypełnienie i okres również – poniżej zdjęcie z oscyloskopu.

Parametry prądu z agregatu

Update – 29.01.2021

Po kilku miesiącach użytkowania mogę zdecydowanie polecić urządzenie. Przepracował powyżej 100h i wszystko jest w najlepszym porządku. Trzeba regularnie wymieniać olej i czyścić świecę – inaczej zdarza mu się zgasnąć. Ale do tej pory robiłem to 3 razy.

Głównie używam go w trybie Eco – przy obciążeniu ok 1kW. Ale przy pile i wyciągu czy kompresorze trzeba wyłączyć Eco (co niestety wiąże się ze spacerem do agregatu 😉 ).

Jedyne co bym poprawił to dodał jakiś autorestart samego generatora prądu. Bo jeśli przeciąży się agregat (głównie w trybie Eco – w normalnym nie udało mi się, ale też nie próbowałem), to niestety silnik pracuje dalej ale generator się rozłącza. W efekcie jedyny sposób na wznowienie pracy to restart całego agregatu, a to trochę upierdliwe.

Kankun smart plug OpenWRT upgrade

During recent cleanups of all my IoTs devices, I wanted to disable Kankun reporting to company servers (I’ve moved everything to customs firmwares like Tasmota or Espurna with House Assistant to manage it – so I don’t want any third parties) and also it seemed to be a good idea to upgrade OpenWRT on it.

If you haven’t seen this type of smart plugs it’s a little nifty device. Comparing to recent Sonoff type smart plugs – that utilize esp8266 (that I like a lot and use with all type of other projects – but mostly ESP32 now) – this plug has Atheros AR9330 rev 1 chipset with full OpenWRT Linux on it. If you want to do more, than just on/off operations it’s just perfect device.

Continue Reading

PIDKiln v1.2 update

I’ve just created v1.1 release of PIDKiln, and bumped development version to v1.2.

Most significant change in release 1.1 are:

  • replaced MAX31855 library with another one – it’s much cleaner and easier to modify
  • much better MAX31855 error handling, both with thermocouple and MAX31855 itself
  • introduced network logging with syslog protocol – so you can watch all debug information on remote host
  • all logging settings are now in Preferences
  • compressed local JS, and created separate Preference setting to allow remote downloading of JS scripts (Internet connection required – recommended to use)

And I have also (after some 1.2 changes) first, real Kiln test run.

With two termocouples and power meters.

Source like always on GitHub.

Candle cnc 1.2b on Linux

If you would like to test latest (yet already quite old) Candle on Linux machine, you could face the same problems as I did – so few tips how to make it work.

I still think UGS platform is a better choice in many cases – but sometimes Candle may be necessity (I have found problem with UGS and Fusion 360 gcode files)..

Anyway, you may face this kind of compilation errors and configuration problems with latest 1.2b source code: Continue Reading