1.4.5 • Published 2 years ago

domoja-core v1.4.5

Weekly downloads
28
License
GPL-3.0
Repository
github
Last release
2 years ago

NPM

Build Status NPM version Dependency Status Coverage Status

domoja

A Typescript framework for home automation

Introduction

This framework allows to create home automation applications.

The server part is written in Typescript, while the GUI uses Angular and Iconic.

Here are some screenshots of the application:

Concepts

Domoja collects information from and interacts with devices through sources. You can think of sources as sources of information.

Sources

Devices

The framework supports a range of devices:

  • device: a generic device with attributes which can be set or get.
  • relay: a particular switch, for which delays can be configured.
  • variable: a special device that contains a value which can be read or written.

Modules

Domoja can be extended through modules, to add new sources, devices, etc. They are essentially npm modules following particular specifications:

  • their name must start with domoja-
  • they must derive from domoModule

Available modules

The following modules are currently available:

API

Domoja provides a REST/JSON api, which is available through Swagger at /api-docs(http://localhost/api-docs).

  • GET /devices: Retrieves the list of devices
  • GET /devices/{id}: Retrieves a device
  • POST /devices/{id}: Sends a command to a device
  • GET /pages: Retrieves the list of pages
  • GET /app: Retrieves the app data
  • POST /app/demo-mode: Sets the app demo mode

User Interface

Domoja comes with a generic user interface that can be configured through the configuration file. However, custom pages or components can be added easily

Add a new page

# generate the page with Ionic
$ ionic generate page dmj-<pagename>

The file <pagename>.module.ts can be safely deleted.

Then, add the page in src/pages/providers/page-components/page-components.ts. You can then customize and use the page.

Add a new dashboard component

# generate the component with Ionic
$ ionic generate component DmjDashboard<ComponentName>

In the file src/components/dmj-dashboard-<component-name>.ts, make the class DmjComponentName derive from DmjDashboardComponent, after importing with:

import { Component } from '@angular/core';
import { DmjDashboardComponent } from '../dmj-dashboard-component';


@Component({
  selector: 'dmj-dashboard-<component-name>',
  templateUrl: 'dmj-dashboard-<component-name>.html'
})
export class DmjDashboard<ComponentName> extends DmjDashboardComponent {

  constructor() {
    super();
  }

}