Skip to content
Povilas Juzeliūnas edited this page Nov 19, 2019 · 1 revision

Experimental Nilan app setup

This is a setup guide of experimental iOS app that can monitor and control Nilan heatpump.

app

Prerequisites

You must have:

  • Nilan heatpump that supports Modbus over TCP (CTS700) (tested on Nilan Compact P AIR 9 model).
  • Raspberry Pi computer (tested with Pi 3 model)
    • OS: Raspbian
    • Network: connected to your home WiFi.
    • Remote login over SSH must be enabled.
  • Apple computer for building the app.
  • Xcode (download).

Overview

App communicates with Nilan heatpump over special REST API server that runs on Raspberry Pi computer. Server communicates with Nilan heatpump using Modbus TCP protocol.

setup

This guide explains how to set up and configure server software on Raspberry Pi computer and how to build and run Nilan app on an iPhone.

Hardware setup

Connect Nilan heatpump to Raspberry Pi using Ethernet cable. Cable is hidden inside the heatpump and is not very long. You might need to consider extending it with some connector and extra cable.

hardware

Heatpump settings

Make sure that Nilan heatpump has default (factory) IP address. It must be 192.168.05.107 (subnet mask 255.255.255.0).

Pi setup

  1. Login to your Raspberry Pi computer over SSH.

  2. Adjust IP address of Ethernet port. Subnet must match the one that Nilan is using.

    Modify /etc/dhcpcd.conf:

    sudo nano /etc/dhcpcd.conf
    

    Find and adjust eth0 settings to the following:

    interface eth0
    static ip_address=192.168.5.1/24
    

    Save the changes and reboot Pi:

    sudo reboot
    

    Login to Pi again and verify IP address of eth0 port by running ifconfig. It must be 192.168.5.1

  3. Install Docker by running the following commands:

curl -sSL https://get.docker.com | sh
sudo usermod -aG docker pi
  1. Pull server image by running the following command:
docker pull pjuzeliunas/nilan
  1. Create server container:
docker create pjuzeliunas/nilan
  1. Start the server:
docker run --restart unless-stopped -p 8080:8080 -d pjuzeliunas/nilan

Server will start in the background. It will restart automatically in case of reboot.

You can test the server by fetching Nilan readings using the browser. Open http://<IP address of Pi>:8080/readings in your browser.

scr1

iPhone app setup

App is experimental and not published to the App Store. To try it out, you have to build and deploy it to your iPhone manually.

  1. Download or clone the code from pjuzeliunas/nilan-client-ios repo.
  2. Install homebrew if not already installed by running:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  1. Install Carthage package manager
brew install carthage
  1. Update packages by running the following command in source code folder (nilan-client-ios):
carthage update --platform ios

Now the app is ready to be built and deployed to your iPhone. Connect iPhone to your Mac computer using USB cable.

Open Xcode project: nilan-client-ios/Nilan.xcodeproj

  1. Select your iPhone from drop-down and hit Run button.

scr2

You might need to adjust app signing settings. To do so, sign in using your Apple ID in Xcode → Preferences → Accounts. Then adjust team settings (select your own personal team) as shown bellow.

scr3

When app is launched, connect it to the server by typing Pi's IP address. You must use IP address of Raspberry Pi computer (not Nilan). iPhone must be connected to home network.

Using app outside home network

It is possible to expose Pi's port 8080 to the outside world by altering your WiFi router parameters. This is, however, not recommened, as current server software lacks basic security features. Alternativelly, you can connect to your home network using VPN.