Giter VIP home page Giter VIP logo

j64.alarmserver's Introduction

j64.AlarmServer

A Server to integrate the Envisalink DSC controller with Smart Things

This server allows you to integrate the EnvisaLink DSC controller with the Smart Things Hub. Once integrated you will able to control you security system from the smart things hub and do things like automatically turning security on when you leave, incorporate your motion sensors into smart things routines (turn lights on when motion is detected), integrate turning your security system on and off via the amazon echo and many other things.

The main reason I wrote this code was not because there was anything wrong with other AlarmServer packages that work with SmartThings, it was more because I wanted to learn a little bit about SmartThings development as well as learn how to use the new cross platform framework that MS has come out with Asp.NetCore 1.0.

The following diagram illustrates how the various components of the solution interact with each other.

Smart Apps Page

When the j64AlarmServer is started it opens a socket to the Envisalink controller. The envisalink server will send information about the state of the alarm system back to j64AlarmServer including items such as whether a window is open, motion is detected or the alarm has been activated. Likewise, the j64AlarmServer will send commands to Envisalink that will perform functions such as arming or disarming the security system.

As various events occur on the security sytem the j64AlarmServer will raise events. These events can be caught by any applications that have subscribed to them. In this case the j64WebApi will subscribe to those events and for certain events it will notify the smart things hub of the change. For example if a window is opened that event is caught by j64AlarmServer and a web service call is made to the j64 Smart App that is running withing the Smart Things cloud. From there the Smart App can take the appropriate action. Typically this means notifying all of the devices that were defined for the controller and then propogating that state information out to the mobile app.

The smart things mobile app allows the user to trigger actions such as arming the security system. When this occurs, the mobile app will talk to the devices running within the smart things cloud. Those devices will then relay a web service call to the j64WebApi via the Smart Things Hub. So it is the smart things hub that talks to the j64WebApi that is running on your local network. The apps were designed to make a call to j64WebApi from the local network only to prevent the need to open up ports on the firewall that is protecting your local network.

There is obviously alot more to how this all works. You are encouraged to look at the code, make enhancements or suggest how I can improve on it.

If you are ready to get started on the install of the app, review the GettingStarted.md in the Documentation folder. In there you will find instructions on how to get all the various parts and pieces up and running on your machine.

NOTE: this server does not work with the honeywell controller.

j64.alarmserver's People

Contributors

joejarvis64 avatar mattui avatar jacauc avatar

Stargazers

Christo avatar Krishna Bhattarai avatar msundin avatar  avatar  avatar Meirion Williams avatar ryan avatar Andy Lippitt avatar Michael Schumacher avatar Steve Ledridge avatar  avatar Gergo Huszty avatar Darth Vader avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

Meirion Williams avatar Sean Stozki avatar  avatar  avatar  avatar  avatar JWM avatar  avatar  avatar

j64.alarmserver's Issues

Flooding of event log

I am experiencing a minor issue when I go to the alarm system in Things, and then clicking on "recently". I see events like "alarm system is armed" and "alarm system is disarmed" every 3-4 minutes, even though I know the alarm is currently in an armed state and there is no movement on any of the zones.

This floods the recent events log. I'd like to open the recent events log and see actual recent events such as when a motion beam was last tripped.

image

Arm always Arms Aways

Whenever ARM (STAY) is used (whether from the DSC or from the ST app or from the j64 website), the ST app automatically moves into the AWAY status.

Question

Hello,
I was looking for code from j64alarmSmartApp.goovy but was not able to figure were its located any direction..

thx

Not creating device apps

First time I installed, all device apps were created. Then suddenly arm/disarm stopped working. So I deleted all apps, devices and alarm server. Then I re-installed again, now it is not creating any partition or devices in smartthings app.

Here is log -
9:53:02 PM: debug getChildDevices(false), children=0
9:52:57 PM: debug getChildDevices(false), children=0
9:52:51 PM: debug getChildDevices(false), children=0
9:52:46 PM: debug getChildDevices(false), children=0
9:48:43 PM: debug getChildDevices(false), children=0
9:48:38 PM: debug Install Devices from 10.2.2.70:2064 using id admin

Not sure why it is happening , any clues?

New Smartthings app/migration breaks partition device

