AD2Pi and SmartThings integration error

General Discussion

Re: AD2Pi and SmartThings integration error

Postby mathewss » Mon Dec 04, 2017 10:03 am

jasonsf wrote:
mathewss wrote:I expect multiple things have gone wrong and in order to figure it out I will need a V2 Hub.


Well, They will probably be on sale again for the holidays :D


I will grab one this week. After you update your KEY in the APP and the URL and key under "Notifications" in our Web App under your Smartthings notification you also can not ARM/DISARM?

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

Re: AD2Pi and SmartThings integration error

Postby mathewss » Mon Dec 04, 2017 2:12 pm

JasonS. If you go to this address do you get a response? If you can please send a tcpdump capture file that contains the APIkey requests to your Ad2Pi appliance. I noted in one capture I received from ? that it had no activity on port 5000 so the HUB never asked for the /api/v1/alarmdecoder web page. This page should show you some JSON alarm panel status message. What is not clear from your log is if it was goign to http://alarmdecoder.local/api/v1 .... or some other IP address. If it is not connecting to the Ad2Pi then we need to figure out where the HUB is trying to go.
Also it is very odd that it has the HOST: as our description XML.

This is what my HUB sent to my test AlarmDecoder webap.
Code: Select all
GET /api/v1/alarmdecoder?apikey=5NY3RJLTGKGQ HTTP/1.1
Accept: */*
User-Agent: Linux UPnP/1.0 SmartThings
HOST: 10.10.0.26:5000




Best
Sean M



jasonsf wrote:Sean, I'm trying to see what is happening with communication between the webapp API and the smart app. When I hit Refresh in the smart app, I see an http get to the hub, but I do not see any response or anything in the webapp log. Should I?

Smartthings log:
Code: Select all
5d25236c-6f66-4927-a34f-ed1eed51fea5  12:46:36 PM: trace --- httpResponse: GET /api/v1/alarmdecoder?apikey=YBGCO7BGBKVQ HTTP/1.1
Accept: */*
User-Agent: Linux UPnP/1.0 SmartThings
HOST: /static/device_description.xml

5d25236c-6f66-4927-a34f-ed1eed51fea5  12:46:36 PM: trace --- hub_http_get: host=/static/device_description.xml, path=/api/v1/alarmdecoder?apikey=YBGCO7BGBKVQ
5d25236c-6f66-4927-a34f-ed1eed51fea5  12:46:36 PM: trace --- handler.refresh


WebApp Log:
Code: Select all
2017-12-02 19:21:37,750 INFO: Checking for version updates - last check at: 12-02-2017 19:11:21 [in /opt/alarmdecoder-webapp/ad2web/decoder.py:600]
2017-12-02 19:31:49,920 INFO: Checking for version updates - last check at: 12-02-2017 19:21:37 [in /opt/alarmdecoder-webapp/ad2web/decoder.py:600]
2017-12-02 19:42:00,184 INFO: Checking for version updates - last check at: 12-02-2017 19:31:49 [in /opt/alarmdecoder-webapp/ad2web/decoder.py:600]


When I fault a zone, the Service manager registers this in the log:
Code: Select all
9ce1b78c-efc5-4e89-a6ee-f9a750c9f4cd  12:51:39 PM: trace refresh_alarmdecoders: AlarmDecoder
9ce1b78c-efc5-4e89-a6ee-f9a750c9f4cd  12:51:39 PM: debug getChildDevices(true), children=17
9ce1b78c-efc5-4e89-a6ee-f9a750c9f4cd  12:51:39 PM: trace refresh_alarmdecoders-
9ce1b78c-efc5-4e89-a6ee-f9a750c9f4cd  12:51:39 PM: trace webserviceUpdate


but the smartapp does not show the zone faulted.
mathewss
Moderator
Moderator
 
Posts: 188
Joined: Fri Dec 06, 2013 11:14 am

Re: AD2Pi and SmartThings integration error

Postby mathewss » Mon Dec 04, 2017 2:29 pm

Ok the problem continues to look to be how the location of the AlarmDecoder PI web app is located. If one were to modify addExistingDevices() in the AlarmDecoder (Service Manager) code as follows it should work again. It is not a fix but it will get it to work as I find a way to the root of this issue.

Code: Select all
                // Set URN for the child device
                def urn = newDevice.value.ssdpPath
                urn -= "http://"
                //state.urn = urn
                state.urn = "1.2.3.4:5000" // replace with the actual IP of your Pi and the port it listens on likely 5000.
mathewss
Moderator
Moderator
 
