Stream of Consciousness

Mark Eschbach's random writings on various topics.

Deploying Home Assistant on k8s

Categories: programming

Tags: k8s home-assistant

Alright-y, let us see if I can pull a deployment within next hour to get this ready to control some smart plugs. To get things kicked off I just bit the bullet and deployed from k8s@home chart. I figured as I learn more I’ll probably spend some time to roll a chart, especially needing the spouse acceptance factor.

Initial Setup

Pretty easy to setup the first user and get them onboard. Definitely should give the application your home location. There was one funky situation where a login redirection caused an invalid login…something which I do not hope happens again.

Tasmota Integration

I installed the Tasmota integration since this is my current use case. An MQTT broker is actually required, so I will need to deploy a broker also. According to Home Assistant’s website the only supported broker is Mosquitto. Sigh, it is an Eclipse project, hopefully it will not be hard to configure. I guess that makes sense since IBM was involved in creating MQTT.

My Google Fu must be weak today. Best chart I can find again for a fast deployment is k8s@home. Just to get things off the ground I will try this out.

Debuging MQTT

So the Tasmota automatic discovery is deprecated. There is also something funky going on with message delivery for the Tasmota software as the consumer just hangs. To remove Home Assistant as a culprit I went straight to the MQTT broker’s container. The following commands are helpful for interacting with teh device

# to listen to a device command results
mosquitto_sub -v -t 'stat/switch_tree/RESULT'
# to toggle the power state
mosquitto_pub -t cmnd/switch_tree/Power -m 'toggle'
# to query the power state
mosquitto_pub -t cmnd/switch_tree/Power -n

NOTE: the device here is named switch_tree

Finally discovered.

Leo’s Notes Wiki entry on Home Assistant helped verify I should have Home Assistant in the correct configuration. Effectively I had to run SetOption19 0 on the Sonoff S31 device and restart Home Assistant. Not exactly what the difference between discovery modes are, however the device now shows up in the test environment.

Currently it seems here are the material elements.

  • Mosquitto broker deployed via k8s@home’s chart.
  • S31 configured to use:
    • MQTT Broker address
    • SetOption19 0 within the user interface
  • Home Assistant
    • Add the Tasmota integration
    • Configure the MQTT integration to connect to the broker.
    • Restart Home Assistant