csdozier / device-concord4

Concord 4 SmartThings Device Hander and SmartApp
9 stars 13 forks source link

Steps 21-23 Not Working #3

Closed marbaugh closed 7 years ago

marbaugh commented 7 years ago

Thank you very much for posting the code. I am new to SmartThings and was following your readme to integrate with my Concord 4. I do not seem to be able to get the 'code' and api access token described in steps 21-23. Can you verify the directions still work and possible provide any insight?

Thanks for any help! -Matt

csdozier commented 7 years ago

Matt, I've updated the steps 21-23 to fix some errors. The procedure is pretty much pulled from the documentation here: http://docs.smartthings.com/en/latest/smartapp-web-services-developers-guide/authorization.html

You can also get the API access token from the smartthings IDE. Go to https://graph.api.smartthings.com and login. Go to Smart Apps then the Concord 4 Integration Smart App. Click "Simulator" ->Set Location ->> Install . In the simulator, if you scroll the very bottom right, the access token will be displayed.

marbaugh commented 7 years ago

Thank you for updating the directions and explaining how to get the token through the IDE. I got everything up and running this morning. All of the songs seem to be updating properly but I do not appear to be able to arm the alarm. Any troubleshooting suggestions?

csdozier commented 7 years ago

It sounds like an issue with the smartthings hub communicating the python server. Have you specified the IP address and port number in the "Concord 4 Alarm Panel" device handler? This can be done from within the smartthings mobile app.

If you are receiving any information from smarththings, it will be logged in the python server display.

On Wed, Sep 6, 2017 at 11:23 AM, marbaugh notifications@github.com wrote:

Thank you for updating the directions and explaining how to get the token through the IDE. I got everything up and running this morning. All of the songs seem to be updating properly but I do not appear to be able to arm the alarm. Any troubleshooting suggestions?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/csdozier/device-concord4/issues/3#issuecomment-327519136, or mute the thread https://github.com/notifications/unsubscribe-auth/ANJf93pa21xVNxG0t12w3BDnTHjdhvRRks5sfrjmgaJpZM4PMWAG .

marbaugh commented 7 years ago

Ok, I checked and I have the internal lan address 192.168.1.31 of my Pi in the config with the default 8066 port. I am not seeing anything in the python server logs that print to standard out.

csdozier commented 7 years ago

Lets break down where the issue is, open the concordsvr.log on your local host along with "Live Logging" on the IDE. To start live logging go to https://graph.api.smartthings.com/ide/logs

Here is a working example below (with some data changed for security). Assume that 192.168.3.8 is the smartthings hub and 192.168.3.104 is the raspberry pi.

########Live logging showing a POST /concord/arm/stay to the raspberry PI python server (192.168.3.104 8066)########

96eb3f97-7ed5-4e8c-bd5f-357972645d00 https://graph.api.smartthings.com/ide/logs#96eb3f97-7ed5-4e8c-bd5f-377972938d00 7:49:50 PM: debug POST /concord/arm/stay&apiserverurl=https%3A%2F% 2Fgraph.api.smartthings.com%3A443%2Fapi%2Fsmartapps%2Finstallations HTTP/1.1

Accept: /

User-Agent: Linux UPnP/1.0 SmartThings

HOST: C0A80368:1F82

Authorization: Basic YWRtaW46PHBhc3N3b3JkPg==

96eb3f97-7ed5-4e8c-bd5f-357972645d00 https://graph.api.smartthings.com/ide/logs#96eb3f97-7ed5-4e8c-bd5f-377972938d00 7:49:50 PM: debug 333

96eb3f97-7ed5-4e8c-bd5f-357972645d00 https://graph.api.smartthings.com/ide/logs#96eb3f97-7ed5-4e8c-bd5f-377972938d00 7:49:50 PM: debug convertIPtoHex:8066

96eb3f97-7ed5-4e8c-bd5f-357972645d00 https://graph.api.smartthings.com/ide/logs#96eb3f97-7ed5-4e8c-bd5f-377972938d00 7:49:50 PM: debug convertIPtoHex:192.168.3.104

96eb3f97-7ed5-4e8c-bd5f-357972645d00 https://graph.api.smartthings.com/ide/logs#96eb3f97-7ed5-4e8c-bd5f-377972938d00 7:49:50 PM: debug Request:'/arm/stay'

96eb3f97-7ed5-4e8c-bd5f-357972645d00 https://graph.api.smartthings.com/ide/logs#96eb3f97-7ed5-4e8c-bd5f-377972938d00 7:49:50 PM: debug Executing 'ArmStay'

a92522c3-4f00-4f52-b809-a65ab6671d15 https://graph.api.smartthings.com/ide/logs#a92522c3-4f00-4f52-b809-a65ab5572d167:49:48 PM: debug [name:ping, value:null, isStateChange:false, displayed:false, linkText:Garage Door Control]

a92522c3-4f00-4f52-b809-a65ab6671d15 https://graph.api.smartthings.com/ide/logs#a92522c3-4f00-4f52-b809-a65ab5572d167:49:48 PM: debug Parse got 'ping'

efa523a9-a0a8-4e36-80d3-cf26bb5baad5 https://graph.api.smartthings.com/ide/logs#efa623a9-a0a8-4e36-80d3-cf26bb5baad5 7:49:44 PM: trace getPhrases(), state.welcomeIssue = null

########

######## Python log showing an incoming POST /concord/arm/stay from the Smartthings hub (192.168.3.8 45351) ########

~/concordsvr $ tail -f concordsvr.log

2017-09-06 19:49:50,360 [concordsvr.py:logger()] - INFO - Incoming web connection from ('192.168.3.8', 45351)

2017-09-06 19:49:50,373 [concordsvr.py:logger()] - INFO - Web request: POST /concord/arm/stay&apiserverurl=https%3A%2F%2Fgraph.api.smartthings.com %3A443%2Fapi%2Fsmartapps%2Finstallations

2017-09-06 19:49:50,383 [concordsvr.py:logger()] - INFO - admin:

2017-09-06 19:49:50,392 [concordsvr.py:ArmDisarm()] - INFO - Concord4 Arm/Disarm to stay, bypass=, silent=True

2017-09-06 19:49:51,703 [concordsvr.py:panelMessageHandler()] - INFO - System is ARMED to STAY

2017-09-06 19:49:51,713 [concordsvr.py:logger()] - INFO - delay:0

2017-09-06 19:49:51,722 [concordsvr.py:logger()] - INFO - url:armstatus/armed_stay

2017-09-06 19:49:52,782 [concordsvr.py:logger()] - INFO - TX -> https://graph.api.smartthings.com:443/api/smartapps/installations/bdcf758d-da82-47f7-88b9-fcb63a7e666d/concord/96eb3f97-7ed5-4e8c-bd5f-357972645d00/armstatus/armed_stay

########

On Wed, Sep 6, 2017 at 5:43 PM, marbaugh notifications@github.com wrote:

Ok, I checked and I have the internal lan address 192.168.1.31 of my Pi in the config with the default 8066 port. I am not seeing anything in the python server logs that print to standard out.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/csdozier/device-concord4/issues/3#issuecomment-327608005, or mute the thread https://github.com/notifications/unsubscribe-auth/ANJf99cTK3qJO6_Or1sRaxPCtkWz6_kbks5sfwSqgaJpZM4PMWAG .

marbaugh commented 7 years ago

So believe it or not, arming the system just randomly started working for me last night. I had not changed a single thing on my pi or the IDE site. I can't thank you enough for helping me through the issue.

One other question I do have is every time I set the alarm, either when I am home or away it Arms to "stay". I'm assuming this is the default, is there a way to change it to arm to "away" either manually or based on the "family locations" in SmartThings?

csdozier commented 7 years ago

Two options:

1) Use Smart Home Monitor, its integrated to that now. Its what I use to arm the system

2) Update the concord 4 device handler in this part of the code. Change armstay to armaway

multiAttributeTile(name:"ArmTile", type:"generic", width:6, height:4) { tileAttribute("device.lock", key: "PRIMARY_CONTROL") { attributeState("unlocked", label: 'DISARMED', action: "armstay", icon: "st.Home.home3", backgroundColor: "#79b821", nextState: "locking") attributeState("locking", label: 'ARMING', action: "armstay", icon: "st.Home.home3", backgroundColor: "#ffa81e") attributeState("unlocking", label: 'DISARMING', action: "armstay", icon: "st.Home.home3", backgroundColor: "#ffa81e") attributeState("locked", label: 'ARMED', action: "Disarm", icon: "st.Home.home3", backgroundColor: "#ff381e")

marbaugh commented 7 years ago

Great! I setup the Smart Home Monitor and it's working great. Thanks again for all of the help. Code seems to be working without any issues at all now, great work.