Coder Social home page Coder Social logo

matchlighter / typedaemon Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 715 KB

TypeScript-based Automations for Home Assistant

Dockerfile 0.83% Shell 1.32% TypeScript 95.36% JavaScript 1.57% Python 0.64% Nearley 0.29%
automation homeassistant homeassistant-integration

typedaemon's Introduction

TypeDaemon

Typescript-based application environment for Home Assistant. Similar in principle to AppDaemon, but swaps Python for Javascript/Typescript.

Aims to "include the batteries", providing simple, clean APIs for writing automations - just take a look at the example.

TypeDaemon is still a work in progress. It works to do what I do in my production Home Assistant and has been stable, but it is still beta software - there are probably bugs and things may change.

Installation

Hassio (Recommended)

  1. Add the https://github.com/Matchlighter/typedaemon-hassio repository by:
    1. Navigating to Home Assistant Settings > Addons > Add-on Store
    2. Access the kebab menu in the upper right, and select "Repositories"
    3. Paste https://github.com/Matchlighter/typedaemon-hassio in the "Add" field, then click "ADD".
  2. Reload the page
  3. Find the TypeDaemon section and select the TypeDaemon addon
  4. Install it

Docker/Compose

Installation outside of Hassio is technically possible, but I've chosen not to allocate time figuring it out and writing docs. If you're going to go this direction, you should have an intermediate understanding of Linux and Docker, and be willing to spend some time digging and throwing stuff at the wall.

I'm happy to entertain a PR that fills in this section more.

Getting Started

Upon startup, TypeDaemon will create a template configuration (at /config/typedaemon for Hassio, or in the directory mounted to /config for Docker/Compose).

Presently, the only API documentation that TypeDaemon provides is via Typescript and JSDoc comments, so it is highly recommended to use VS Code / Studio Code Server when writing TypeDaemon apps. All APIs and utilities provided by TypeDaemon can be imported from @td. Check out the example app templates to get a feel for things.

CLI Basics

TypeDaemon has a simple CLI for doing some basic tasks. For Hassio installs, you can run ./td --help from the typedaemon config directory.

TypeDaemon runs completely in Docker, but apps/config are expected to be edited outside of Docker. This split would normally require you to be highly aware of where you're executing commands, with some commands only working if you properly enter the Docker container before execution. The TypeDaemon CLI tries to simplify this and work some magic to automatically enter the container and map paths when necessarry.

You can execute an arbitrary command in-container with ./td exec CMD. You can easily gain an in-container shell with ./td shell.

Syncing the Dev Environment

TypeDaemon tries to abstract the need for you to learn how JS packaging and NPM work. It does this by generating the appropriate configs and automagically downloading appropriate typings and support files. This process occurs automatically upon first startup and when TypeDaemon detects that it was updated, but you can also manually trigger this by running ./td dev_env

Where thar be Dragons

Using the edge/dev Version

The TypeDaemon edge/dev addon does not auto-update. To pull the latest version, run docker pull ghcr.io/matchlighter/typedaemon:edge and restart the addon. The edge image is built from the latest code pushed to the master branch of this repo.

typedaemon's People

Contributors

matchlighter avatar

Stargazers

 avatar  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.