AD2PI with Pi Zero Wireless

General Discussion

Re: AD2PI with Pi Zero Wireless

Postby jeffwu » Sat Apr 22, 2017 4:05 am

the swagger link is very helpful. My physical keypad has a button called Night Stay. I find a way to arm the panel to "Night Stay" through web app keypad (basically press ARM STAY twice - "code + 3 + 3"). Web App does shows "NIGHT-STAY" too. however, when I use API to report alarm status, it has panel_armed_stay set to true. how can I distinguish regular ARM STAY and NIGHT STAY? I tried to avoid parsing "last_message_received" to get that as it might not be reliable I guess.

I see you posted info in https://community.smartthings.com/t/ad2 ... /10901/124. but there was no clear answer how to get that through API.

In regards to the question of which Home Automation solution I use, I am building a home growth one. I feel the solutions out there in the market is not flexible or secure enough. for example IFTTT is too slow and Google/Amazon use too much Cloud for privacy concern. My solution is based on Pi or other SBC for individual family focusing on local wifi/lan+strong SSL over internet. So far I have Wemo, web cam, Pi Cam, ecobee3 integration. now I am adding AD2PI. when it is mature, I will put it on GitHub to share with the community.


{
"last_message_received": "[00100001100000013A--],008,[f700003f1008108c28020000000000],\"***NIGHT-STAY*** \"",
"panel_alarming": false,
"panel_armed": false,
"panel_armed_stay": true,
"panel_bypassed": false,
"panel_fire_detected": false,
"panel_on_battery": false,
"panel_panicked": false,
"panel_powered": true,
"panel_relay_status": [],
"panel_type": "ADEMCO",
"panel_zones_faulted": []
}
jeffwu
Senior Nut
Senior Nut
 
Posts: 40
Joined: Fri Mar 17, 2017 6:24 pm

Re: AD2PI with Pi Zero Wireless

Postby mathewss » Sat Apr 22, 2017 7:51 am

Night mode is denoted in bit 16 section #1
* https://www.alarmdecoder.com/wiki/index.php/Protocol
"Indicates that the panel is only watching the perimeter (ARMED STAY/NIGHT)"

Looking at your message it does indicate this bit is set.

Best
Sean M
mathewss
Moderator
Moderator
 
Posts: 188
Joined: Fri Dec 06, 2013 11:14 am

Re: AD2PI with Pi Zero Wireless

Postby jeffwu » Mon Apr 24, 2017 6:03 pm

Hi there

API key works perfectly for getting alarm status and alarm configuration. However, when I tried to send codes, I got error from swagger UI with "try it".

}
"error": {
"code": 401,
"message": "An Error has occurred!"
}
}

response header is:
{
"error": "no response from server"
}

I, then used curl cmd line: curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '41121' 'http://alarmdecoder.local:5000/api/v1/alarmdecoder/send?apikey=xxxxxxxx'.

it returned this content. did I do something wrong or miss settings somewhere?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>AttributeError: 'int' object has no attribute 'get' // Werkzeug Debugger</title>
<link rel="stylesheet" href="?__debugger__=yes&amp;cmd=resource&amp;f=style.css"
type="text/css">
<!-- We need to make sure this has a favicon so that the debugger does
not by accident trigger a request to /favicon.ico which might
change the application state. -->
<link rel="shortcut icon"
href="?__debugger__=yes&amp;cmd=resource&amp;f=console.png">
<script src="?__debugger__=yes&amp;cmd=resource&amp;f=jquery.js"></script>
<script src="?__debugger__=yes&amp;cmd=resource&amp;f=debugger.js"></script>
<script type="text/javascript">
var TRACEBACK = 1904202064,
CONSOLE_MODE = false,
EVALEX = false,
EVALEX_TRUSTED = false,
SECRET = "eYqgWl8xhr6O649cwhNc";
</script>
</head>
<body>
<div class="debugger">
<h1>AttributeError</h1>
<div class="detail">
<p class="errormsg">AttributeError: 'int' object has no attribute 'get'</p>
</div>
<h2 class="traceback">Traceback <em>(most recent call last)</em></h2>
<div class="traceback">
jeffwu
Senior Nut
Senior Nut
 
Posts: 40
Joined: Fri Mar 17, 2017 6:24 pm

Re: AD2PI with Pi Zero Wireless

Postby kevin » Tue Apr 25, 2017 8:01 am

Please post these types of errors to ad2usb@support.nutech.com or create an issue on the project's github page

Thanks!
Not an employee of the company. Just here to help and keep things clean.
kevin
Platinum Nut
Platinum Nut
 
Posts: 994
Joined: Fri Aug 16, 2013 10:10 am

Re: AD2PI with Pi Zero Wireless

Postby Scott » Tue Apr 25, 2017 11:28 am

From looking at your curl command it looks like you're not sending the data in the expected JSON format.

The format for /send should be: { "keys": "41121" }
Scott
Expert Nut
Expert Nut
 
Posts: 118
Joined: Thu Dec 12, 2013 11:17 am

Re: AD2PI with Pi Zero Wireless

Postby jeffwu » Wed Apr 26, 2017 4:17 am

you spot the error. thanks. It works. it also meant the example in Swagger UI wasn't correct either.

I will follow the right channel to report code issue in the future. thanks again Kevin.
jeffwu
Senior Nut
Senior Nut
 
Posts: 40
Joined: Fri Mar 17, 2017 6:24 pm

Re: AD2PI with Pi Zero Wireless

Postby kevin » Wed Apr 26, 2017 7:52 am

Swagger UI is correct, invalid data was provided in the parameters boxes - this is what it produces with valid json in the body when clicking "Try it Out":
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{ "keys": "41121" }' 'http://alarmdecoder.local:5000/api/v1/alarmdecoder/send?apikey=asdf'


The "Model" to the right shows exact format of data required to use the API.
Not an employee of the company. Just here to help and keep things clean.
kevin
Platinum Nut
Platinum Nut
 
Posts: 994
Joined: Fri Aug 16, 2013 10:10 am

Re: AD2PI with Pi Zero Wireless

Postby jeffwu » Sun May 06, 2018 3:25 am

I just tested the beta AD2PI img (released on April 16, 2018) in Pi Zero W (2017 version). It works perfectly fine.

One small issue was "wpa_suppliance" config file I preloaded into boot the img didn't take it. (It typically worked on vanilla Jessie release for headless installation). My workaround was to boot the beta img in Pi 3B with Eth0 connection...then Putty in to system to config WiFi, then boot the img in Pi Zero W headless.

Hope this help anyone who plans to use Pi Zero W for Alarm Decoder.

Jeff
jeffwu
Senior Nut
Senior Nut
 
Posts: 40
Joined: Fri Mar 17, 2017 6:24 pm

Re: AD2PI with Pi Zero Wireless

Postby BurchSung » Wed May 30, 2018 9:23 am

Hi...i will suggest you to check the wiring and check you have the ad2pi hooked correctly to the gpio header. Lastly, make sure you are attaching to the proper device with the newest pi3 image you should be using /dev/serial0.

seo expert
BurchSung
newt
newt
 
Posts: 1
Joined: Tue May 29, 2018 9:20 am

Previous

Return to General

Who is online

Users browsing this forum: No registered users and 25 guests

cron