Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

mydomoathome

empierre21GPL-2.00.3.11

Imperihome ISS API gateway to Domoticz

Imperihome, Domoticz, ISS API, DSM, IoT, Synology

readme

MyDomoAtHome nodeJS

REST Gateway between Domoticz and Imperihome ISS

NPM Version NPM REST DOCKER DOCKER PayPal donate button

LICENSE MP REST REST REST REST Documentation en Français: https://github.com/empierre/MyDomoAtHome/blob/nodejs/README_FR.md MyDomoAtHome

Important update for Bullseyes

Do the following to install

curl -fsSL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt-get install -y nodejs
wget https://www.e-nef.com/domoticz/mdah/node-mydomoathome-0.2.48.deb
sudo dpkg -i node-mydomoathome-0.2.48.deb

Important update for Buster

More and more npm (node package manager, needed with node interpreter) are making inssues while installing MDAH, breaking it without any change.

if NPM version is below 2.x.x and you're running Buster please do the following, and then relaunch the upgrade through apt !

npm -v 1.4.21
sudo npm install -g npm

Features and goals

The goal of this project is to provide a REST API to ImperiHome ISS that would allow to see the current state of sensors and interact with them in case of an actuator.

M1 Goal reached - first version in Perl Dancer after ISS has been announced

M2 Goal reached - full rewrite to node js with debian packaging, simpler install and upgrade, better performance, less dependencies

  • Free but you can show you like it ! PayPal donate button

  • Multi-platform (Linux, Mac OS X, Windows)

    • <input checked="" disabled="" type="checkbox"> Dependency-less
    • <input checked="" disabled="" type="checkbox"> Node.js rewrite
    • <input checked="" disabled="" type="checkbox"> Installation / usage logs
  • <input checked="" disabled="" type="checkbox"> Debian package - noarch
    • <input checked="" disabled="" type="checkbox"> Auto updatable through apt-get
    • <input checked="" disabled="" type="checkbox"> Third-party hosting
  • <input checked="" disabled="" type="checkbox"> Micro-services (Docker)
    • <input checked="" disabled="" type="checkbox"> Image available on Docker Hub
  • <input checked="" disabled="" type="checkbox"> Synology
    • <input checked="" disabled="" type="checkbox"> Synology compatible docker image
  • <input checked="" disabled="" type="checkbox"> Support major type of sensors/feature of Domoticz
    • <input checked="" disabled="" type="checkbox"> Weather and Environmental sensors
    • <input checked="" disabled="" type="checkbox"> Energy sensors (Electricity, Gas, Water)
    • <input checked="" disabled="" type="checkbox"> Switches
    • <input checked="" disabled="" type="checkbox"> Thermostat
    • <input checked="" disabled="" type="checkbox"> Dynamic room creation
    • <input checked="" disabled="" type="checkbox"> RGB lamps (Limitless/Applamp/Hue) (depending on Domoticz)
    • <input checked="" disabled="" type="checkbox"> Push On buttons (depending on Imperihome)

M3 Goal reached - full graphs, flexible room usage and UI improvements

  • <input checked="" disabled="" type="checkbox"> Support major type of sensors/feature of Domoticz
    • <input checked="" disabled="" type="checkbox"> Devices following planID
    • <input checked="" disabled="" type="checkbox"> Graphs
    • <input checked="" disabled="" type="checkbox"> Groupe switches with instant energy
    • <input checked="" disabled="" type="checkbox"> Security code managed

M4 milestone will provide extended support to other platforms with Docker and Synology

  • <input checked="" disabled="" type="checkbox"> End to end authentificaton
  • <input checked="" disabled="" type="checkbox"> HTTPS support
  • <input checked="" disabled="" type="checkbox"> Support domoticz Farenheit
  • <input checked="" disabled="" type="checkbox"> Synology
    • <input checked="" disabled="" type="checkbox"> Synology hosted package
  • <input checked="" disabled="" type="checkbox"> Debian package - noarch
    • <input disabled="" type="checkbox"> debian hosted package - need a peer
    • <input disabled="" type="checkbox"> raspbian hosted package
  • TODO
    • <input disabled="" type="checkbox"> Evohome (depending on Imperihome)
    • <input disabled="" type="checkbox"> Alarm pannel (partial with ImperiHome)
    • <input disabled="" type="checkbox"> Auto updatable through button

PayPal donate button

Standalone installation (PI, cubie, odroid, intel...)

NPM

Install procedure

Check the nodeJS version installed - mandatory for PI !

sudo dpkg --list |grep nodejs // should return version 4.x or above

If not please do:

On RASPBIAN (Raspberry PI/PI2/PI3), please install first to have a stable nodeJS :

sudo apt-get remove node
wget -q http://www.e-nef.com/domoticz/mdah/nodejs_4.4.2_armhf.deb
sudo dpkg -i nodejs_4.4.2_armhf.deb
wget -q http://www.e-nef.com/domoticz/mdah/npm_2.14.7_armhf.deb
sudo dpkg -i npm_2.14.7_armhf.deb
sudo npm install -g npm@2.x

On Debian buster :

sudo apt-get install nodejs npm

On all other (debian, ubuntu...), version 4 is required (testing/unstable are fine):

sudo apt-get remove node
sudo dpkg -r nodejs npm
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install -y nodejs

The following commands install npm and then upgrade it to the latest 2.x version.

sudo npm install -g npm@2.x

And check again

node —version // should print version 4.4.x or similar
npm —version // should print version 2.2.x or similar

Installing the software Debian package .deb

  1. start here:

    wget -qO - https://www.e-nef.com/domoticz/mdah/gpg.mykey | sudo apt-key add - sudo nano /etc/apt/sources.list

  2. Add the line:

    deb https://www.e-nef.com/domoticz/mdah/ /

  3. Then:

    sudo apt-get update sudo apt-get install MyDomoAtHome

    Important remark: do not install as root, but sudo as an unprivileged user.

  4. Edit the configuration file with your values:

    sudo nano /etc/mydomoathome/config.json
    sudo service mydomoathome restart

Installing the software on Synology

Add http://www.jadahl.com/domoticz_beta_6/ to your Synology NAS Package Center sources !

The package is node-mydomoathome

Domoticz will run on port 8084 and MDAH on 3002.

Remember to set in Domoticz Settings/Local Networks 127.0.0.1

Installing the software on Windows

download and install nodejs here: https://nodejs.org/en/download/current/

download zip here: https://github.com/empierre/MyDomoAtHome (green clone or download button right)

unzip locally

click window touch+R, type in 'cmd' and enter

go in the unzipped repository

npm install
node mdah.js

to launch do from a cmd window:

node mdah.js 

configuration "config.json" must be in the same directory as the file mdah.js

config.json

  1. It works in a "key":"value" mode. Basic values are:

    { "app_name": "MyDomoAtHome", "auth": null, "tempmode": "C", "domoticz": { "ssl": false, "host": "127.0.0.1", "port": "8080", "path": "/", "auth": null }, "port": "3002", "passcode": "" }

  2. remark: if you have a configuration issue, check that you don't have },} as it is an error of syntax and should be }}

  3. multi-instances: just change the app_name tag between instances
  4. change the MDAH port: change the basic (top level) port (here 3002)
  5. protected device code: change the passcode above
  6. access domoticz in ssl mode: change domoticz:port and ssl to true
  7. change domoticz host or port: do it on domoticz:host and domoticz.port
  8. add a login/pass to access MDAH:change top-level "auth": null to

    "auth": {

    "username": "admin",
    "password": "admin"

    },

  9. manage login/pass on domoticz, do the same in domoticz:path

  10. Variant: start in https mode:

      openssl genrsa 1024 > key.pem
      openssl req -x509 -new -key key.pem > key-cert.pem
  {
    "app_name": "MyDomoAtHome",
    "auth": null,
    "tempmode": "C",
    "https" : true,
    "key" : "test/fixtures/keys/key.pem",
    "cert": "test/fixtures/keys/key-cert.pem",
    "domoticz": {
      "ssl": false,
      "host": "127.0.0.1",
      "port": 8080,
      "path": "/"
    },
   "port": 3002,
   "passcode": ""
  }

Stuck on a pre 0.1.x version

apt-get remove mydomoathome
apt-get update
apt-get install MyDomoAtHome

Migrating from old/Legacy MyDomoAtHome

Shut down the old service

sudo service MyDomoAtHome.sh stop
rm /etc/init.d/MyDomoAtHome.sh

N.B. you can have the both at the same time, just chane the App name in the config.json file and the port.

Migrating from ISS-DOMO

edit /etc/mydomoathome/config.json with your previous port (was 8000 default), change app_name value to ISS-Domo and then restart the service

Running the service

The default port is now 3002.

Start the service:

sudo service mydomoathome start

Stop the service :

sudo service mydomoathome stop

Restart the service :

sudo service mydomoathome reload

Docker installation (only for those using this form: big Synologies, Xpenologies...)

Docker image is automatically build based on latest verion. Configuration can be passed through command line (see below) /etc/mydomoathome is also mounted

