- Ubuntu 16.04 LTS
- OpenSSL 1.0.2g 1 Mar 2016
Download server certificate
### Show certificate
$ openssl s_client -connect host:port -showcerts
### Download certificate
$ echo | openssl s_client -connect host:port 2>&1 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > server.crt.pem
2-way TLS authentication test
Say, we’ve downloaded server certificate and generated your client private key and certificate. Now we want to test if everything works:
$ openssl s_client -connect hostname:port -CAfile server.crt.pem -cert client.crt.pem -key client-private.key.pem
If you private key is protected with a password you’ll be prompted to enter the password.
remove password (passphrase) from private key
You might want to remove the password from private key:
openssl rsa -in private.key.pem -out newprivate.key.pem
Flower Care sensor
Looks and feels very nice:
Be aware that there are two versions of the sensor – Chinese and international. I saw complains on internet about chinese sensor that were bricked after software upgrade when used outside of China. It is not quite clear what exactly was bricked – mobile phone app or the sensor itself.
Python demo on Raspbery Pi
Details see on GitHub.
$ git clone https://github.com/open-homeautomation/miflora.git
$ cd miflora/
$ . ./build.sh
$ python3 setup.py build
$ sudo python3 setup.py install
$ python3 demo.py C4:7C:8D:xx:xx:xx
Getting data from Mi Flora
Name: Flower care
Taken from: YouTube.
$ sudo apt-get update
$ sudo apt-get dist-upgrade
### Install mosquitto
$ sudo apt-get install mosquitto
### Install mosquitto clients
$ sudo apt-get install mosquitto-clients
### Console 1
$ mosquitto_sub -t "hellomosquitto"
### Console 2
$ mosquitto_pub -t "hellomosquitto" -m "Hello, Mosquitto!"
### Console 1 will print