Koubachi not supporting new values

Hi all

I switched from a 1st Gen Koubachi plant sensor to a 2nd generation. This new version supports added readings, namely the soil temperature. Judging from the official Koubachi API examples, I think it should be possible to read these new readings. But looking at the openhab wiki page of the binding, I don’t think they are supported. Can anyone confirm?

Thanks
Patrick

@teichsta: Is it correct that you implemented the Koubachi binding? Can you confirm, that the newer readings are not supported? Would appreciate some hints, what needs to be changed in the code. I’m not a big coder myself unfortunately, but could still try to add the new readings. Thanks!

I’ve just read through the Koubachi API documentation and compared it to the current source code of the Koubachi binding. I did not find any missing properties for soil temperature. For devices, you can retrieve the recentTemperatureReadingValue, which is documented in the wiki page for the binding.

Which readings in particular are you missing?

1 Like

On which page are you checking the API documentation ? I only found https://labs.koubachi.com/documentations/8 and didn’t find a clear list of all supported readings.

For the newer sensors, there should be two temperature values: one for temperature (air) and one for soilTemperature. It’s possible of course, that even the API does not support these new values yet.

Will check it again later today.

https://labs.koubachi.com/documentations/2 lists recent_temperature_reading_value which can be bound to an item like this:

String Temp "Temp [%s]" { koubachi="device:00066680190e:recentTemperatureReadingValue" }

See here for binding doc. If you wanted a number item instead of a formatted string item, you could write a rule that triggered when the string item changed, parse out the numeric bits from the string, and post an update to a Number item.

Thanks for the clarification, I’m able to use the “old” values like temperature and moisture reading values in OpenHab, just not the new values of the second generation sensors.

I played around with the API and my credentials. You’re right, in V2 of the API, the new values are not returned. I changed the URL from https://api.koubachi.com/v2/user/smart_devices/ to https://api.koubachi.com/v3/user/smart_devices/ (V3 instead of V2). Didn’t find any clear documentation, but it works. Here is a sample response I get:

{ "device":{ "id":"0006666dddce", "transmit_interval":86400, "virtual_battery_level":0.9838761667760991, "ssid":null, "last_transmission":"2016-01-03T17:38:32+01:00", "next_transmission":"2016-01-04T17:38:32+01:00", "associated_since":"2015-10-08T19:03:23+02:00", "recent_soilmoisture_reading_value":"70 %", "recent_soilmoisture_reading_time":"2016-01-03T13:30:33+01:00", "recent_soilmoisture_reading_si_value":8881.11429814636, "recent_temperature_reading_value":"6.2\u202f\u00b0C", "recent_temperature_reading_time":"2016-01-03T17:36:30+01:00", "recent_temperature_reading_si_value":279.346333007812, "temperature_polling_interval":3600, "recent_light_reading_value":"0.0\u202flx", "recent_light_reading_time":"2016-01-03T17:36:30+01:00", "recent_light_reading_si_value":0.0, "light_polling_interval":3600, "hardware_product_type":"outdoor", "mac_address":"0006666dddce", "recent_soiltemperature_reading_value":"6.3\u202f\u00b0C", "recent_soiltemperature_reading_time":"2016-01-03T13:30:33+01:00", "recent_soiltemperature_reading_si_value":279.42, "soiltemperature_polling_interval":0, "recent_irlight_reading_value":"0 %", "recent_irlight_reading_time":"2016-01-03T17:36:30+01:00", "recent_irlight_reading_si_value":0.0, "hardware_product_generation":"plant_sensor_2", "hardware_product_name":"Plant Sensor 2 Outdoor", "plants":[ { "id":236281 } ] } }

You can see the additional values this offers, everything from recent_soiltemperature_reading_value to hardware_product_name is new in V3.

OK, thanks for that. I will see about creating a pull request to update the binding to the V3 API, but I don’t know which release it might eventually appear in (1.8 is being finalized now). But I will give you a JAR to test if that’s OK.

Great, thanks for your efforts! Sure, I’m happy to test it, just let me know.

Hi Patrick,

Here is a test JAR that is changed from the one you’re using in the following ways:

All default API URLs have “v3” in them instead of “v2”. Note that the only official documentation is for v2 (that either of us can find), so we might want to wait before merging this change until Koubachi has documented their v3 API.

