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.
- Ruby 3.3.3
- Ruby on Rails 7.1.3.4
- openHAB 3.4.3 ~
- RDBMS (Relational Data Base Management System)
- Clone this repository
$ git clone https://github.com/SenoOh/HABitatX.git
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.
- Install SQlite3
$ sudo apt install sqlite3
- Copy
.env.examplefile and create.envfile. - Replace
OPENHAB_PATHandOPENHAB_LINKin the.envfile with your own information. - When using containers, complete the port and UID settings in the
.envfile. - For production environment, set
RAILS_ENVtoproductionin the.envfile and generateSECRET_KEY_BASE. - 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
- Example: UID:1000, OPENHAB_PATH:/etc/openhab
- Build container image
$ ./start.shAfter launching, open http://localhost:9000 in your browser to open the HABitatX screen.
- For production environment, open http://localhost:9100 in your browser after launching.
- bundle install
$ bundle install
- Generate DB
$ rails db:migrate
- Launch
$ bundle exec rails serverAfter launching, open http://localhost:9000 in your browser to open the HABitatX screen.
- 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
- Set template name, base name, file type, and Content in the template management section

- 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
- Create spreadsheet
- See spreadsheet for how to create