Duplicate the image

docker pull epierre/iss-mdah

Launch the process

Remember to change the IP below and authorize in Domoticz the docker IP range

docker run --name=mdah --env DOMO="http://your_ip:8080" --env TZ=Europe/Paris -p 3002:3002 epierre/mdah

Check running docker processes

docker ps

Stoping a docker process

docker stop mdah 

Testing the installation

  • Check in a browser it is running

    http://gateway_ip:gateway_port/

  • From there you'll get the following links in the browser.

  • Check the domoticz is accessible from the hosting machine

    curl http://domoticz_ip:domoticz_port/json.htm?type=devices&filter=all&used=true&order=Name
  • Check the MDAH returns the result from the hosting machine

    curl http://gateway_ip:gateway_port/devices

Accessing the Gateway from the outide of your network

The best way is to setup the nginx for both domoticz and the gateway: http://www.domoticz.com/wiki/Secure_Remote_Access

sudo apt-get install nginx-full sudo apt-get install openssl sudo apt-get install haveged

In the domoticz configuration add a section to redirect to the gateway such as this (change your ip below)

location /iss/ {
  proxy_set_header X-Real-IP  $remote_addr;
  proxy_set_header X-Forwarded-For $remote_addr;
  proxy_set_header Host $host;
  proxy_pass http://192.168.0.28:3002/;
  access_log /var/log/nginx/mdah.access.log;
  error_log /var/log/nginx/mdah.error.log;
}

Advanced support

For an unsupported device or any issue with a particular device, please report with it the JSON from Domoticz with this URL:

    http://domoticz_ip:8080/json.htm?type=devices&filter=all&used=true&order=Name

Support

Q&A

  • Remember to add the gateway in the local networks under setup in domoticz !

changelog

Changelog

All notable changes to this project will be documented in this file. See standard-version for commit guidelines.

0.3.11 (2025-02-12)

0.3.10 (2025-02-12)

0.3.9 (2025-02-12)

0.3.8 (2025-02-12)

Bug Fixes

  • package.json & package-lock.json to reduce vulnerabilities (fe02ec7)

0.3.7 (2023-11-22)

0.3.6 (2023-11-21)

Bug Fixes

  • upgrade winston from 3.9.0 to 3.11.0 (e03f4c8)

0.3.5 (2023-11-14)

0.3.4 (2023-11-14)

0.3.3 (2023-11-14)

0.3.2 (2023-11-11)

0.2.52 (2023-11-11)

0.2.51 (2023-11-11)

Bug Fixes

  • Dockerfile to reduce vulnerabilities (34601af)
  • Dockerfile to reduce vulnerabilities (56eb120)
  • Dockerfile to reduce vulnerabilities (73585b2)
  • Dockerfile to reduce vulnerabilities (c165af5)
  • Dockerfile to reduce vulnerabilities (a75e19a)
  • package.json & package-lock.json to reduce vulnerabilities (4245ffc)
  • package.json & package-lock.json to reduce vulnerabilities (22642a7)
  • package.json & package-lock.json to reduce vulnerabilities (f6c2ef0)
  • packaging/debian/deb-src/sysroot/usr/share/mydomoathome/app/package.json to reduce vulnerabilities (260cdfb)
  • packaging/debian/deb-src/sysroot/usr/share/mydomoathome/app/package.json to reduce vulnerabilities (e411a6e)
  • upgrade basic-auth from 1.0.3 to 1.1.0 (669b738)
  • upgrade basic-auth from 1.0.3 to 1.1.0 (85c98a4)
  • upgrade basic-auth from 1.0.3 to 1.1.0 (60f2905)
  • upgrade body-parser from 1.19.0 to 1.20.0 (032a42c)
  • upgrade body-parser from 1.20.0 to 1.20.1 (41fba1d)
  • upgrade body-parser from 1.20.1 to 1.20.2 (8bcb2e2)
  • upgrade cors from 2.7.1 to 2.8.5 (ae875ee)
  • upgrade ejs from 3.1.7 to 3.1.8 (07df275)
  • upgrade ejs from 3.1.8 to 3.1.9 (ef223fe)
  • upgrade errorhandler from 1.4.3 to 1.5.1 (536393d)
  • upgrade express from 4.17.1 to 4.17.3 (a1d9a73)
  • upgrade express from 4.17.3 to 4.18.0 (8299ac8)
  • upgrade express from 4.18.0 to 4.18.1 (0c3c241)
  • upgrade express from 4.18.1 to 4.18.2 (0abc99d)
  • upgrade express-session from 1.17.1 to 1.17.2 (5f26e32)
  • upgrade express-session from 1.17.2 to 1.17.3 (d0b2a7d)
  • upgrade is-base64 from 0.0.4 to 0.1.0 (8878cd4)
  • upgrade is-base64 from 0.0.4 to 0.1.0 (244a8bc)
  • upgrade minimatch from 5.1.0 to 5.1.1 (9f48ed0)
  • upgrade minimatch from 5.1.1 to 5.1.2 (6f04689)
  • upgrade minimatch from 5.1.2 to 5.1.6 (3730156)
  • upgrade minimist from 1.2.7 to 1.2.8 (d8918f2)
  • upgrade multer from 1.4.2 to 1.4.4 (6e7b957)
  • upgrade sync-request from 3.0.0 to 3.0.1 (520f7a2)
  • upgrade sync-request from 3.0.0 to 3.0.1 (9236fe1)
  • upgrade underscore from 1.12.1 to 1.13.2 (d232e85)
  • upgrade underscore from 1.12.1 to 1.13.2 (4698aa5)
  • upgrade underscore from 1.12.1 to 1.13.2 (e7b6f69)
  • upgrade underscore from 1.13.2 to 1.13.3 (63e0f21)
  • upgrade underscore from 1.13.2 to 1.13.4 (a721c35)
  • upgrade underscore from 1.13.3 to 1.13.4 (cd046cd)
  • upgrade underscore from 1.13.4 to 1.13.6 (268e737)
  • upgrade underscore from 1.13.4 to 1.13.6 (667d289)
  • upgrade winston from 3.10.0 to 3.11.0 (6226ae0)
  • upgrade winston from 3.7.2 to 3.8.0 (e31eaae)
  • upgrade winston from 3.8.0 to 3.8.1 (961111e)
  • upgrade winston from 3.8.1 to 3.8.2 (2da4565)
  • upgrade winston from 3.8.2 to 3.10.0 (93e0727)

