Installing MQTT is simple enough, as far as I remember. The key part was getting the node-spc-mqtt.js script running (I still have to manually start it after a reboot).
For reference, I have openhab2, mosquitto, the SPC web service and node-spc-mqtt.js all running on the same machine, an Intel NUC running Ubuntu server.
Here are some of my settings:
services/mqtt.cfg:
mqtt.url=tcp://192.168.1.100:1883
mqtt.clientId=openhab
node-spc-mqtt/config.json:
{
"spc_gw_host":"192.168.1.100",
"spc_gw_port":"8088",
"spc_ws_user":"spcws",
"spc_ws_password":"passwordhere",
"spc_get_user":"spcget",
"spc_get_password":"passwordhere",
"mqtt_host":"192.168.1.100",
"mqtt_port":"1883",
"mqtt_main_topic":"/SPC/"
}
spc-web-gateway/config.xml:
<config> <enable_get_auth>yes</enable_get_auth> <enable_put_auth>yes</enable_put_auth> <enable_ws_auth>yes</enable_ws_auth> <enable_edp_encryption>yes</enable_edp_encryption> <enable_ssl_encryption>yes</enable_ssl_encryption> <access_control_list>-0.0.0.0/0,+192.168.1.0/24</access_control_list> <http_port>8088</http_port> <tcp_port>16000</tcp_port> <spc_id>1</spc_id> <gateway_id>888888</gateway_id> <spc_time_diff>0</spc_time_diff> <spc_dst>yes</spc_dst> </config>
Note that the value for gateway_id must be the same as the id in the Alarm system (you must log in as Engineer to access and set this, but it’s all documented in the web gateway software), ans should also be a bit more varied than 888888…
items/alarm.items (selection):
String Alarm_MQTT "Alarm [%s]" <alarm> {mqtt="<[mqtt:/SPC/G_SPC_AREA_MODE_1:state:JSONPATH(status)]"} String iFront_Door_MQTT "Front Door Input [%s]" <door> {mqtt="<[mqtt:/SPC/G_SPC_ZONE_INPUT_1:state:JSONPATH(status)]"} String sFront_Door_MQTT "Front Door Status [%s]" <door> {mqtt="<[mqtt:/SPC/G_SPC_ZONE_STATUS_1:state:JSONPATH(status)]"}
sitemaps/alarm.sitemap:
sitemap alarm label="Alarm" {
Text item=Alarm_MQTT icon="alarm"
Frame label="Zones" {
Text item=iFront_Door_MQTT icon="door"
Text item=iBeam_Hall_MQTT icon="motion"
Text item=iFront_Windows_MQTT icon="window"
Text item=iBack_Area_MQTT icon="window"
Text item=iUpstairs_MQTT icon="window"
Text item=iPanic_Buttons_MQTT icon="contact"
Text item=iGuest_WC_MQTT icon="window"
}
Frame label="Zone Status" {
Text item=sFront_Door_MQTT icon="door"
Text item=sBeam_Hall_MQTT icon="motion"
Text item=sFront_Windows_MQTT icon="window"
Text item=sBack_Area_MQTT icon="window"
Text item=sUpstairs_MQTT icon="window"
Text item=sPanic_Buttons_MQTT icon="window"
Text item=sGuest_WC_MQTT icon="window"
}
}
If you need any other info, let me know.