Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Communication issue betwen OH and Smartthings hub #99

Open
pisabell2 opened this issue Nov 14, 2020 · 8 comments
Open

Communication issue betwen OH and Smartthings hub #99

pisabell2 opened this issue Nov 14, 2020 · 8 comments

Comments

@pisabell2
Copy link

Hi, I placed the rather lengthy post reproduced below on the OH forum, but perhaps it is more appropriate here.

In brief: I bought a V3 hub and got it to work with the Smartthings phone app. Then I installed your software on the hub, following the procedure described in the binding doc. The OpenHabDevice is now reported to be connected by my phone app. I added to my OH config a thing file as described in you doc, and OH now reports that a thing called "Smartthings Hub" is connected.
But beyond that point, all the attemps I made (as decribed in the post reproduced below) at discovering and communicating with the devices connected to my hub failed.
I really hope you can help me look in the right places. Thanks in advance,

-- Pierre


Problem getting the SmartThings OH binding to work

Hello all,

Background: running OH 2.5.8 on a Windows 10 computer.

I recently acquired a Samsung SmartThings Hub V3. I was able to get it to work fine for controlling two heating devices using the SmartThings phone app.

Next step for me was to gain access to the hub and its connected devices from OH.

I went thgrough the installation steps described in the SmartThings bonding documentation.

  • Placed a copy of "org.openhab.binding.smartthings-2.5.9-SNAPSHOT.jar" in my addons folder
  • Used the SmartThings development tools to install OpenHabAppV2 and OpenHabDeviceHandler on the hub ans=d create the device

After that, the OpenHabDevice was shown as connected on my phone SmartThings app.

Back to OH, I then created a smartthings.things file with the following content:

Bridge smartthings:smartthings:SMThub    [ smartthingsIp="192.168.2.49", smartthingsPort=39500 ] {}

Restarting OH, I can now see in Paper UI that a thing named "Smartthings Hub" has been created and is reported to be "online".

From there I expected that by launching the inbox search process on the smartthing binding would result in the objects already connected (my two heaters) to my SmartThings hub would be found by OH. Unfortunately that did not happen. The inbox search process did not find anything.

Then I thought that the discovery process perhaps needs to be done synchronously in OH and the SmartThings hub. So, I had the SMT hub "forget" the heaters and I relaunched the search from OH. Again, nothing was found.

I then tried to add the heaters directly to the things file. To that end, I had the hub "relearn" about the heaters. Then I edited the smartthings.things file in the following way:

Bridge smartthings:smartthings:SMThub    [ smartthingsIp="192.168.2.49", smartthingsPort=39500 ] {
	Thing thermostat ConvecteurSDB [smartthingsName="Convecteur SdB"]
	Thing thermostat ConvecteurCdM [smartthingsName="Convecteur CdM"]
}

In the above, the smartthingsName provided is exactly the same as in my SmartThings phone app. Restarting OH, I can now see inpaper UI that two new things that have been created for my heaters. Surprisingly, their names in the list of things is "Thermostat" in both cases. I expected the names woyls be shown as "ConvecteurSDB" and "ConvecteurCdM". The list of available channels shown for each of the two things is larger than the list of channels shown in my phone app. For example, it includes a channel named "Cooling Setpoint" while my heaters do not provide a cooling function. However, I was hopeful since the list does include "Heating Setpoint" which clearly corresponds with a basic function on my heaters. The channel paths also make sense. For example, the Heating Setpoint function is associated with a channel named "smartthings:thermostat:SMThub:ConvecteurSDB:heatingSetpoint" with "thermostat" as type, "SMTHub" as the name of my Hub, "ConvecteurSDB" as the identifier of my heater and "heatingSetpoint" as the function being triggered.

I was then hopeful that adding items such as the following would allow me to read/modify the setpoint on my heaters:

Number  SDB_HeatingSetpoint "Temperature cible" {channel="smartthings:thermostat:SMThub:heatingSetpoint"}

and adding lines such as the following to my sitemap:

Setpoint item=SDB_HeatingSetpoint label="SDB:cible [%.1f \u00B0C]" icon="temperature"  minValue=12 maxValue=25 step=0.5

But neither the read nor the write have any effect on the device (and the phone app).

Thus it seems that no real communication OH/hub is taking place.

The openhab.log contains only a few lines about smartthings:

020-11-14 16:41:44.472 [INFO ] [vice.internal.HttpServiceFactoryImpl] - Binding bundle: [org.openhab.binding.smartthings_2.5.9.202009181937 [267]] to http service
2020-11-14 16:41:44.492 [INFO ] [ce.jetty.internal.HttpServiceContext] - registering context DefaultHttpContext [bundle=org.openhab.binding.smartthings_2.5.9.202009181937 [267], contextID=default], with context-name: 
2020-11-14 16:41:44.492 [INFO ] [ce.jetty.internal.HttpServiceContext] - registering context DefaultHttpContext [bundle=org.openhab.binding.smartthings_2.5.9.202009181937 [267], contextID=default], with context-name: 
2020-11-14 16:41:44.493 [INFO ] [ce.jetty.internal.HttpServiceContext] - registering JasperInitializer
2020-11-14 16:41:44.506 [INFO ] [.jetty.server.handler.ContextHandler] - Started HttpServiceContext{httpContext=DefaultHttpContext [bundle=org.openhab.binding.smartthings_2.5.9.202009181937 [267], contextID=default]}
2020-11-14 16:41:44.508 [INFO ] [d.internal.element.ServletWebElement] - Ignoring servlet [428] without valid alias or url patterns property.
2020-11-14 16:41:46.524 [INFO ] [vice.internal.HttpServiceFactoryImpl] - Binding bundle: [org.openhab.core.boot_2.5.0 [137]] to http service

