Xiaomi Aqara ZHA Home Assistant

This is how to use the Xiaomi Aqara Wireless Double Button without the Xiaomi Home Hub (A ZIGBEE STICK IS STILL REQUIRED) using ZHA in Home Assistant. Other devices just work without any hard to find IDs.


1. Go to “Configuration”

2. Then “ZHA”

3. Hit “Add Devices”

4. Hold down both switch buttons at the same time

5. The lights on the bottom should flash

6. Keep pressing one of the buttons at least every 5 seconds to make sure it stays awake for HA to find it

7. Every time you push a button you should see text scroll on the log

8. I keep doing step 6 until the text doesn’t scroll anymore.

9. You can now name your button and hit the back button in the upper left hand corner



1. Go to Developer Tools

2. Events on the top menu

3. Type “zha_event” where it says “Listen to events”

4. Go push the button you added into HA in the last section

5. You will see a “unique_id”

6. This “unique_id” is what you need it will be something like “00:00:00:00:00:00:00:00:2:0x0006”

7. The number before the 0x0006 is the button number.

a. 1 is left button click

b. 2 is right button click

c. 3 is both button click



1. Go to “Configuration”

2. Then “Automations”

3. Hit plus in lower right hand corner

4. Hit “Skip” on the “Powered by Almond” screen

5. Add name for automation (Not needed, but useful and recommenced)

6. Go to “Triggers”

7. Hit the three horizontal lines then choose “Edit as YAML”

8. Paste the following AND MAKE SURE TO CHANGE THE “unique_id” TO MATCH YOURS

  attribute_name: on_off
  unique_id: '00:00:00:00:00:00:00:00:2:0x0006'
  value: Bool.true
event_type: zha_event
platform: event

9. Then go ahead and fill out the Conditions (if there is any) and the Actions

10. Now test. You should have a fully working button without the Xiaomi Home Hub 🙂


Setup Unifi Controller on Debian10 /Buster

The requirements of the Unifi Controller do not allow a direct installation. But with a few manual steps a successful setup is possible!

Basic requirements

apt install wget gnupg2 ca-certificates apt-transport-https dirmngr gnupg software-properties-common multiarch-support

Enable installation of MongoDB 3.4

wget -qO - https://www.mongodb.org/static/pgp/server-3.4.asc |  apt-key add -
echo "deb http://repo.mongodb.org/apt/debian jessie/mongodb-org/3.4 main" | tee /etc/apt/sources.list.d/mongodb-org-3.4.list

Install old libssl required by MongoDB

wget http://security.debian.org/debian-security/pool/updates/main/o/openssl/libssl1.0.0_1.0.1t-1+deb8u12_amd64.deb
dpkg -i libssl1.0.0_1.0.1t-1+deb8u12_amd64.deb

Install JDK 8

add-apt-repository --yes https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/
wget -qO - https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public |  apt-key add -
apt update && apt install adoptopenjdk-8-hotspot

Set JDK for Unifi

echo "JAVA_HOME=/usr/lib/jvm/adoptopenjdk-8-hotspot-amd64" > /etc/default/unifi

Install Unifi Controller

apt-key adv --keyserver keyserver.ubuntu.com --recv 06E85760C0A52C50
echo 'deb https://www.ui.com/downloads/unifi/debian stable ubiquiti' | tee /etc/apt/sources.list.d/100-ubnt-unifi.list
apt update && apt install unifi

Bypass PiHole DNS using PiHole DHCP

This works if you’re having PiHole hand out DHCP on your network.

nano /etc/dnsmasq.d/05-no-pihole-dhcp.conf

Now we need to add the following to the file. You can change to anything you want

# Assign alternate DNS for select hosts
# Set Specific Clients to be affected
dhcp-mac=set:altdns,00:00:00:00:00:00 #Device 1
dhcp-mac=set:altdns,00:00:00:00:00:00 #Device 2

# Set Alternate DNS

Empora Total power usage email report

For this to work you will need to dump a CSV export at least twice a month and then upload the CSVs from the ZIP to nextcloud. This could honestly be from anywhere nextcloud is just easy for me.

