GithubHelp home page GithubHelp logo

joshuar / go-hass-anything Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 1.0 482 KB

Send anything to Home Assistant, through MQTT, powered by Go.

License: MIT License

Shell 0.53% Go 97.94% Dockerfile 1.53%
go golang-app golang-package home home-assistant mqtt

go-hass-anything's Introduction

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

go-hass-anything's People

Contributors

dependabot[bot] avatar github-actions[bot] avatar joshuar avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

vioneta

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.