My events.log files reports initilization of things:

2020-11-14 16:41:44.574 [hingStatusInfoChangedEvent] - 'smartthings:smartthings:SMThub' changed from UNINITIALIZED to INITIALIZING
2020-11-14 16:41:44.577 [hingStatusInfoChangedEvent] - 'smartthings:smartthings:SMThub' changed from INITIALIZING to ONLINE
2020-11-14 16:41:44.581 [hingStatusInfoChangedEvent] - 'smartthings:thermostat:SMThub:ConvecteurCdM' changed from UNINITIALIZED to INITIALIZING
2020-11-14 16:41:44.582 [hingStatusInfoChangedEvent] - 'smartthings:thermostat:SMThub:ConvecteurSDB' changed from UNINITIALIZED to INITIALIZING
2020-11-14 16:41:44.589 [hingStatusInfoChangedEvent] - 'smartthings:thermostat:SMThub:ConvecteurSDB' changed from INITIALIZING to ONLINE
2020-11-14 16:41:44.591 [hingStatusInfoChangedEvent] - 'smartthings:thermostat:SMThub:ConvecteurCdM' changed from INITIALIZING to ONLINE
```

and also reports any attempts to change setpoint values (though they ultimately probve unsuccessful):

```
2020-11-14 16:50:03.145 [ome.event.ItemCommandEvent] - Item 'SDB_HeatingSetpoint' received command 12
2020-11-14 16:50:03.157 [nt.ItemStatePredictedEvent] - SDB_HeatingSetpoint predicted to become 12
2020-11-14 16:50:03.162 [vent.ItemStateChangedEvent] - SDB_HeatingSetpoint changed from NULL to 12
2020-11-14 16:50:04.274 [ome.event.ItemCommandEvent] - Item 'SDB_HeatingSetpoint' received command 12.5
2020-11-14 16:50:04.285 [nt.ItemStatePredictedEvent] - SDB_HeatingSetpoint predicted to become 12.5
2020-11-14 16:50:04.295 [vent.ItemStateChangedEvent] - SDB_HeatingSetpoint changed from 12 to 12.5
2020-11-14 16:50:05.225 [ome.event.ItemCommandEvent] - Item 'SDB_HeatingSetpoint' received command 13
2020-11-14 16:50:05.237 [nt.ItemStatePredictedEvent] - SDB_HeatingSetpoint predicted to become 13
2020-11-14 16:50:05.250 [vent.ItemStateChangedEvent] - SDB_HeatingSetpoint changed from 12.5 to 13
```

That's it for now.


@BobRak
Copy link
Owner

BobRak commented Nov 15, 2020

Hi @pisabell2

Thanks for installing the Smartthings Addon. I'm sure we can get it working. Here are:

Three comments

First

From your description is sounds like openHAB is not seeing the Smartthings devices. Usually this is because they have not been enabled in the SmartApp. See the last section titled Configuration in the Smartthings App. After you tap on the OpenHabAppV2 scroll down to the section titled Thermostat. Click on it and then select your thermostats. If under Thermostat it says No device found look at the other Thermostat entries and see if you open any of them.

I think this will solve your problem. And, until this step is done openHAB won't know about your connected devices. Even it you configure them in the .things and .items files.

Second

You can do the configuration through either the PaperUI or through files. If you configure through files, then you do not need / use the discovery process. I do all my configuration through files because it lets me keep a copy of all of the configuration data.

If you want to configure through the PaperUI then comment out the .things and .items file entries for you Smartthings hub. Then in the PaperUi: Configuration -> Things ->Smartthings Hub. Click on the pencil and enter the IP address and port. Next click on Inbox -> click on the + sign icon. It should cause the discovery process to run. Then your devices should appear in the Inbox. I don't have a fresh system to try this on so you make have to do things a little differently.

Third

It sounds like you downloaded the binding from my github. That is fine but it is now part of the openHAB platform. You can find it in the PaperUi under Add-ons -> Samsung Smartthings.

Summary

Please let me know how it goes.

@pisabell2
Copy link
Author

pisabell2 commented Nov 17, 2020 via email

@pisabell2
Copy link
Author

Hi again,

I managed to get all of my devices to work OK through OH. One problem that remains is how I can bridge some discrepancies between the functionality available through the SMT phone app and the functionality shown in OH. For example, the phone app makes available the following three possible values for the attribute "Mode" of one of my heaters: "Éco", "Chaleur", "Désactivé" (that is in English, "Eco", "Heating", "OFF"). In OH, the corresponding mode selection menu shows many more options: "Auto", "Eco", "Cool", "Heat". "Emergency heat", "Rush Hour", "OFF". In this case, it is the phone app which is correct: the only three functions available on my heater are those provided by that app. One positive thing is that notwithstanding the language difference between the options in the phone app, the mapping is done correctly ("Éco"="Eco", "Chaleur"="Heating" and "OFF"="OFF". And selecting in OH one of the options not available on the heater has no effect on the heater and no effect on the status in the phone app, which is good. Yet, I would much prefer to display in OH: 1) only the available values; 2) preferably using their French names.

Thanks again.

@pisabell2
Copy link
Author

Hello again,

Please ignore my previous message (the one about mappings). There was a bug in my mapping code, and opnce I corrected it, the mappings were carried out as I intended.
Sorry for the noise.

@BobRak
Copy link
Owner

BobRak commented Nov 18, 2020

Hi Pierre:

Glad you figured that out. Sorry to be slow in responding to your earlier message. Despite being in COVID lockdown I've been very busy for the past few days.

DId you get the discovery process working? If not have a look at issue #95. Search for "Smartthings Curl Setup Instructions". That section tells you how to send a discovery request to the hub and look at the results. It will help you better understand the discovery process and help identify what might be going wrong.

Please let me know how it goes.

Bob

@pisabell2
Copy link
Author

Hi Bob,

Thanks for your response. here are a couple of questions, if you don't mind.

  1. I may put a bit more work trying to get the discovery process to work. First, I want to make sure I understand what exactly it is supposed to accomplish. Does the discovery involve only finding items that have already been connected by the Smartthings app or can it replace the "discovery" (i.e. initial connection) I am currently making through the app?

  2. Perhaps one advantage of using discovery in OH would be that the set of available channels associated with a discovered device would exactly match the channels that are actually available in the device? This would be unlike my manual entries, which have the effect of creating channels that don't really exist in the device. For example, the heaters that I described as "thermostat" devices have been assigned a channel named "Cooling Setpoint" that is not in fact available in those heaters.

  3. Looking from a different angle, I find that the Smartthings app/hub fails to see some channels that I was able to see using a different Zwave controller. For example, my HUSBZB1 USB hub was making available several channels on my Yale door lock that Smartthings does not appear to see. While the latter apparently only sees "lock/iunlock" and "battery level", the former also made available channels called "alarm access", "alarm power" and "alarm_raw. Thus my question is the following: in the Smartthing OH binding, is the list of available channels limited by the list channels available in the Smartthings app or is there a way to access some additional channels that other zwave/zigbee coordinators are able to see.

Thanks again,

Pierre

@BobRak
Copy link
Owner

BobRak commented Nov 20, 2020

Pierre:

  1. OH Discovery will only find devices that are already present on your hub. And, have been selected using the OpenHabAppV2 screen on your phone as described in the SmartthingsInstallation document. Earlier I sent you instructions on how to manually send a discovery request to the hub. Only devices returned by that request will be added to the PaperUI Inbox.
  2. Smartthings defines a set of channels for each device. You can see that list in the Smartthings Capabilities Reference document at: https://docs.smartthings.com/en/latest/capabilities-reference.html. I’ve replicated that list in the OH Smartthings binding. You can see what I’ve done my looking at the file ESH-INF/thing/thing-types.xml in the Smartthings jar file. I’ve tried to faithfully replicate the channels for each device.
  3. My understanding is that Smartthings has tried to identify all of the capabilities of each device and has included those in the Capabilities Reference. I don’t know of a way to get access to capabilities that are not included in that Capabilities Reference. But, I’ll be the first to admit that I am not an expert of the inner workings of the hub.

I hope this helps. If not let me know.

Bob

@rrkraft
Copy link

rrkraft commented Oct 6, 2021

Hello,

I have a slightly different communication issue. I connected my Smartthings V2 hub to OH3 and I see all my devices and they generally work fine. I can turn them on and off most of the time. The issue is "most of the time". Last night I was using one of my contact sensors and opened and closed it while watching the event.log file.
The Smartthings app always saw the correct status within a second but in only 1 out of 10 times I got the event properly shown in the event log (and OH3 showed it in the iPhone App).
When i then looked at a few other devices I also saw quite a few missed events like I turned a light on with ST but that even also never made it into OH3. If I turn off the light in OH3 it works after a second or so and the event is properly shown.

I have maybe 50 to 60 devices on my ST hub connect with Z-Wave and ZigBee. So these two buses are probably fairly busy with a lot of status updates like temperature, battery status, and so on coming through.

I thought about leaving my devices on ST and do all the automation with OH3 since I don't trust Samsung to keep the ruling engine alive and as good as it was in the past. I'm using WebCore on the ST side. And lately the ST ruling engine seems to miss a lot of timers with lights going off too early or not at all. So I want to get out with some time on my hand before I'm forced to do it quickly. My whole house is controlled with ST so losing the automation would put a few things into jeopardy.

Any idea on how to improve the communication?

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants