当前位置: 首页 > 软件库 > 其他开源 > 物联网 >

homebridge-jablotron-alarm

授权协议 Unlicense License
开发语言 JavaScript
所属分类 其他开源、 物联网
软件类型 开源软件
地区 不详
投 递 者 蓝鸿哲
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

Publish NPM

Enabling Homekit and Siri for Jablotron Alarms

In the beginning of 2017 I bought and installed a Jablotron JA-100 alarm system in my home, it was easy to install, works great and offers a lot of options for automation which is great since Ive automated 90% of the stuff I do in my house. However it was missing 1 feature, Homekit. Let’s fix that!

If you are unfamiliar with Homekit, it’s Apple’s home automation integration, it basically bundles all of your smart devices in the Home app and lets you control it from 1 app, share access to family and friends, but most importantly provide a secure gateway for remote access and location based automation. See: https://www.apple.com/ios/home/

The objective for the Jablotron Homekit integration is:Arm, disarm or partially arm the alarm based on locationControl PGM Jablotron devices based on locationHave other devices perform actions based on the status of the alarmInclude the alarm in scenesControl Jablotron from the Home appControl Jablotron with Siri

Since Homekit isn’t enabled on Jablotron we need a bridge to connect Jablotron to Homekit, we will be using Homebridge for this.

Most of this README is written for first time users of Homebridge so feel free to skip most parts if you already have it.

What is Homebridge?

Homebridge is a lightweight NodeJS server you can run on your home network that emulates the iOS HomeKit API. It supports Plugins, which are community-contributed modules that provide a basic bridge from HomeKit to various 3rd-party APIs provided by manufacturers of "smart home" devices. See: https://github.com/nfarina/homebridge

Components

Components used in this instructions:

  • Raspberry PI Zero W
  • Raspberry Pi Zero case
  • USB charger + Micro USB cable
  • SD card (32gb) with Jessie Lite installed
  • Jablotron JA-101KR LAN w/ GSM and radio
  • Router with WiFi

The above components can be changed out to your preferences, just make sure you check the compatibility with Homebridge.

Homekit dependencies

In order to use Apple Homekit you need to make sure you meet Apple’s requirements, most notably the requirements on automation and remote access. See: https://support.apple.com/en-us/HT207057

Installation options

  • Following along this tutorial should be quite OK, but you have a few options to getting this up and running:
  • Follow along this tutorial
  • Contact us for a prepped SD card or a whole Pi with OS
  • Use an existing Homebridge installation
  • Use Docker
  • Download the Homebridge for Raspberry Pi app which will do all the installation work for you https://itunes.apple.com/nl/app/homebridge-for-raspberrypi/id1123183713?mt=8

Preparing the OS

For our OS we will be using Jessie Lite, get the latest version from:http://downloads.raspberrypi.org/raspbian_lite/images/

Follow the instruction on how to install it on your SD card:https://www.raspberrypi.org/documentation/installation/installing-images/

Please read the included README.txt

After installing the OS on the SD card, perform the following steps:Open the SD card in Finder or Explorer and go the root / home folderCreate an empty file called “ssh.txt”, this will enable us to SSH into the Pi

Create a second file called “wpa_supplicant.conf” with the following contents:

ctrl_interface=/var/run/wpa_supplicant
network={
    ssid=“your_wifi_name”
    psk=“your_wifi_password”
}

This will make sure that the Pi connects to your WiFi.

Alternatively you can use the command line to perform these commands.

Prepping the Pi

Insert the SD with OS into the Pi, close the case and hook the power up. Verify that it works, by checking if the Pi’s light is blinking.

Lets get startedNow that we have all our components and software its time to boot up the Pi for the first time, installing the plugins and connecting it your Homekit. If you have downloaded the prepped OS then skip until the next steps and go straight to “Connecting to Homekit”, if you have an existing Homebridge installation skip to “Installing Jablotron plugin”

Connecting to the Pi

After the Pi has booted, open the terminal on MacOs or use an SSH client such as putty on Windows. On MacOS connect via the terminal with the following command:

ssh pi@raspberrypi.local

The default password should be “raspberry”. After logging in the first thing we will do is change the password by executing:

passwd

Installing Homebridge and required packages

Allright installing Homebirdge can sometimes be a bit difficult, mostly due to different versions of Pi’s, OS’s, etc. So the following steps should help you to get it up and running but its best to check the latest installation guide on and preferably follow that guide: https://github.com/nfarina/homebridge/wiki/Running-HomeBridge-on-a-Raspberry-Pi

