ngx-ccu-jack-client
v1.0.3
Published
An angular api and mqtt client for the ccu addon ccu-jack
Downloads
3
Readme
Table of contents
Requirements & Compatibility
To connect ngx-ccu-jack-client
with a backend a CCU-Jack server (installed as addon on a CCU or running as Docker container) is necessary. Please make sure CCU-Jack and the CCU are configured correctly.
| ngx-ccu-jack-client | angular | ngx-mqtt | rxjs | CCU-Jack | | ------------------- | ------------- | -------------- | ------------- | -------------- | | 1.0.x | 13.x.x | 9.0.x | >= 7.4.0 | >= 2.0.26 |
Getting Started
Install ngx-ccu-jack-client
from npm:
npm install ngx-ccu-jack-client --save
Install needed peer dependencies. For compatible versions see console output after install of ngx-ccu-jack-client
or see Requirements & Compatibility.
npm install ngx-mqtt --save
npm install rxjs --save
Import NgxCcuJackClientModule
into app.module.ts
and add your configuration:
import { NgxCcuJackClientModule } from 'ngx-ccu-jack-client';
// imports ...
@NgModule({
declarations: [
AppComponent
// components ...
],
imports: [
NgxCcuJackClientModule.forRoot({
connectMqttOnInit: true,
hostnameOrIp: 'your-hostname-or-ip',
port: 2122,
secureConnection: true,
auth: { user: 'your-user', password: 'your-password' }
})
// modules ...
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule {}
Import CcuJackApiService
and/or CcuJackMqttService
in the needed component(s):
import { CcuJackApiService, CcuJackMqttService } from 'ngx-ccu-jack-client';
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html'
})
export class AppComponent {
constructor(
private readonly ccuJackApiService: CcuJackApiService,
private readonly ccuJackMqttService: CcuJackMqttService
) {}
}
Documentation
API
The CcuJackApiService
is used to access the rest interface of CCU-Jack. Master data of devices, rooms, functions, system variables and programs can be requested via this way. It is also possible to start a program and access and set the value of each data point. However, the CcuJackMqttService
should be used to display the values of data points, as the values are immediately updated via this way if they are changed in the CCU.
See detailed CcuJackApiService documentation
MQTT
The CcuJackMqttService
offers the possibility of a live connection of values of data points. In addition to that, values can be set and programs started.
See detailed CcuJackMqttService documentation
Sample Implementation
ngx-ccu-jack-client sample implementation
Troubleshooting
I can not build due to console error: 'Cannot find module 'ngx-mqtt' or its corresponding type declarations.'
Make sure you have installed ngx-mqtt and other needed peer dependencies. See Requirements & Compatibility and Getting Started for details.
I can not connect via
MQTT
due to SSL handshake error
In case of a self signed certificate make sure that your client has installed your root ca of the self signed certificate in the trusted root certificate store. In addition to that your self signed certificate should have the version 3 with subject alternative name if you access the CCU via IP and/or hostname. Finally your self signed certificate (and the private key) must be configured in the CCU and the CCU-Jack addon. See also CCU-Jack TLS documentation for details.
I can not get data via
API
due to CORS errors
It is important to use minimum the version 2.0.26 of CCU-Jack. Make sure CCU-Jack is configured correctly. See also CCU-Jack CORS documentation for details.