Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Eclipse SmartHome » USB and Binding
USB and Binding [message #1776935] Thu, 23 November 2017 00:11 Go to next message
Gabriel Klein is currently offline Gabriel KleinFriend
Messages: 5
Registered: November 2017
Junior Member
Dear community,

I'm trying to adapt some code for my weather station (TE923).

For that I need to have a direct access to USB.

As I want to share the code - and potentially propose to integrate it in eclipse.smarthome - what is the library I should use?

Thank you,
Gabriel
Re: USB and Binding [message #1776959 is a reply to message #1776935] Thu, 23 November 2017 09:14 Go to previous messageGo to next message
Kai Kreuzer is currently offline Kai KreuzerFriend
Messages: 673
Registered: December 2011
Senior Member
Hi Gabriel,

There is not yet an interface defined for serial communication, see https://github.com/eclipse/smarthome/issues/4465.
On the openHAB side, RXTX (i.e. gnu.io) is used since many years, so you might want to consider doing your contribution to https://github.com/openhab/openhab2-addons.

Regards,
Kai
Re: USB and Binding [message #1776986 is a reply to message #1776935] Thu, 23 November 2017 12:30 Go to previous messageGo to next message
Gabriel Klein is currently offline Gabriel KleinFriend
Messages: 5
Registered: November 2017
Junior Member
Dear Kai Kreuzer

Thank you for the answer - I'm honoured to have a response from you :)

I saw some code on the "serialbutton" binding.
https://github.com/eclipse/smarthome/blob/master/extensions/binding/org.eclipse.smarthome.binding.serialbutton/src/main/java/org/eclipse/smarthome/binding/serialbutton/handler/SerialButtonHandler.java

It answers many cases, but not mine as this usb interface is not serial. USB has always been a problem on java - and I don't know why ;) - even on android you have a really cool api (USB Host and Accessory)!

The code I get inspiration on is http://te923.fukz.org/
I'll write my own "exec" wrapper and use it as an "integration exercise".

1)
You suggest to contribute to openhab2 or smarthome in general? Which one should I favour?

2)
What are the type of object that should be integrated in openhab2 and smarthome? As an example - should I propose code for products that are focalised on Switzerland (Exemple: EcoWizz from Gerocco)? Are products like TheOwl (http://www.theowl.com/) popular enough to be integrated?

Note: Thank you really much for the yahooweather code, it's a great source of inspiration!

[Updated on: Thu, 23 November 2017 14:19]

Report message to a moderator

Re: USB and Binding [message #1777017 is a reply to message #1776986] Thu, 23 November 2017 15:52 Go to previous messageGo to next message
Kai Kreuzer is currently offline Kai KreuzerFriend
Messages: 673
Registered: December 2011
Senior Member
Ok, I see. If you need "pure" USB support, then RXTX won't help you any further.
The only USB library I have come across so far is http://usb4java.org/ - I do not have any experience with it myself, though. If this is what you need, we can certainly discuss adding it to the stack.

Regarding your questions:
It depends. If you feel that the binding is important for other solutions (e.g. commercial ones) than openHAB, ESH would be the right place. Otherwise, contributing to openhab2 is easier (as it involved less work on the project management side for me). If in doubt, my general suggestion is to contribute it to openhab2 and if somebody else is interested in using it, it can be easily moved over to ESH (we have done so for Sonos and Astro binding already). For TE923, I would tend to say that openhab2 might be the better choice.

Regards,
Kai
Re: USB and Binding [message #1777482 is a reply to message #1777017] Wed, 29 November 2017 15:42 Go to previous messageGo to next message
Kenneth Anderson is currently offline Kenneth AndersonFriend
Messages: 4
Registered: November 2017
Junior Member
I apologize if it appears I am hijacking this thread - I'll start a new one instead if you suggest it...

I have a USB-connected Arduino that executes my own home-brewed sketch to give me various automations in my house. The host computer runs Ubuntu CLI (Command Line Interface, no GUI), thus I am currently confined to ssh and command line only monitoring and control. I have no off-the-shelf commercial IoT devices whatsoever, and by implication, no UPnP or otherwise discoverable devices. Still, I hoped to fashion a html interface mapped to the Arduino so it could be http controlled. I plan to use OpenHAB "Exec" [binding] to shim between GUI and CLI. OpenHAB2 seemed to be the direction I wanted to go (we'll assume RXTX will link adequately when I install it later), but for the life of me I can't grasp how to reconcile in concept the delineations of Thing and Item (and etc.!) in this environment where a single micro controller is the communications path between multiple disparate-functionality Items. That is due, in part, to a light bulb being called an Item in the Concepts Overview section2 of the OpenHAB user docs but called a Thing in their Concepts Things section. I ask in Eclipse forum because Eclipse authored the words in the first place.

Can you please help me though my mental block so I can start laying out something workable in a "micro controller-fanning-to-many monitored and controlled devices" environment? Perhaps you might enlighten me whether "Categorizing a physical device as an Item or a Thing in some scenarios can be a matter of preference, and the existence of Items are not necessarily mandatory" to explain why a light bulb is said to be an Item, then a Thing?

My system details:
SITUATION 1: To query room temperature, my server sends some text commands to the Arduino, then waits for a response, parses out the temperature, and outputs that temp to STDOUT (CLI right now). I would like mere browser rendering of the thermostat image to also send a CLI temperaure query command and render the STDOUT result. Note that the Arduino is fully a thermostat and controls the furnace and A/C, therefore it receives from and returns to the host its temperature settings and state of the furnace/fan and A/C outputs. In addition to returning information when queried, the Arduino sends info of its own accord, mostly so the furnace on/off times can be logged by the server. I'd like the thermostat image in the user's browser to show the state of the furnace, not only when the image is first rendered, but also updated as the Arduino sends the pertinent info back to server.

SITUATION 2: Server host sends commands on a crontab-run schedule to Arduino to turn outlet on/off to the coffee maker. Same scenario for the porch light. I'd like a [remote] user to have an icon (or mouse clickable screen region by whatever name) whereby the outlets could be remote controlled and read. Arduino-initiated logging info also gets sent back to host to alert of possible on-off state changes not initiated by the host.

Thank you!
Re: USB and Binding [message #1777524 is a reply to message #1777482] Wed, 29 November 2017 22:08 Go to previous messageGo to next message
Gabriel Klein is currently offline Gabriel KleinFriend
Messages: 5
Registered: November 2017
Junior Member
Out of topic: As you love arduino too :) Do you know 2 devices: ESP8266 and ESP32 - it's like arduino but you have internet access for <5$. I love this design too: https://www.aliexpress.com/item/LoRa-ESP32-0-96-Inch-Blue-OLED-Display-SX1278-Bluetooth-WIFI-Lora-Kit-32-Module-Internet/32829056144.html - LoRa is an interesting answer to long distance monitoring . PlatformIO is a great environment to replace arduino IDE.

For your question, smarthome has the concept of "bridge": https://www.eclipse.org/smarthome/documentation/development/bindings/faq.html

I was thinking of developing a "bridge" using my ESP8266 and multicast packets. My idea (and probably we have already existing protocols) was to have sensor that post message on a multicast channel - Same with android phones with a specific application. As an example your phone send the current pressure when you are home every x minutes - you can collect this information from opehHab2 like classical sensors.

A great source of information are other plugins (org.openhab.binding.*). You need to install eclipse and the developer version of openHab2. https://docs.openhab.org/developers/development/bindings.html
Re: USB and Binding [message #1777531 is a reply to message #1777524] Thu, 30 November 2017 00:43 Go to previous messageGo to next message
Kenneth Anderson is currently offline Kenneth AndersonFriend
Messages: 4
Registered: November 2017
Junior Member
Yes Gabriel, I searched my email and [re-]discovered that I bought a couple ESP8266 back in Oct 2014 and have never touched them, yet. Thanks for reminding me that I have them! I normally set my wifi not to broadcast SID, so they weren't going to useful to me around the house according to what I learned after the purchase.

I keep my code projects on my GitHub page (but could never brag about my code esthetics and sorry for no screen shots). The pin detailer I wrote can be useful to persons needing the Pin Change Interrupt details of their Arduino. I had hoped eventually to get my thermostat communicating with my temp sensor via PC Interrupts, but the combined code won't fit in an UNO without streamlining. Since that project's priority wasn't high enough for now to streamline, I am left with the two uncombined projects there.

That bridge link you show me is what I suspected I would have to do. I'll just assume Ubuntu versions of Eclipse and etc. are supported. The fact that FINALLY I find it clearly stated that there is flexibility in how the system admin can set up architecture delineations helps me immensely to understand! I was beginning to suspect it was that way but needed to see it explicitly stated like that.

BUT: That FAQ leaves out any mention of "Item". What am I to make of that? Is the Item a later development than the date of that FAQ? Or would the Items be optional? Or would the Items be the obvious ("DUH") termini of all channels/bindings?

[Updated on: Thu, 30 November 2017 00:45]

Report message to a moderator

Re: USB and Binding [message #1777532 is a reply to message #1777524] Thu, 30 November 2017 01:12 Go to previous messageGo to next message
Kenneth Anderson is currently offline Kenneth AndersonFriend
Messages: 4
Registered: November 2017
Junior Member
Gabriel Klein wrote on Wed, 29 November 2017 22:08
PlatformIO is a great environment to replace arduino IDE.
Going to install it. Had been wanting a debug and step ability!!!! Thank you!

[Updated on: Thu, 30 November 2017 01:13]

Report message to a moderator

Re: USB and Binding [message #1777866 is a reply to message #1777532] Tue, 05 December 2017 13:17 Go to previous messageGo to next message
Kai Kreuzer is currently offline Kai KreuzerFriend
Messages: 673
Registered: December 2011
Senior Member
Quote:
BUT: That FAQ leaves out any mention of "Item". What am I to make of that? Is the Item a later development than the date of that FAQ? Or would the Items be optional? Or would the Items be the obvious ("DUH") termini of all channels/bindings?


Check out this introduction, which hopefully makes it a bit clearer: https://www.eclipse.org/smarthome/documentation/concepts/index.html

So items are what the rules and UIs deal with - but that is a separate layer and the bindings are decoupled from that. This is why you do not find "items" being mentioned anywhere in the binding developer docs.
Re: USB and Binding [message #1777878 is a reply to message #1777866] Tue, 05 December 2017 14:43 Go to previous message
Kenneth Anderson is currently offline Kenneth AndersonFriend
Messages: 4
Registered: November 2017
Junior Member
Thank you much, Kai.

However, I still seem to find so many concepts stated from a vantage point that makes it difficult to reconcile them with a DIY automation system that has different functionalities designed differently into its physical and virtual devices than the commercial examples used. But I'm way too tenacious, passionate, and desperate to give up before I figure it out, so I will succeed eventually.

Blessings.

[Updated on: Tue, 05 December 2017 15:42]

Report message to a moderator

Previous Topic:Default value for channels
Next Topic:Eclipse SmartHome
Goto Forum:
  


Current Time: Sat Nov 09 03:07:32 GMT 2024

Powered by FUDForum. Page generated in 0.03722 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top