Skip to content

Install NimHA

Thomas T. Jarløv edited this page May 23, 2019 · 7 revisions

NimHA can be installed in 2 ways - through Nimble or you can compile it.

Compiling

Available compile options are shown below

Run:

cd
git clone https://github.com/ThomasTJdev/nim_homeassistant.git
cd nim_homeassistant
nim c -r nimha.nim

Compile options

When you are compiling NimHA, you have access to the following compile options. Append the parameters to nim c nimha.nim.

  • -d:dev = Run development/debug mode
  • -d:devmailon = Allow sending mails in dev mode
  • -d:logoutput = Enhanced logging
  • -d:rpi = Enable RPi
  • -d:rc = Recompile all modules. NimHA will not recompile modules without this if the modules exists. To recompile a single module use the options below.
  • -d:rcwss = Recompile Websocket
  • -d:rccron = Recompile Cron
  • -d:rcwebinterface = Recompile Webinterface
  • -d:rcgatewaywss = Recompile Websocket gateway
  • -d:rcgateway = Recompile Main gateway
  • -d:rcxlistener = Recompile Xiaomi listener
  • -d:systemInstall = This will install NimHA on your system using e.g. /etc/nimha. Please see the section below for details.

Nimble

Run:

nimble install nimha

Update config

Your config file (secret.cfg) are located in the config-folder.

Copy the template before editing:

cp config/secret_default.cfg config/secret.cfg

Required config update

It is required that the following details are updated:

  • [MQTT]
  • [Websocket] - only needs update if you are using Nginx/SSL

Add an admin user

To get access to NimHA, you need to add an admin user. Only 1 admin user is allowed.

Run NimHA with following arguments:

./nimha newuser -u:username -p:password -e:my@email.com

Run NimHA

Make sure that your MQTT broker is up and running, e.g. sudo systemctl start mosquitto.

Run NimHA from file:

./nimha

Run NimHA after compile:

nim c -r nimha.nim

-d:systemInstall

This will install NimHA on your system. This feature is still experimental. Either use the debian files or manually create and move the files to the specified folders:

/var/lib/nimha/mainmodules => Modules folder
/etc/nimha/nimha.cfg       => Secret.cfg file
/var/lib/nimha/db          => Database folder
/var/run/nimha/tmp         => Tmp folder
/var/run/nimha/nimblecache => Nimble cache folder
/var/lib/nimha/public/js/script.js => JS file