Mi Flora, Home ASSISTANT and MQTT Gateway

I’ve recently got an ESP32 and decided to try and use it as an MQTT gateway for my hassio installation. It’s running on esx on a NUC and no matter what I do I can’t get bluetooth to work, so I gave up and bought this little controller.

Instructions to install it are here – https://docs.openmqttgateway.com/ It took a bit of fiddling with some io errors. If using adrduino ide you might have to make some changes such as setting the board partition to be minimal SPIFFS.

After installation connect to it via it’s AP, give it your wifi information and MQTT broker and you should see things appear. The MiFlora will show under something like home/OpenMQTTGateway/BTtoMQTT/MACADDRESS

Once it’s there, it’s fairly simple to set up the sensor within HA. But here’s my code for the lazy:

  • #replace MAC with your actuall mac address!
  • platform: mqtt
    state_topic: 'home/OpenMQTTGateway/BTtoMQTT/MAC
    name: "plant_temperature"
    unit_of_measurement: '°C'
    value_template: '{{ value_json.tem | is_defined }}'
  • platform: mqtt
    state_topic: 'home/OpenMQTTGateway/BTtoMQTT/MAC'
    name: "plant_moisture"
    unit_of_measurement: '%'
    value_template: '{{ value_json.moi | is_defined }}'
  • platform: mqtt
    state_topic: 'home/OpenMQTTGateway/BTtoMQTT/MAC'
    name: "plant_battery"
    unit_of_measurement: '%'
    value_template: '{{ value_json.bat | is_defined }}'
  • platform: mqtt
    state_topic: 'home/OpenMQTTGateway/BTtoMQTT/MAC'
    name: "plant_fertiliser"
    unit_of_measurement: '%'
    value_template: '{{ value_json.fer | is_defined }}'
  • platform: mqtt
    state_topic: 'home/OpenMQTTGateway/BTtoMQTT/MAC'
    name: "plant_light"
    unit_of_measurement: 'lux'
    value_template: '{{ value_json.lux | is_defined }}'

Hassio and ESXi

I’ve been messing with homeassistant for a while on the raspberry pi 3, it worked fine, but after a while and many automatons and connections, it began to become slow. I swapped out the sd card for a usb ssd which helped, but that was only a temporary fix. Eventually I got around to buying a cheap intel NUC. It’s a lot quicker. I stuck esxi on it as there’s a free version, and I want to consolidate my growing Pi collection.

Hasio works pretty well on the nuc, its a lot quicker than the pi. However the default disk size is ridiculous. 6gb. It wasn’t long before I ran out of space and had to increase it. This took a ridiculously long time to figure out. I tried to access the underlying OS, as HA runs in a docker container so I cant give it more space from that. After several days of messing around with SSH keys I gave up. I eventaully found a port that said to do this:

  • Expand the VMDK
  • Boot from GParted ISO (I had to change my bios to “bios” not “uefi” for it to work)
  • Expand the partition
  • Disconnect the iso, start HA

That was it.

Home Assistant and Raspberry Pi Cam

The documentation to install this is somewhat lacking. Assuming you are running Home Assistant as user “homeassistant”, you’ll need to do this:

Connect the camera and enable it as detailed here – https://www.raspberrypi.org/learning/getting-started-with-picamera/worksheet/ don’t reboot it yet.

update the firmware: sudo rpi-update

reboot

give the homeassistant user permissions to read the device by adding them to the “video” group – sudo usermod -a -G video homeassistant

You’ll need to restart home assistant to pick up the group changes

 

 

 

 

 

Intel ATM and SCCM

I hate this. I can’t figure out how it works. It will install fine sometimes, and then not others. So far, after various amounts of fiddling I think I have it running. You’ll get the odd error messages, kerberos authentication will randomly work or not… But I think I’m in a happy place now.

Anyway, I plan to add error messages to this post that you may hit. So far, I’ve modified the task sequence so that error 42 is considered a success. This just indicates it didn’t have permission to save the log file for whatever reason. Another one I’ve seen is:
(0xc0002823). Call to function failed. DNS name does not exist. (0xc0000018)
The error code at the end actually means the exact opposite and that there are two IP addresses in DNS for this computer. This happens with us as people often connect via VPN which is in a different range. Delete the offending IP from DNS and try it again.