The following new device properties are available:

  • recentSoilmoistureReadingSiValue
  • recentTemperatureReadingSiValue
  • recentLightReadingSiValue
  • recentSoiltemperatureReadingValue
  • recentSoiltemperatureReadingTime
  • recentSoiltemperatureReadingSiValue
  • soiltemperaturePollingInterval
  • recentIrlightReadingValue
  • recentIrlightReadingTime
  • recentIrlightReadingSiValue
  • hardwareProductGeneration
  • hardwareProductName

Please let me know if I should queue up this change, or if you observe any problems with it. Thanks, Patrick!

John

Hi John

Your JAR file works great! I didn’t check all the new values, just tried a few:

  • recentSoiltemperatureReadingValue
  • recentIrlightReadingValue
  • hardwareProductName
  • recentSoiltemperatureReadingTime

I compared the values with the ones in the Koubachi app, everything matches exactly.

Also checked that my old values still work.

Let me know if you want me to test ALL possible values. I guess it’s not really necessary, seeing the perfect result for the first few.

Thanks again for your great help, appreciate it! Now I can set an alarm, if my soil temperature gets bellow zero in winter :smile:

Cheers
Patrick

1 Like

Hi Patrick,

For future reference, my branch that supports these v3 values is here:

https://github.com/watou/openhab/tree/koubachi-v3-api

I am not submitting a pull request to add this change to openHAB just yet, because we don’t see that Koubachi has published new API docs for v3 yet. A proper pull request would be based on published API docs, and that thoroughly represent all possibly useful members that are available in v3.

If you see that Koubachi has updated the API docs to v3, please report back here (or on github as an openHAB issue), so my branch can be completed into a proper pull request against the Koubachi binding.

Here’s hoping openHAB helps keep your plants from freezing! :smile:

John

Great, thanks a lot. I will certainly keep you updated.
I just sent an email to Koubachi asking them about the documentation. Let’s see if I get an answer :wink:

1 Like

Unfortunately we from the Koubachi team do not intend to update our API documentation. We have been acquired by another company and the Koubachi product line will not be developed any further. But all services, apps, infrastructure and support are still maintained (at least) the next couple of years. Despite the old documentation we recommend to use the v3 version of the API. All our applications use v3 as well.

Andreas

Thank you very much, Andreas! I’ve now created a pull request from my branch, and provided a test JAR in the meantime. I will update the wiki after it’s merged.

@pgruetter, would you mind trying it just to verify it works for you? It would be great if you could also try it on the current openHAB 2 build, if possible.

@Andreas_Borrnert: Thanks again for your response, appreciate the “inside” information

@watou: I tried the test jar in my current 1.7 installation, still works perfectly. I can try it in a openHAB 2 build, but haven’t set anything up yet so I will need some time for that. Is there a hard deadline by which you need the test result ?

It should be OK to try it after Beta 2 is available, which is soon. Ideally before the first 2.x release if possible. Thanks for testing under 1.x again. I will update the wiki page now…

Finally have some time to test this. I used the current demo for OH2 and deployed the JAR file, created a koubachi.cfg file and copied the items from my current installation.

The items I have are not updated. Do you know how I can further debug this? I didn’t get any errors in the log file.

Could you type

log:set TRACE org.openhab.binding.koubachi

at the openhab> prompt and see what ends up logged?

Didn’t see much at first but removed and re-added the jar file to the addon folder and this is what I see in the log:

