Skip to content

nomlab/HABitatX

 
 

Repository files navigation

English | 日本語

HABitatX

HABitatX is a tool that supports batch management of multiple devices, which tends to be complicated in the openHAB smart home system. This system works as an interface to provide batch management operations for openHAB. It is required that openHAB is running. The system operates as a stand-alone application and runs on the same computer as openHAB. It can create, modify, and delete text files that configure openHAB devices at once.

Text files that configure openHAB devices are created from template codes and spreadsheets. Template code defines the structure of a text file that configures the openHAB device. Template code is an embedded type and creates a text file by embedding information obtained from external sources in specified locations. It uses ERB, a template engine, as the format. A spreadsheet is an interface that contains a list of information to be embedded in the template code. It uses Excel as the format.

HABitatX" is a term coined from "openHAB", "habitat", and "X" which represents a vision for the future.

Requirements

  • Ruby 3.3.3
  • Ruby on Rails 7.1.3.4
  • openHAB 3.4.3 ~
  • RDBMS (Relational Data Base Management System)

Setup

HABitatX

  1. Clone this repository
    $ git clone https://github.com/SenoOh/HABitatX.git

Install RDBMS

This system uses ActiveRecord for DB connection, so it can use relational database management system (RDBMS). When you use Docker to launch HABitatX, you need not to install it. We explain the installation of SQLite3 as an example.

  1. Install SQlite3
    $ sudo apt install sqlite3

Launch

Preliminary Preparations

  1. Copy .env.example file and create .env file.
  2. Replace OPENHAB_PATH and OPENHAB_LINK in the .env file with your own information.
  3. When using containers, complete the port and UID settings in the .env file.
  4. For production environment, set RAILS_ENV to production in the .env file and generate SECRET_KEY_BASE.
  5. Change access permissions for OPENHAB_PATH
  • For Docker
    $ sudo chgrp -R ${UID} ${OPENHAB_PATH}
    $ sudo chmod -R 775 ${OPENHAB_PATH}
    • Example: UID:1000, OPENHAB_PATH:/etc/openhab
      $ sudo chgrp -R 1000 /etc/openhab
      $ sudo chmod -R 775 /etc/openhab

Docker (Recommended)

  1. Build container image
$ ./start.sh

After launching, open http://localhost:9000 in your browser to open the HABitatX screen.

Linux

  1. bundle install
    $ bundle install
  2. Generate DB
    $ rails db:migrate
  3. Launch
$ bundle exec rails server

After launching, open http://localhost:9000 in your browser to open the HABitatX screen.

Usage

Overview

  1. Create template code
    table.each do |member|
       equipment(name: "#{member[:name]}", label: "#{member[:label]}", icon: "Man_1", parent: "room106") do
          point(name: "#{member[:name]}_position", label: "#{member[:label]} Position", type: "String", icon: "motion", parent: "positions", tags: ["Point", "Presence"])
          point(name: "#{member[:name]}_status", label: "#{member[:label]} Status", type: "String", icon: "status", tags: ["Point", "Presence"])
       end
    end
  2. Set template name, base name, file type, and Content in the template management section Template
  • Code is the template code
  • Create configuration DSL name by combining base name and template name
  • File type is the extension to select
  • Content is the template code created in step 1
  1. Create spreadsheet
  1. Set item name, spreadsheet, and template in the item management section Device

  2. Batch create devices

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 50.7%
  • HTML 21.9%
  • CSS 18.9%
  • JavaScript 3.7%
  • Dockerfile 3.0%
  • Shell 1.8%