Posts: 188
Joined: Fri Dec 06, 2013 11:14 am

Re: AD2Pi and SmartThings integration error

Postby jasonsf » Mon Dec 04, 2017 3:05 pm

Yes, the API responds when hit from the browser:

Code: Select all
{
last_message_received: "[00000001000000000A--],023,[f70200051023000008020000000000],"FAULT 23 BEDROOM4 WINDOW "",
panel_alarming: false,
panel_armed: false,
panel_armed_stay: false,
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: [
23
]
}


I hard-coded the ip of my pi for the urn and the webapp now gets status updates. So, for those of us having discovery issues, the dev branch fixes that. And then hard-coding the ip address and port fixes signalling.

Thanks again for the time you are spending on this.

Jason
jasonsf
Senior Nut
Senior Nut
 
Posts: 60
Joined: Sun Oct 16, 2016 2:43 pm

Re: AD2Pi and SmartThings integration error

Postby jasonsf » Mon Dec 04, 2017 3:25 pm

Sean, do you still want tcpdump logs? It seems that the problem is that the correct url isn't coming back in the ssdpPath, but if the correct url is hardcoded, it goes there correctly.

It seems that the question is

Why
Code: Select all
state.devices.each { k, v ->
        log.trace "discover_devices: ${v}"
        def ip = convertHexToIP(v.ip)
        found_devices["${v.ip}:${v.port}"] = "AlarmDecoder @ ${ip}"
    }

logs this:
Code: Select all
discover_devices: [port:1388, ssdpUSN:uuid:97487987-b220-11e7-9ba8-b5672e8fd4f7, devicetype:04, mac:B827EB6C0227, hub:54a142d6-34b8-444f-a2d5-960dc05ea1ce, ssdpPath:/static/device_description.xml, ssdpTerm:urn:schemas-upnp-org:device:AlarmDecoder:1, ip:C0A80B95]

Why is the ssdpPath the xml path instead of alarmdecoder.local or the ip? And, remember, the ssdpPath was completely empty until you made the dev branch change.

Jason
jasonsf
Senior Nut
Senior Nut
 
Posts: 60
Joined: Sun Oct 16, 2016 2:43 pm

Re: AD2Pi and SmartThings integration error

Postby Jag4666 » Fri Dec 08, 2017 2:43 pm

any update?
Jag4666
newt
newt
 
Posts: 14
Joined: Fri Oct 28, 2016 7:10 pm

Re: AD2Pi and SmartThings integration error

Postby qplus7 » Wed Dec 13, 2017 10:09 am

Hi, all.

How can I switch to dev branch from the command-line? From the web interface, Settings > Advanced > Branch does not give me an option to select dev.
qplus7
newt
newt
 
Posts: 2
Joined: Wed Dec 13, 2017 10:07 am

Re: AD2Pi and SmartThings integration error

Postby mathewss » Wed Dec 13, 2017 10:31 am

Thanks to a generous donor to this project I received a new Version 2 SmartThings HUB yesterday.

I did some initial tests and will continue today. I see the data I can use to solve the problem but I need to investigate deeper to be sure I get a solution that follows the path SmartThings will continue to support in future updates such as the one that caused this.

I will keep you all posted but I would expect a solution before the end of the week.

As noted the git checkout screen on the webapp is not working. I need to get that bug report submitted to github as well as a workaround.

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

Re: AD2Pi and SmartThings integration error

Postby mathewss » Wed Dec 13, 2017 12:14 pm

I just pushed a change to the AlarmDecoder smartthings file service_manager.groovy on github. Please try this. AFAIK it does not matter if you run "dev" or "master" on the "alarmdecoder-webapp" but that has not been tested yet.

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

Re: AD2Pi and SmartThings integration error

Postby qplus7 » Wed Dec 13, 2017 12:20 pm

mathewss wrote:I just pushed a change to the AlarmDecoder smartthings file service_manager.groovy on github. Please try this. AFAIK it does not matter if you run "dev" or "master" on the "alarmdecoder-webapp" but that has not been tested yet.

Best
Sean Mathews

I just tested this and was able to finish the installation using the simulator in the SmartThings IDE.

I now have the alarm in my SmartThings app and will be adding my API keys in a few minutes to fully test.

Edit:
Added my API keys and it works. Thank you so much for your work on this!!!!!
qplus7
newt
newt
 
Posts: 2
Joined: Wed Dec 13, 2017 10:07 am

PreviousNext

Return to General

Who is online

Users browsing this forum: No registered users and 13 guests

cron