Siemens/Vanderbilt SPC Alarm?

@Rasmus7700 I got the gateway software working pretty easily, and the test web page shows that comms to the alarm works perfectly, but my issue now is that I only get a snapshot status of the alarm when OH restarts, i.e. when OH starts, it reads the alarm zone status, but the alarm doesn’t update OH after. I’ve yet to work out how to get the items to update when a value changes on the alarm.

If I run a mosquito_sub, I immediately get all the zones listed, but no updates. I think I need to dig deeper into how MQTT works…

Has anyone got the node-spc-mqtt solution working correctly? When i point it at my SPC Gateway and start it up I get a ‘sock hung up’ error. I tried using wss:// & ws::// protocols and no joy :cry:

Did anyone manage to get this running? Then I wanna buy the software and integrate it :slight_smile:

Yes, I finally got it up and running, and it works great. I can link events like a motion detection by the PIR to turning on ZWave lights, and also zone open events send push notifications to my cell phone.

It took quite a few tries, and a lot of tweaking and testing, and a number of wipe and re-installs, but I got there in the end!

Awesome - where is the tricky part? Installing the mqtt or get the com from the SPS up and running? Or?

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.

I’ve been playing around with my SPC 4320 and I have written a few lines of C# code that handles some of the EDP protocol. And I have spent a few hours trying to figure out how the SPC works but now I have run out of time and energy so I leave it to the community to pick it up.

For anyone interested in writing something to OpenHab in pure Java you will find my code here.

I think it’s easier to use the software from Lundix and then simpy use MQTT as communication between Lundix software and Openhab

I got it working and openhab2 now displaying the motion as open/closed.
But what I dont get working is a rule to tell a lamp to turn on when a motion is detected.
The String item seems not enough to tell openhab that the motion is done or something.

Do you @roryd have any Rule example on how you got it working so that a motion from a spc detector can
trigger a light to go on??
Maybe I need to do another form of item to get what I want? Like Contact item? Any idea on this would be so helpful for me.

Im new to Linux and Raspberry PI´s but Im proud of my self that I got this working and even with username and password on my mosquitto server! :slight_smile:

Hi Marcus,

Here’s the rule I have. It senses a trigger for either the motion detector in the hall or the front door being opened and, if the sun is below the horizon, it turns on the Ikea Tradfri light in the hall for 60 seconds. If the light is already on, and there’s another trigger, it extends it by another 60 seconds.

If you need anything else, let me know.

var Timer myTimer = null

rule "PIR and Front Door toggle"
when
        Item iBeam_Hall_MQTT changed from closed to open or Item iFront_Door_MQTT changed from closed to open
then
if      (Elevation.state < 0) {
        if (myTimer===null) {
                logInfo("halllight.rules","Sun below horizon ("+Elevation.state+"), turning lights on")
                tradfri_0220_gwb072bf27af79_65537_brightness.sendCommand(ON)
                myTimer = createTimer(now.plusSeconds(60)) [|
                        logInfo("halllight.rules","Turning lights off")
                        tradfri_0220_gwb072bf27af79_65537_brightness.sendCommand(OFF)
                        myTimer = null ]
        } else {
                logInfo("halllight.rules", "We already have a timer - rescheduling")
                myTimer.reschedule(now.plusSeconds(60))
        }
} else
        logInfo("halllight.rules","Daytime")
end

Thank you for your reply @roryd!
I will try this rule with just the “when” command and “then” “**.sendCommand(ON)” just to see that the lamp triggers right.
But Im also curios about your “Sun below horizon…” , you dont use the Astro binding or do you?
Because later on when I got the motion to turn on lights I also whould like to mix with daylight time and stuff so the light only turn on when its dark and maybe keep it on for a specifik time.

Yes, I’m using the Astro binding to track the elevation of the sun.

Thanks very much @roryd!! The rule works fine for me now and turn on the light when motion is detected.
Now I just have to figure out the Astro binding :slight_smile: will look at your example some more and adjust after my needs :smiley:

1 Like

@roryd another question. Did you get the node-spc-mqtt.js to autostart after reboot?
And if you did, how did you do? Tried a lot off things now on that but cant get it to work. :frowning:

Forget it! Found pm2 and that was really easy to get it to autostart after reboot! :smiley:

Hi Marcus,

How did you manage that? I’ve never been able to get it to auto start and I have to remember to manually start it after every reboot!

Found that pm2 and got it working! Thanks for the tip :slight_smile:

1 Like

Hi Rory!

I Found this PM2 (Process Manager 2) on Github https://github.com/Unitech/pm2
Exelant program. Just remember to run the command $ pm2 startup
That command will generate a command line that you copy/paste and press enter.
That will do so pm2 autostarts and the other commands to start node-spc-mqtt.js you have on the link above. really easy to use and you can use it for several more you want to autostart :slight_smile:

1 Like

how do you configer the spc panel, i can’t find the EDP settings in the web interface.

found it, hidden in the communication module.