go-hass-anything

command module
v4.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 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.

⬇️ Installation

Packages

Head over to the releases page and download the appropriate package for your operating system and/or distribution:

  • For Fedora, use the .rpm.
  • For Ubuntu, use the .deb.
  • For Arch, use the .tar.zst.

Any other distributions not listed above, you can try the binary, or build it yourself from source (see development docs).

Container

A Dockerfile that you can use to build an image can be found here.

To add your own apps to the container, copy them into a directory in the base of the repo (for example, apps/) and then specify the build arg APPDIR pointing to this location:

podman build --file ./Dockerfile --tag go-hass-anything --build-arg APPDIR=apps

🖱️ Usage

Configuration

To run the agent, you first need to configure the MQTT connection. For a package install, use the command:

go-hass-anything configure

For a container, use the following:

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. To do so, for package installs, use the command:

go-hass-anything run

For a container, run:

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.

[!NOTE] By default, the agent only runs a single example app that will fetch load averages from the local system, current temperature from an online weather service and add a button to open the Home Assistant homepage. Add your own apps by following the development docs.

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:

# for a package install
go-hass-anything clear
# for a container install
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.

🤝 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