Make sure you are connected to the Pi and execute the following commands one by one:

sudo apt-get update
sudo apt-get upgrade

Install Git:

sudo apt-get install git make

Install Node:

curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs
sudo apt-get install -y build-essential

Set up NPM:

mkdir ~/.npm-global
npm config set prefix ‘~/.npm-global’
export PATH=~/.npm-global/bin:$PATH
source ~/.profile

Install Avahi

sudo apt-get install libavahi-compat-libdnssd-dev

Install Homebridge

sudo npm install -g --unsafe-perm homebridge

Start Homebridge at boot of the Pi

sudo apt-get install screen

Edit the file by executing:

sudo nano /etc/rc.local

Add this line before the exit 0 line:

su -c "screen -dmS homebridge homebridge" -s /bin/sh pi

Press CRTL + X to save and exit.

Installing Jablotron plugin

At this moment the package isn’t on npmjs so we will install it from Github by executing the following command:

npm install -g homebridge-jablotron

Creating the homebridge config

On the command line and create the config file:

nano ~/.homebridge/config.json

If the config is empty, add the following to the file, otherwise proceed to changing the credentials:

{
    "bridge": {
        "name": "Homebridge",
        "username": "CC:22:3D:E3:CE:30",
        "port": 51826,
        "pin": "031-45-155"
    },
    "accessories": [],
    "platforms": [
        {
            "platform": "Jablotron",
            "name": "Jablotron",
            "services": [
                {
                    "id": 123456,
                    "name": "Home",
                    "username": "username",
                    "password": "passsword",
                    "pincode": "pincode",
                    "autoRefresh": true,
                    "pollInterval": 60,
                    "refreshOnStateChange": true,
                    "debug": false,
                    "sections": [
                        {
                            "name": "House",
                            "segment_id": "STATE_1",
                            "segment_key": "section_1",
                            "keyboard_key": "keyboard_2_3",
                            "partiallyArmedMode": "Night"
                        },
                        {
                            "name": "Cellar",
                            "segment_id": "STATE_2",
                            "segment_key": "section_2",
                            "armedMode": "Home"
                        },
                        {
                            "name": "Terrace",
                            "segment_id": "STATE_3",
                            "segment_key": "section_3"
                        }
                    ],
                    "switches": [
                        {
                            "name": "Hooter",
                            "segment_id": "PGM_1",
                            "segment_key": "pgm_1"
                        }
                    ],
                    "outlets": [
                        {
                            "name": "Camera",
                            "segment_id": "PGM_2",
                            "segment_key": "pgm_2"
                        }
                    ]
                }
            ]
        }
    ]
}

Configuring Jablotron services

Based on the output of the configuration tool you can decide what services you add to the configuration.Typically there is single service configured (eg for home) but some people might have more services defined (eg home & office)

MAKE SURE YOU HAVE ACCEPTED THE JABLOTRON TERMS OF SERVICE OR YOUR ACCOUNT WILL NOT WORK.

Each service needs to be configured following attributes:

  • id: mandatory, ID of service obtained by configuration tool
  • name: mandatory, defines a name of a service
  • username: mandatory, your Jablotron username, it is advised to create a new account for the sole purpose of controlling the alarm via Siri and limiting the authorization on that account.
  • password: mandatory, corresponding Jablotron password
  • pincode: mandatory, corresponding PIN code for Jablotron unit
  • autoRefresh: optional [default value true], enables autorefresh mode that automatically polls the Jablotron status in interval defined using pollInterval attribute
  • pollInterval: optional [default value 60], defines an interval (in seconds) in which plugin periodically checks for service's and its accessories' states
  • refreshOnStateChange: optional [default value true], enables automatic refresh upon arm/disarm. This is typically used if you have other Jablotron accessories (eg outlets) set up and configured to automatically switch on/off based on alarm state
  • debug: optional [default value false], provides more verbose and detailed logging. Set it to true in case of some issues only!

Configuring Jablotron sections & accessories

For each service there needs to be at least one accessory defined. The available accessories can be obtained using configuration tool

The accessories are of 3 types:

  • section: this is standard segment mounted on Jablotron keyboard unit
  • switch: this is a switchable (PGM device) accessory connected to Jablotron unit (eg hooter/sirene)
  • outlet: this is an outlet (PGM device) connected to Jablotron unit