Here’s links to the files. I try my best to paste them in the blog, but it doesn’t work work as well as I’d like.




WP Search-Replace

This is how to use wp-cli to change the domain

If using CentOS

sudo -u nginx wp search-replace 'old.domain.com' 'newdomain.com'

If using Plesk
sudo -u user /opt/plesk/php/7.1/bin/php /usr/local/bin/wp search-replace 'old.domain.com' 'newdomain.com'

Remote Control Terminal Session Windows Server

I just learned that you can remote control terminal sessions. They call it shadowing. I’ve only done it on Windows Server 2012 r2, but was super easy. You just need to open server manager, go to remote desktop services, then collections, then QuickSessionsCollections. Then you’ll see the connections in the upper right hand corner. Once you find the one you want you right click on the session and hit Shadow. By default this will ask the user to allow, if you want to override that and allows allow you can do the following group policy change. Open Group Policy Editor and Edit the “Computer > Policies > Administrative Templates > Windows Components > Remote Desktop Services > Remote Desktop Session Host > Connections > right click on Set rules for remote control of Remote Desktop Services user sessions and then hit enabled. Then from the drop down choose “Full Control without user’s permissions.” Now you can view/control the session without any knowledge/inconvenience to the end user.

XCP-NG Quick Notes

I learned about XCP-NG not to log ago and love it. It’s great and easy to use. My only issue is I guess on newer versions of Windows 10/Server 2019 they were having freezing issues. I had the issue with Windows 10. I just went with Windows 7 VMs for what I needed until they get the problem worked out. XCP-NG works great with Linux. Here are some useful commands I’ve found.

List VMs
xe vm-list

Lower RAM needed for VM that was built from a template. You can also do this for the dom0 which is the main VM that runs everything. They say not to do it, but it’s been working for me
xe vm-param-set memory-static-min=512MiB uuid=UUID-FOUND-FROM-LIST-ABOVE

Setting the XCP-NG to allow Auto-Start. Since by default you can enable it on each VM, but it still doesn’t work until you do the below.

  1. Gather the UUIDs of the pools you wish to auto-start.
  2. To get the list of the pools on your XenServer, run xe pool-list
  3. Copy the UUID of the pool. If you have just one server, it will still have a pool UUID as noted in the following
  4. Then type the following command to set the pool or server to allow auto-start:
    xe pool-param-set uuid=UUID other-config:auto_poweron=true
    Note: Replacing UUID with the UUID of the XenServer or pool.

Setting the Virtual Machines to Auto-Start

  1. Gather the UUIDs of the Virtual Machine you want to auto-start by running xe vm-list.
  2. Copy the UUID of the Virtual Machines you want to auto-start, and run the following command for each Virtual Machine to auto-start:
    xe vm-param-set uuid=UUID other-config:auto_poweron=true
    Note: Replace UUID with the UUID of the Virtual Machine to auto-start. obtained in step 1

Search and replace WordPress Database

Below is the search and replace for WP which I find really helpful when changing to a new domain. I hate it when people make me provide email to download stuff so I have also included a direct download link HERE. I DO NOT TAKE ANY RESPONSIBILITY FOR USING THIS. MAKE SURE TO BACK UP YOUR DATABASE BEFORE YOU USE THIS SOFTWARE. ALSO THIS MAY NOT BE THE NEWEST VERSION SO IF YOU WANT THE NEWEST VERSION FOR SURE GO TO THE SITE. As always if someone would like me to remove the post just let me know.


NextCloud with Apache behind NGINX reverse proxy on CentOS

This is probably useful to figure out how to reverse proxy Apache behind NGINX, but I was finally able to get NextCloud working on NGINX with no problem

I like to use NGINX as my web server because that’s what I’ve always worked with. I’ve tried a couple times to get NGINX to work with NextCloud, but it would also end up not letting me log in. I did some Googleing and I guess it has something to do with how the cache is handled in NGINX. I tried to give the location correct permissions, but it still didn’t work so I figured what the heck lets use Apache behind NGINX. This is being ran on CentOS 7 I would assume you could do the same with Debian. As with most of my other writeups, this isn’t a complete start to finish it’s just notes that should help me down the road if I ever need to do this again.