I was just forced to upgrade from the classic Smarthings app to the new Smartthings app. The process migrated my settings and Smartapps, but after the migration the j64 Partition device no longer allows me to arm or disarm which renders the j64 Smart app useless in the new app. :-(

Note: The j64 Partition still works in the classic app and the online simulator.

Devices not created

After installing everything and doing the final step of authorization with oauth, everything seems to work fine, except, the devices are not created for me.

Could you provide some documentation on how I can manually create the devices?

Thanks!

Can not convert Object to String

CreateApp/Devices does not work. Besides the exception that is thrown because an enum cannot be cast as a string, the status code returned is unmodified, which would result in an exception in and of itself, if this section of code where syntactically correct.

  if ((string)jobject["root"]["codeStatus"] != "NEW" && (string)jobject["root"]["codeStatus"] != "MODIFIED")
                throw new Exception("The status codeStatus returned from the update was not valid.");

System.AggregateException: One or more errors occurred. (Can not convert Object to String.) ---> System.ArgumentException: Can not convert Object to String.
at Newtonsoft.Json.Linq.JToken.op_Explicit(JToken value)
at j64.AlarmServer.Web.Repository.DeviceTypeRepository.d__22.MoveNext() in D:\Code\SmartThings\DSC\j64.AlarmServer-master\src\j64.AlarmServer.Web\Repository\DeviceTypeRepository.cs:line 161
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at j64.AlarmServer.Web.Repository.DeviceTypeRepository.<CreateOrReplace>d__19.MoveNext() in D:\Code\SmartThings\DSC\j64.AlarmServer-master\src\j64.AlarmServer.Web\Repository\DeviceTypeRepository.cs:line 44 --- End of inner exception stack trace --- at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) at System.Threading.Tasks.Task.Wait() at j64.AlarmServer.Web.Repository.DeviceTypeRepository..ctor(SmartThingsConnection smartThingsConnection, String appName, String fileName) in D:\Code\SmartThings\DSC\j64.AlarmServer-master\src\j64.AlarmServer.Web\Repository\DeviceTypeRepository.cs:line 30 at j64.AlarmServer.Web.Controllers.OAuthController.<CreateSmartApp>d__4.MoveNext() in D:\Code\SmartThings\DSC\j64.AlarmServer-master\src\j64.AlarmServer.Web\Controllers\OAuthController.cs:line 61 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Mvc.Internal.ObjectMethodExecutor.<CastToObject>d__241.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.Internal.FilterActionInvoker.d__41.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Mvc.Internal.FilterActionInvoker.d__32.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.Internal.MvcRouteHandler.d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Builder.RouterMiddleware.d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware1.<Invoke>d__18.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware1.d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware1.<Invoke>d__18.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware1.d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware1.<Invoke>d__18.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware1.d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware1.<Invoke>d__18.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware1.d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware1.<Invoke>d__18.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware1.d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.Web.BrowserLink.Runtime.BrowserLinkMiddleware.d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.MigrationsEndPointMiddleware.d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.DatabaseErrorPageMiddleware.d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.DatabaseErrorPageMiddleware.d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.d__7.MoveNext()
---> (Inner Exception #0) System.ArgumentException: Can not convert Object to String.
at Newtonsoft.Json.Linq.JToken.op_Explicit(JToken value)
at j64.AlarmServer.Web.Repository.DeviceTypeRepository.d__22.MoveNext() in D:\Code\SmartThings\DSC\j64.AlarmServer-master\src\j64.AlarmServer.Web\Repository\DeviceTypeRepository.cs:line 161
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at j64.AlarmServer.Web.Repository.DeviceTypeRepository.d__19.MoveNext() in D:\Code\SmartThings\DSC\j64.AlarmServer-master\src\j64.AlarmServer.Web\Repository\DeviceTypeRepository.cs:line 44<---

Show full status on main things page

Feature request:
Currently when looking at my alarm device from the main "things" page, it will only show "armed" or "disarmed"
It would be really convenient if it showed what type of arming is active such as "stay armed" or "away armed"

I'm not sure how to implement this myself, otherwise I would submit a pull request.
screenshot_20161114-090631

Random Disarms

I added some additional logging to the Alarm Server to find that the Smart App is sending a disarm request, randomly and without user intervention. The problem occurs intermittently and at various times.

Very disconcerting to here the alarm disarm in the wee hours of the morning.

Advertising Partition Status

More of a feature request than an issue...

I'd like to use CoRE rule engine to switch off my Water Heater automatically when the Alarm is set to "Away Arm" mode, but I cannot find this capability in the partition device handler.

Would it be possible to add functionality that will allow me to: If alarm is "Away Arm" then....
Willing to donate for this functionality if you have a donation platform available?

I tried to add
capability "Sensor"
to the partition code, but it's not really working as I had hoped and I'm not sure that this is the correct capability to use.

Appreciate your feedback!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.