This is an command line application which reads data from NGBS iCON smart home control systems. The data is processed and is exposed to be scraped from prometheus. Data from prometheus can be display in different ways, but grafana is recommended.
Data is read from the control system(s). To define the control systems to be scraped, config file needs to be updated.
port: 8080 # port to run on (defaults to 80)
devices:
  - url: http://192.168.1.10 # device address
    sysid: '123123123123' # device ID (printed on the controller)
    password: '123123123123' # password (defaults to sysid if empty)
    delay: 60 # delay in seconds between reads (defaults to 15)
  - url: http://192.168.1.11 # device address
    sysid: '321321321321' # device ID (printed on the controller)Config.yml validation can be done via the schema. For further configuration options use the schema to explore and validate your config file.
- Install latest version of go.
- Clone this repository git clone https://github.com/csutorasa/icon-metrics.git.
- Build the applciation go build.
- Depending on the operating system:
- Debian or debian based - Run the deb package builder and install it, packaging/pkg-deb && dkpg -i packaging/icon-metrics-*.deb.
- Linux - Run the installer sudo packaging/pkg-install.
- Windows or MacOS - Run or schedule start the application.
 
- Debian or debian based - Run the deb package builder and install it, 
Create your config.yml and run the command below
docker run -d -v /path/to/your/config.yml:/app/config.yml -p8080:8080 csutorasa/icon-metrics:latestIf you do not want use 8080 port then use -p${YOUR_PORT}:8080,
but keep using 8080 port in the config.
graph TD
    A1[iCON thermostat controller 1] -->|Reads values| B[iCON-metrics]
    A2[iCON thermostat controller 2] -->|Reads values| B[iCON-metrics]
    A3[iCON thermostat controller 3] -->|Reads values| B[iCON-metrics]
    B -->|Reports metrics| C[(Prometheus)]
    C -->|Provides data| D[Grafana]
    D --> E[Browser]
    sequenceDiagram
    participant it as iCON thermostat controller
    participant im as iCON-metrics
    participant p as prometheus
    loop forever
        im->>+it : login
        it->>-im : login success
        loop until logged out
            im->>+it : read values
            it->>-im : thermostat values
            p->>+im : read metrics
            im->>-p : thermostat values
        end
    end
    Metrics are hosted in prometheus format. The http server port can be configured in the config file.
port: 8080You need to extend the prometheus config (prometheus.yml) to scrape this application.
scrape_configs:
  # Other scrape configs can be here
  - job_name: 'icon-metrics'
    static_configs:
    - targets: ['localhost:8080']Most metrics can be disabled from the configuaration separately for each device in the config file.
Available metrics:
| Metric | Scope | Type | Description | Enable configuration flag | 
|---|---|---|---|---|
| uptime | global | gauge | uptime in milliseconds | N/A | 
| icon_controller_connected | per controller | gauge | 1 if the controller is ready to be read, 0 otherwise | controllerConnected | 
| icon_http_client_seconds | per controller | summary | icon HTTP request durations in seconds | httpClient | 
| icon_external_temperature | per controller | gauge | external temperature | externalTemperature | 
| icon_water_temperature | per controller | gauge | cooling or heating water temperature | waterTemperature | 
| icon_heating | per controller | gauge | 1 if the controller is set to heating mode, 0 otherwise | heating | 
| icon_eco | per controller | gauge | 1 if the controller is in economy mode, 0 otherwise | eco | 
| icon_room_connected | per room | gauge | 1 if the room is connected to the controller, 0 otherwise | roomConnected | 
| icon_temperature | per room | gauge | room temperature | temperature | 
| icon_relay_on | per room | gauge | 1 if the relay is open, 0 otherwise | relay | 
| icon_humidity | per room | gauge | room humidity | humidity | 
| icon_target_temperature | per room | gauge | room target temperature | targetTemperature | 
| icon_dew_temperature | per room | gauge | room dew temperature | dewTemperature | 
This data is designed to be displayed in a grafana dashboard. Example dashboards for the system, controllers and the rooms are available to be imported.