The configuration above defines:

  • 3 sections/segments
  • 1 switch for hooter/sirene
  • 1 outlet that turns on/off security camera

Each accessory needs to be configured using following attributes:

  • name: mandatory, name of the accessory (this will be shown in Homekit and typically corresponds to the name defined in Jablotron setup)
  • segment_id: mandatory, ID of a segment assigned in Jablotron setup
  • segment_key: mandatory, key of a segment assigned in Jablotron setup
  • keyboard_key: optional, is used to define a segment keyboard in order to support partially armed state (see below). Please specify the value only if you have Jablotron segment/section configured for partially armed state!

Support for partially armed state

If your Jablotron alarm was configured to support partially armed status, ie where single click on segment's arm key partially arms segment and double click on segment's arm key arms segment fully, you are able to configure the same in Homebridge as well.All you need to know is keyboard key of segment's keyboard. To obtain this information proceed with steps for identifying Jablotron services and devices.

Mapping of Security System States

For sections you can now override mapping of armed/partially armed states to Homekit states. By default armed state is mapped to Away andpartially armed state is mapped to Home in Homekit. For each section you can now define additional 2 attributes:

  • armedMode: Homekit mapping of armed state. Can be set to one of Home/Night/Away
  • partiallyArmedMode: Homekit mapping of partially armed state. Can be set to one of Home/Night/Away

Each section will appear in Homekit with the right number of states. Without partially armed state it would always appear with Off/"Armed" statesWith partially armed state it would appear as Off/"Partially Armed"/"Armed"

Connecting to Homekit

On the command line, execute:

screen -S homebridge
homebridge

On your iOS device open “Home”, click on the plus icon in the top right corner, click “add accessory” and scan the QR code displayed in on the command line.

Exit homebridge on the command line by pressing CTRL + Z, followed by executing the command:

sudo reboot

The Pi will now reboot and after a couple of minutes it will be back online and Homebridge will be up and running.

Homekit integration

The alarm integrates into Homekit as standard security alarm device. Homekit supports 4 states:

  • Home (Stay)
  • Away
  • Night
  • Off

Home/Away/Night are all of "On" state and indicate an armed alarmOff indicates disarmed alarm

Jablotron alarm supports 3 states only:

  • Disarmed
  • Partially armed
  • Armed

Disarmed is mapped to Off in Homekit. Partially armed is mapped to Home in Homekit. Armed is mapped to Away

Usage

Now that we have connected the Pi to Jablotron and our Homekit we can start to control Jablotron via Homekit but also automate it.

The current setup of Jablotron as an Alarm System in Homekit requires user authentication when executing automations. For example when the first person arrives home, turn the alarm off. This will prompt a notification on your iOS device or watch asking if you want to execute this command.

This works every time and has the added benefit of being more secure, alternatively it is possible to make the Jablotron alarm appear as a switch and then the automation will work without confirmation.

If you want to use Siri for controlling the alarm, you need to create a scene, which switches the alarm on or off and then ask Siri to set that scene.

Identify Jablotron services and devices

Make sure all the segments on the Jablotron unit are disarmed prior running this utility - this will ensure keyboard detection for partially armed state works as expected:To identify Jablotron services and devices (segments and PGMs) run the config-helper.js, this will get all services and related segments that are assigned to your account.

In case you have an Oasis, add the option -O but do note that it's not possible to control the sections indivually as the app also does not allow this. You could however control all of them at once.

cd /usr/local/lib/node_modules/homebridge-jablotron
node config-helper.js username password

