Giter VIP home page Giter VIP logo

homeassistant-gamepad's Introduction

homeassistant-gamepad

Toggle a home assistant input using a USB gamepad.

buttons-pushed

It uses evdev to read Linux input devices, and homeassistant-api to toggle a group of lights in home assistant.

Basic Usage

Build the docker image

docker build . -t homeassistant-gamepad

Create and set your access token, from your Profile -> Long-Lived Access Tokens -> Create Token

export HOMEASSISTANT_TOKEN=...

Run the docker image

docker run --rm -it \
  --device=/dev/input/event0 \
  -e HOMEASSISTANT_TOKEN \
  -e HOMEASSISTANT_URL=http://192.168.1.8:8123/api \
  -e HOMEASSISTANT_ENTITY=light.office_lights \
  -e INPUT_DEVICE=/dev/input/event0 \
  homeassistant-gamepad

Note: If you have exported the environment variable HOMEASSISTANT_TOKEN for your current user, and are using sudo to run docker, you may need to preserve environment variables with sudo -E.

Docker Compose

version: '3'
services:
homeassistant-gamepad:
    build: .
    devices:
        - /dev/input/event0
    restart: unless-stopped
    environment:
        - HOMEASSISTANT_TOKEN
        - HOMEASSISTANT_URL=http://127.0.0.1:8123/api
        - HOMEASSISTANT_ENTITY=light.office_lights
        - INPUT_DEVICE=/dev/input/event0

This assumes you have set HOMEASSISTANT_TOKEN in your current shell.

homeassistant-gamepad's People

Contributors

stoggi avatar

Watchers

 avatar

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.