0.2.49 (2022-03-05)

0.2.49 (2022-03-02)

0.2.48 (2022-03-02)

0.2.47 (2022-03-02)

0.2.46 (2022-03-02)

0.2.39 (2018-05-31)

0.2.38 (2018-05-31)

0.2.37 (2018-04-02)

0.2.36 (2017-12-22)

0.2.35 (2017-12-10)

0.2.34 (2017-11-28)

0.2.33 (2017-11-27)

0.2.32 (2017-11-14)

0.2.31 (2017-11-06)

0.2.30 (2017-10-27)

0.2.29 (2017-10-07)

0.2.28 (2017-10-07)

0.2.27 (2017-10-07)

0.2.26 (2017-09-20)

0.2.25 (2017-09-20)

0.2.24 (2017-09-20)

0.2.23 (2017-09-20)

0.2.22 (2017-09-20)

0.2.21 (2017-09-20)

0.2.20 (2017-09-19)

0.2.19 (2017-09-19)

0.2.18 (2017-09-06)

0.2.17 (2017-09-06)

0.2.16 (2017-09-05)

0.2.15 (2017-09-02)

0.2.14 (2017-09-02)

0.2.13 (2017-09-01)

0.2.12 (2017-08-31)

0.2.11 (2017-08-31)

0.2.10 (2017-08-31)

0.2.8 (2017-02-26)

0.2.7 (2016-11-26)

0.2.6 (2016-11-20)

0.2.5 (2016-11-20)

0.2.4 (2016-11-19)

0.2.2 (2016-11-13)

0.2.1 (2016-11-05)

0.1.60 (2016-11-05)

0.1.59 (2016-11-04)

0.1.52 (2016-10-06)

0.1.51 (2016-05-29)

Bug Fixes

  • general/kWh: fixed parsing of cumulated value, thanks to Toutazimuth (d743dd6)

0.1.50 (2016-05-28)

0.1.49 (2016-05-28)

Bug Fixes

  • spk: add app path+logs on startu (fb8f5e1)
  • spk: addind 8084 as default port sor synology (26d04fc)
  • spk: spk builder (83bd00d)

Unreleased (2016-05-28)

Bug Fixes

  • spk: add app path+logs on startu (fb8f5e1)
  • spk: addind 8084 as default port sor synology (26d04fc)
  • spk: spk builder (83bd00d)

0.1.39 (2016-05-02)

Bug Fixes

0.1.38 (2016-05-01)

0.1.37 (2016-05-01)

Unreleased (2016-04-21)

0.1.33 (2016-04-21)

0.0.47

  • Corrected
    • startup issues on PI 1
    • app_name now taken into account
    • basic Dimmer issue