2016-03-20 19:47:16.049 [DEBUG] [org.openhab.binding.koubachi ] - ServiceEvent UNREGISTERING - {org.osgi.service.cm.ManagedService, org.osgi.service.event.EventHandler}={event.topics=openhab/command/*, service.pid=org.openhab.koubachi, component.name=org.openhab.binding.koubachi, component.id=177, service.id=284, service.bundleid=166, service.scope=bundle} - org.openhab.binding.koubachi 2016-03-20 19:47:16.051 [DEBUG] [org.openhab.binding.koubachi ] - ServiceEvent UNREGISTERING - {org.openhab.model.item.binding.BindingConfigReader, org.openhab.binding.koubachi.KoubachiBindingProvider}={component.name=org.openhab.binding.koubachi.bindingprovider, component.id=178, service.id=283, service.bundleid=166, service.scope=bundle} - org.openhab.binding.koubachi 2016-03-20 19:47:16.054 [DEBUG] [org.openhab.binding.koubachi ] - BundleEvent STOPPING - org.openhab.binding.koubachi 2016-03-20 19:47:16.055 [DEBUG] [.koubachi.internal.KoubachiActivator] - Koubachi binding has been stopped. 2016-03-20 19:47:16.055 [DEBUG] [org.openhab.binding.koubachi ] - BundleEvent STOPPED - org.openhab.binding.koubachi 2016-03-20 19:47:16.056 [DEBUG] [org.openhab.binding.koubachi ] - BundleEvent UNRESOLVED - org.openhab.binding.koubachi 2016-03-20 19:47:16.059 [DEBUG] [org.openhab.binding.koubachi ] - BundleEvent UNINSTALLED - org.openhab.binding.koubachi 2016-03-20 19:47:34.151 [DEBUG] [org.openhab.binding.koubachi ] - BundleEvent INSTALLED - org.openhab.binding.koubachi 2016-03-20 19:47:34.250 [DEBUG] [org.openhab.binding.koubachi ] - BundleEvent RESOLVED - org.openhab.binding.koubachi 2016-03-20 19:47:34.255 [DEBUG] [org.openhab.binding.koubachi ] - BundleEvent STARTING - org.openhab.binding.koubachi 2016-03-20 19:47:34.260 [DEBUG] [.koubachi.internal.KoubachiActivator] - Koubachi binding has been started. 2016-03-20 19:47:34.267 [DEBUG] [org.openhab.binding.koubachi ] - ServiceEvent REGISTERED - {org.openhab.model.item.binding.BindingConfigReader, org.openhab.binding.koubachi.KoubachiBindingProvider}={component.name=org.openhab.binding.koubachi.bindingprovider, component.id=185, service.id=303, service.bundleid=167, service.scope=bundle} - org.openhab.binding.koubachi 2016-03-20 19:47:34.268 [DEBUG] [org.openhab.binding.koubachi ] - ServiceEvent REGISTERED - {org.osgi.service.cm.ManagedService, org.osgi.service.event.EventHandler}={event.topics=openhab/command/*, service.pid=org.openhab.koubachi, component.name=org.openhab.binding.koubachi, component.id=184, service.id=304, service.bundleid=167, service.scope=bundle} - org.openhab.binding.koubachi 2016-03-20 19:47:34.277 [ERROR] [org.openhab.binding.koubachi ] - [org.openhab.binding.koubachi(184)] bind method [addBindingProvider] not found; Component will fail 2016-03-20 19:47:34.278 [ERROR] [org.openhab.binding.koubachi ] - [org.openhab.binding.koubachi(184)] bind method [addBindingProvider] not found 2016-03-20 19:47:34.280 [ERROR] [org.openhab.binding.koubachi ] - [org.openhab.binding.koubachi(184)] unbind method [removeBindingProvider] not found; Component will fail 2016-03-20 19:47:34.280 [ERROR] [org.openhab.binding.koubachi ] - [org.openhab.binding.koubachi(184)] unbind method [removeBindingProvider] not found 2016-03-20 19:47:34.281 [ERROR] [org.openhab.binding.koubachi ] - [org.openhab.binding.koubachi(184)] bind method [addBindingProvider] not found 2016-03-20 19:47:34.282 [ERROR] [org.openhab.binding.koubachi ] - [org.openhab.binding.koubachi(184)] unbind method [removeBindingProvider] not found 2016-03-20 19:47:34.285 [ERROR] [org.openhab.binding.koubachi ] - [org.openhab.binding.koubachi(184)] bind method [addBindingProvider] not found 2016-03-20 19:47:34.290 [ERROR] [org.openhab.binding.koubachi ] - [org.openhab.binding.koubachi(184)] unbind method [removeBindingProvider] not found 2016-03-20 19:47:34.295 [DEBUG] [org.openhab.binding.koubachi ] - BundleEvent STARTED - org.openhab.binding.koubachi

Does that help ?

Yes, that helps! I will provide a test JAR soon.