Troubleshooting

  • Jablontron cloud services require users' input to agree with its terms. Without confirmed agreement with these terms Jablotron Homebridge plugin won't work and will show Service Unavailable in the logs. To agree with Jablotron cloud terms sign into MyJablotron using account configured for the plugin and the agreement comes up as first screen - click I Agree and the plugin starts working again
  • 锁屏状态下点亮屏幕,并弹出闹钟提示信息,可以在锁屏界面上取消闹钟;使用广播接收闹钟定时: 下面是例子里的核心代码如下 android 设置定时闹钟(包括提醒一次和循环提醒): Intent intent = new Intent(MainActivity.this,MyAlarmBroadCast.class);           /**          * context 指定实例    

  • 增加一个队列,多线程产生的消息都先入队急求顶packagecom.tcp.mina.main;importjava.util.ArrayList;importjava.util.Collection;importjava.util.List;importjava.util.Map;importorg.apache.mina.core.IoUtil;importorg.apache.mina.cor

  • 一 AlarmManager概述 AlarmManager是Android中常用的一种系统级别的提示服务,在特定的时刻为我们广播一个指定的Intent。简单的说就是我们设定一个时间,然后在该时间到来时,AlarmManager为我们广播一个我们设定的Intent,通常我们使用 PendingIntent,PendingIntent可以理解为Intent的封装包,简单的说就是在Intent上在加个指

  • 在Linux实现一个定时器,不像Win32下那样直观。在Win32调用SetTimer就行了,在Linux下则没有相应函数可以直接调用。定时器作为一个常用的功能,在Linux当然也有相应实现。下面我们看看几种常用的方法。     要实现定时器功能,最土的办法实现莫过于用sleep/usleep来实现了。当然,它会阻塞当前线程,除了处理定时功能外,什么活也干不了。当然要解决这个问题不难,创建一个单独

  • 1.AlarmManager要想在休眠时也起作用,需要使用RTC_WAKEUP类型 2.休眠时,AlarmManager设置的PendingIntent要直接start一个Activity,往往无效, 此时必需先sendBroadcast,在broadcast里面获取一个timeout的wakeLock,再startActivity,才能成功 3.aquireWakeLock要想主动亮屏,需要在创

  • 转贴自:http://www.eoeandroid.com/forum.php?mod=viewthread&tid=250157 1、AlarmManager,顾名思义,就是“提醒”,是Android中常用的一种系统级别的提示服务,在特定的时刻为我们广播一个指定的Intent。简单的说就是我们设定一个时间,然后在该时间到来时,AlarmManager为我们广播一个我们设定的Intent,通常我们

  • AlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);         Intent intent =new Intent("com.android.settings.action.REQUEST_POWER_ON");         PendingIntent pendingIntent

  • #include <stdio.h> #include <unistd.h> #include "alarm.h" static void any1(void *s) { printf("%s", (char *)s); fflush(NULL); } static void any2(void *s) { printf("%s", (char *)s); ff

  • 1、AlarmManager,顾名思义,就是“提醒”,是Android中常用的一种系统级别的提示服务,在特定的时刻为我们广播一个指定的PendingIntent。通俗点,就是设置一个时间,在指定的时间里,Alarm会帮我们执行PendingIntent里的广播。 2、AlarmManager的常用方法有三个: (1)set(int type,long startTime,PendingIntent

  • Inna and Alarm Clock time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Inna loves sleeping very much, so she needs n alarm clocks in total

  • 闹钟可以设置一次性的闹钟和定时循环的闹钟,下面分别分享给大家 设置闹钟时间的activity_alarm1.xml文件: 里面有设置一次闹钟按钮、周期闹钟按钮,取消周期闹钟按钮 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

  • 一、闹钟的分类 1)从闹钟的设置时间方式分为:以开启启动后的间隔时间和日历时间 2)从硬件上来说分为:1、当cpu休眠时不启动 2、即时cpu休眠时仍然启动 所以有如下四种: ELAPSED_REALTIME—Fires the pending intent based on the amount of time since the device was booted, but doesn't w

 相关资料
  • homebridge-alarm.com Alarm.com plugin for Homebridge Installation Install homebridge: npm install -g homebridge Install this plugin: npm install -g homebridge-alarmdotcom Sign up for WrapAPI Bookmark

  • Homebridge 是一个轻量级 NodeJS 服务器,它模拟 iOS HomeKit API,提供从 HomeKit 到“智能家居”设备制造商提供的各种第三方 API 的基本桥接。通过 Homebridge 的桥接,可以让 Siri 控制完全不支持 HomeKit 的设备。 此外 Homebridge 支持插件。

  • homebridge-alarmdecoder-platform Homebridge dynamic platform plugin for the alarmdecoder (alarmdecoder.com) interface to Honeywell/DSC Systems & Interlogix (formerly GE Security, Caddx, NetworX) Syste

  • homebridge-alarm-panel A Homebridge plugin providing an alarm system with a web UI. Aim Provides a web UI alarm panel to view and manage a HomeKit based alarm system. When used on a spare mobile devic

  • homebridge-vsx homebridge-vsx is a plugin made for homebridge,which allows switching on and off your Pioneer AV receiver. All AV receivers (VSX and SC),which work with the iControl AV5 App are support

  • homebridge-sesame Control and monitor your Sesame smart lock with HomeKit integration. Prerequisites Installation of Homebridge iOS 11 or later Sesame lock with enabled cloud integration Sesame Wifi A