Set up nginx reverse proxy

nano /etc/nginx/sites-available/cloud.example.com

server {
        listen 443;
        ssl_certificate           /etc/nginx/ssl/cloud.example.com/crt;
        ssl_certificate_key        /etc/nginx/ssl/cloud.example.com/key;
        ssl on;
        ssl_session_cache  builtin:1000  shared:SSL:10m;
        ssl_protocols TLSv1.2 TLSv1.1 TLSv1;

        root /var/www/html/nextcloud;
        index index.php index.html index.htm;

        server_name cloud.example.com;

        location / {
                proxy_set_header Host $host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

location = /robots.txt { return 200 "User-agent: *\nDisallow: /\n"; }

We then need to enable the reverse proxy on NGINX
ln -s /etc/nginx/sites-available/cloud.example.com /etc/nginx/sites-enabled/

Now we need to install apache and install php for apache

yum --enablerepo=remi-php72 install php httpd

Now we need to edit the apache config for NextCloud

nano /etc/httpd/conf.d/000-cloud.example.com.conf

Paste this into the file. I can’t get wordpress formatting just right so I just pasted it in my pastebin. LINK

Now we can test to make sure apache test passes
apachectl configtest

Now we can run nginx test to make sure it works
nginx -t

If both the of above pass without any horrible errors we can reload both with the command below
systemctl reload httpd nginx

MariaDB is recoomended, but you can just use the default SQLite if you’d like. To install and configure MariaDB there’s already a bunch of tutorials on that.

Now we want to start the nextcloud installation

Create nextcloud directory and go to it
mkdir /var/www/nextcloud; cd /var/www/nextcloud

Now we want to download the installer
wget https://download.nextcloud.com/server/installer/setup-nextcloud.php

Now we should be able to run the installer by going to https://cloud.example.com/setup-nextcloud.php then choose . (period) to where you want to install nextcloud. Just follow the steps and you should be good to go.

Now we need to configure NextCloud to use the X-Forward-For header.
nano /var/www/nextcloud/config/config.php

Append the follow to the file above the last ‘);’
'trusted_proxies' => [''],

We now need to tell apache to use the x-forward-for header in the logs

When you start out, your httpd.conf will look something like this:

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
CustomLog "logs/access_log" combined

Now the %h is already there to capture your header, which, by default, will capture the IP of the Loadbalancer (the last proxy server that the traffic came from). All of these entries need to commented out.

Assuming you have X-Forwarded-For enabled in the load balancer (or whatever proxy server you’re using), you can capture the source IP from the original client. You’ll need to change your config file entries to look like this:

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" proxy
SetEnvIf X-Forwarded-For "^.*\..*\..*\..*" forwarded
CustomLog "logs/access_log" combined env=!forwarded
CustomLog "logs/access_log" proxy env=forwarded

Supermicro X9 Hangs on Windows 10 reboot

This data has been copied from HERE

Please follow the steps below:

1) Turn off the system completely, and turn it back on, you should be able to get back into the OS.

2)Download the following driver and extract it:

https://downloadcenter.intel.com/download/22655/Intel-Chipset-Device-Software-for-HECI or

my link here, this may not be the newest intel_chipset_SPS_MEI_NULL_v1.2.3.2003

3) Open up Device Manager

4) View >> Show hidden devices

5) In the main window, expand System devices and look the device written exactly as “Intel(R) Management Engine Interface”

6) Right click on entry >> Update Driver Software

7) Click on “Browse my computer for driver software”

8) Click on “Let me pick from a list of device drivers on my computer”

9) Click on “Have Disk…”

10) Click on browse and navigate to where you extracted the file from step 1, then go to ‘SPS_MEI_NULL_DRV_1.2.3.2003\All\patsHECI.inf’

11) Click Open >> OK >> Next >> Close

12) Restart the system

13) Go back to Device Manager and make sure you see “Intel C600 Series Management Engine Interface – 1D3A” and not “Intel(R) Management Engine Interface” in the hidden devices