Send anything to Home Assistant, through MQTT, powered by Go.
Go Hass Anything is a framework for writing self-contained apps in Go that can send data and listen for controls to/from Home Assistant, over MQTT. This can be useful for adding sensors or controls to Home Assistant that are not available through an existing Home Assistant integration.
The code is flexible to be imported as a package into your own Go code to provide this functionality, or it can be run as its own “agent” process that will manage any apps you write. See the example app or the docs for more details on both use-cases.
Note
It's recommended to create your own container to run a Go Hass Anything agent with your own apps. The pre-built container cannot be customised and the agent will only run an example app to demonstrate functionality. Create your own apps and add them to the agent by following the development docs.
Pre-built containers that can run a demo app can be found on the packages page on GitHub.
podman
is the recommended container engine for running Go Hass Anything.
To run the agent, you first need to configure the MQTT connection. Use the command:
podman run --interactive --tty --rm \
--volume ~/go-hass-anything:/home/gouser:U \
ghcr.io/joshuar/go-hass-anything configure
This will open a user interface in the terminal to enter MQTT connection details. You can navigate the fields via the keyboard.
Once the agent is configured, you can run it. Use the command:
podman run --name my-go-hass-anything \
--volume ~/go-hass-anything:/home/gouser:U \
ghcr.io/joshuar/go-hass-anything
This will start the agent and any configured apps. If needed each app will send initial configuration data to Home Assistant that is needed to register its entities. After that, the app should start sending data to Home Assistant and should be visible under the MQTT Integration.
If needed/desired, you can remove the app entities from Home Assistant by running the command:
podman exec my-go-hass-anything clear
After this, there should be no devices (from Go Hass Anything) and associated entities in Home Assistant. If you want to re-add them, execute the run command again.
More to come!
Currently, only Linux is supported. Though the code is designed to be extensible to other operating systems. See the development docs for details on how to extend for other operating systems.
- Found an issue? Please report it!
- Have a suggestion for a feature? Submit a feature request!
- Want to help develop Go Hass Anything? See the contributing guidelines.