go-hass-anything

command module
v9.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 22, 2024 License: MIT Imports: 3 Imported by: 0

README

Go Hass Anything

MIT GitHub last commit Go Report Card Go Reference Release

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.

⬇️ Installation

[!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.

Container

Pre-built containers that can run a demo app can be found on the packages page on GitHub.

🖱️ Usage

podman is the recommended container engine for running Go Hass Anything.

Configuration

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.

Running

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.

Other Actions
Reset/Remove app data from Home Assistant

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.

🤖 Supported Home Assistant Entities

More to come!

🤝 Compatibility

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.

Issues, Feature Requests, Contributing

License

MIT

Documentation

Overview

Copyright (c) 2023 Joshua Rich <joshua.rich@gmail.com>

This software is released under the MIT License. https://opensource.org/licenses/MIT

Directories

Path Synopsis
internal
pkg
web
tools

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL