BobRak / OpenHAB-Smartthings

53 stars 54 forks source link

202 Errors #82

Closed edwolfe3 closed 4 years ago

edwolfe3 commented 5 years ago

I keep getting 202 errors from my devices and devices are not controlled (don't turn on/off/etc.) nor are the device statuses updated (e.x. when I manually turn a switch on, openHAB doesn't get the signal it was turned on). This all was working at the beginning of June and something changed since then (even though I have not changed the binding version used).

2019-08-09 00:11:44.296 [INFO ] [hings.internal.SmartthingsHttpClient] - Sent message "{"capabilityKey": "switchLevel", "deviceDisplayName": "Family Room Fan", "capabilityAttribute": "switch", "value": "on"}" with path "/update" to the Smartthings hub, recieved HTTP status 202

I tried the call displayed in Postman and I receive a 202 Accepted (with no data returned) response. It appears as if the API has changed? Any solution to this.

I'm running the following version of the binding:

241 │ Active │ 80 │ 2.5.0.201904051837 │ Smartthings Binding

BobRak commented 5 years ago

The http 202 is a normal response for Smartthings. It always responds with a 202 and sends any response data in a separate message. I supposed I should update this message to indicate that is a normal response.

Are there other messages that might help? Nothing has changed for several months.

If none of the other messages are helpful then I would recommend looking at the Smartthings logs.

Also, check the last step in the SmartthingsInstallation.md file: "Configuration in the Smartthings Classic App".

I currently don't have a working environment setup as I am in the process of moving.

edwolfe3 commented 5 years ago

This is what i see in the log:

2019-08-20 08:32:32.716 [nt.ItemStatePredictedEvent] - GF_HomeCinema_Fan predicted to become ON

2019-08-20 08:32:32.723 [nt.ItemStatePredictedEvent] - GF_HomeCinema_Fan_Speed predicted to become 10

==> /var/log/openhab2/openhab.log <==

2019-08-20 08:32:32.828 [INFO ] [hings.internal.SmartthingsHttpClient] - Sent message "{"capabilityKey": "switchLevel", "deviceDisplayName": "Family Room Fan", "capabilityAttribute": "switch", "value": "on"}" with path "/update" to the Smartthings hub, recieved HTTP status 202

2019-08-20 08:32:32.921 [INFO ] [hings.internal.SmartthingsHttpClient] - Sent message "{"capabilityKey": "switchLevel", "deviceDisplayName": "Family Room Fan", "capabilityAttribute": "level", "value": 10}" with path "/update" to the Smartthings hub, recieved HTTP status 202

But the fan does not turn on or change speed.

My definitions are as follows:

Switch   GF_HomeCinema_Fan                     "Power"                <fan_ceiling> (gHomeCinema_Fan)               ["Switchable"]             {channel="smartthings:switchLevel:House:HomeCinemaFan:switch"}
Dimmer   GF_HomeCinema_Fan_Speed               "Fan"                  <slider>      (gHomeCinema_Fan)                                          {channel="smartthings:switchLevel:House:HomeCinemaFan:level"}

UPDATE

This same thing is happening with ALL my SmartThings!! No smartthings are working from OpenHab at this point.

BobRak commented 4 years ago

It looks like openHAB is sending messages.

Are you using the Smartthings classic app. It only works with the classic app. And, have you done the step "Create the Device" in the SmartthingsInstallation.md file? Make sure you are using the IP, port and mac of your OH server. And, the step "Configuration in the Smartthings Classic App" that is at the bottom of that file.

I recommend looking in the smartthings log next.

And, if you change an item with the smartthings app on your phone does that work. And, are you seeing any log messages when you do that. If not you are missing something in your config.

It would also be helpful if you sent current things, items and sitemap info.

I recently moved and configured a new house and it works fine. I am confident the binding works and the instruction are OK. But, it is a lot of steps and lots of places to miss something.

edwolfe3 commented 4 years ago

OK. I think I found it based on your last post. The IP of the openhab server had changed because I put all my smart, automation, devices on a separate router and subnet. I changed the IP in the device to the new IP and rebooted my openHAB server. It appears to be working, but I will do more testing.

As a side note: my Amazon echo stuff appears to be working now too (after changing the IP); any idea why that would affect the echo binding? Was all networking shutdown because of this somehow?

BobRak commented 4 years ago

Glad you found that and hopefully this is the end of your problems with the Smartthings binding. I recently setup openHAB at my new house and discovered I could turn lights on and off from the openHAB UI but changes made from the Smartthings app were not causing the openHAB UI to update. I found I had not updated the ST device with my new openHAB IP when I did that everything worked.

No idea why this would cause you echo device to start working. Maybe it had something to do with the reboot.

Bob

edwolfe807 commented 4 years ago

It started happening again. I tried rebooting and it still does not work.

All I get is:

2019-09-24 08:42:19.993 [INFO ] [hings.internal.SmartthingsHttpClient] - Sent message "{"capabilityKey": "switchLevel", "deviceDisplayName": "Eds Desk Fan", "capabilityAttribute": "switch", "value": "off"}" with path "/update" to the Smartthings hub, recieved HTTP status 202

But the action doesn't work. What can I provide you so that this can be fixed; again, none of my SmartThings work reliably with this binding. I'm using version

71 x Active x 80 x 2.5.0.201904051837 x Smartthings Binding

EDIT FYI: Openhab reports the action happen with a message like "changed from OFF to ON" but the device doesn't actually react. If I tell amazon echo to turn on ..., the device reacts, but no message in OpenHAB that it happened.

BobRak commented 4 years ago

I'll try to do some investigation but it is going to take several days because I am in the process of moving. Following the message you show above with /update do you see a message with a path of /state?

Please confirm that your openhab server and smartthing hubs are configured in your router with fix (not changeable) IP's. Also verify in your smartthing Device has the correct IP, port and mac. Instructions here.

I've recently moved and had to do a whole new setup. It worked flawlessly using the instructions here (except I forgot to update the Device in the smartthings config.). It is a lot of steps but I am confident it is right.

The code 202 is the correct return code. I'll update the code to say that is normal, if there is ever a working development environment.

Bob

silverman10 commented 4 years ago

I had the same problem, started happening when i changed my openhab devices. I put it behind a wireless bridge, and the openhab commands to the bridge wasn't working at all. Put it back to the wired network, and all is well. I believe its something to do with ARP entries as when behind a wireless bridge, the openhab device gets a different arp MAC. Not sure of the cause though.