55 :class: oh-green oh
66.. role :: oh-blue(literal)
77 :class: oh-blue oh
8+ .. role :: oh-orange(literal)
9+ :class: oh-orange oh
10+
11+ .. _MQTT binding : https://www.openhab.org/addons/bindings/mqtt/
12+ .. _MQTT Homie binding : https://www.openhab.org/addons/bindings/mqtt.homie/
13+ .. _Simple test : ../examples.html#simple-test
14+ .. |click | replace :: Click or tap
15+ .. |oh-thing | replace :: OpenHAB Thing
16+ .. |oh-item | replace :: OpenHAB Item
17+ .. |homie-dev | replace :: Homie Device
818
919Using Homie with OpenHAB _
1020=========================
@@ -37,10 +47,6 @@ the interface. The rest of this tutorial will assume that you are logged into th
3747with an OpenHAB administrator account. This should have been covered in the
3848`OpenHAB Getting Started instructions `_
3949
40- .. _MQTT binding : https://www.openhab.org/addons/bindings/mqtt/
41- .. _MQTT Homie binding : https://www.openhab.org/addons/bindings/mqtt.homie/
42- .. |click | replace :: Click or tap
43-
4450.. tip ::
4551 Some of the images here are hyperlinked to the http://openhabian:8080 domain for quicker access.
4652 If you are using a different hostname or a static IP address, then you can adjust the address in
@@ -70,38 +76,38 @@ you don't see the `MQTT binding`_.
7076|click | the :homie-val: `install ` button to install the binding and add MQTT capability to your
7177OpenHAB server.
7278
73- .. md-admonition ::
74- :class: info
75-
76- `Installing the MQTT binding `_ in OpenHAB will also install Homie support automatically. More info
77- about Homie support can be found at the `MQTT Homie binding `_ page.
78-
79- .. md-admonition ::
80- :class: missing
79+ `Installing the MQTT binding `_ in OpenHAB will also install Homie support automatically. More info
80+ about Homie support can be found at the `MQTT Homie binding `_ page.
8181
82- The OpenHAB ` MQTT Homie binding `_ will say that it supports Homie v3.x specifications. This library
83- implements Homie v4 specifications. Homie v4 is mostly backward compatible with Homie v3 with
84- the following exceptions:
82+ .. admonition :: Homie v3 vs Homie v4
83+ :class: missing
84+ :name: v3-vs-v4
8585
86- - `Node Arrays <https://homieiot.github.io/specification/spec-core-v3_0_1/#arrays >`_
87- are not supported in Homie v4
88- - `Device Statistics <https://homieiot.github.io/specification/spec-core-v3_0_1/#device-statistics >`_
89- are not supported in Homie v4
86+ The OpenHAB `MQTT Homie binding `_ will say that it supports Homie v3.x specifications. This library
87+ implements Homie v4 specifications. Homie v4 is mostly backward compatible with Homie v3 with
88+ the following exceptions:
9089
91- These missing features are memory and process intensive for microcontrollers. At this time,
92- there are no plans to add Homie v3 support for this library.
90+ - `Node Arrays <https://homieiot.github.io/specification/spec-core-v3_0_1/#arrays >`_
91+ are not supported in Homie v4. Incidentally, Arrays aren't implemented in OpenHAB's
92+ `MQTT Homie binding `_ because the Homie specification was too vague which is why it was
93+ removed in Homie v4 (see `this HomieIoT thread comment
94+ <https://github.com/homieiot/convention/issues/90#issuecomment-385425001> `_).
95+ - `Device Statistics <https://homieiot.github.io/specification/spec-core-v3_0_1/#device-statistics >`_
96+ are not supported in Homie v4. This was removed in Homie v4 in favor of using nodes' properties
97+ (see `this HomieIoT discussion <https://github.com/homieiot/convention/issues/102 >`_).
9398
94- .. |OH-thing | replace :: OpenHAB Thing
99+ These missing features are memory and process intensive for microcontrollers. At this time,
100+ there is no plan to add Homie v3 support for this library.
95101
96102.. _add_broker_as_thing :
97103
98- Adding the MQTT broker as an |OH -thing |
104+ Adding the MQTT broker as an |oh -thing |
99105***************************************
100106
101107After `Installing the MQTT binding `_, navigate back to the settings page and open
102108`the "Things" category <http://openhabian:8080/settings/things/ >`_. You may think that installing
103109the MQTT binding didn't change anything, but automatic discovery of MQTT-capable devices still
104- requires an |OH -thing | to represent the MQTT broker.
110+ requires an |oh -thing | to represent the MQTT broker.
105111
106112.. |OH_plus | replace :: :oh-blue: `+ `
107113.. _OH_plus : http://openhabian:8080/settings/things/add
@@ -116,7 +122,7 @@ requires an |OH-thing| to represent the MQTT broker.
116122 .. image :: ../_static/tutorial_images/mqtt_binding_thing-dark.png
117123 :class: only-dark align-center
118124 :target: http://openhabian:8080/settings/things/mqtt
119- 3. At the top of the list of options that you can add as |OH -thing |\ s, you should see the MQTT broker option.
125+ 3. At the top of the list of options that you can add as |oh -thing |\ s, you should see the MQTT broker option.
120126 It will have a badge on it that says :oh-blue: `Bridge `. |click | on the MQTT broker option.
121127
122128 .. image :: ../_static/tutorial_images/mqtt_broker_thing-light.png
@@ -175,25 +181,80 @@ requires an |OH-thing| to represent the MQTT broker.
175181 Hover your mouse (or tap and hold) over the :oh-red: `ERROR ` badge to see a tooltip briefly
176182 explaining the reason for the error.
177183
178- Adding a Homie Device as an |OH -thing |
184+ Adding a | homie-dev | as an |oh -thing |
179185-----------------------------------------
180186
181187Once you have finished :ref: `add_broker_as_thing `, you are now ready to start using OpenHAB's automatic
182- discovery of Homie Devices . This section should be repeated for any instantiated `HomieDevice `
188+ discovery of | homie-dev | \ s . This section should be repeated for any instantiated `HomieDevice `
183189object.
184190
185191.. note ::
186192 Once completed, there is no need to repeat these steps again for the same `HomieDevice ` object
187193 unless you have changed the ``device_id `` parameter to the `HomieDevice ` constructor. Connecting
188- & disconnecting a Homie Device that are already added as |OH -thing |\ s should be automatically
194+ & disconnecting a | homie-dev | that are already added as |oh -thing |\ s should be automatically
189195 handled by the OpenHAB `MQTT Homie binding `_.
190196
191197First lets get a library example running on a circuitPython enabled board (with WiFi support).
192198See the :doc: `../examples ` to understand how to run a library example. For this tutorial, we'll be
193- using the `Simple test <../examples.html#simple-test >`_ example.
199+ using the `Simple test `_ example.
200+
201+ Once you've got an example running on your circuitpython board, The `HomieDevice ` must be added to
202+ OpenHAB as an |oh-thing |. The `HomieProperty ` values are used in OpenHAB as a |oh-item |, and each
203+ |oh-item | must be "linked" to an |oh-thing |'s "channel"
204+
205+ 1. To see any new Homie devices discovered by the MQTT binding, navigate to
206+ `Settings -> Things <http://openhabian:8080/settings/things/ >`_. |click | on the notification
207+ titled :oh-red: `Inbox ` at the bottom of the screen.
208+ 2. You should see your new `HomieDevice ` listed by it's ``device-_id `` (a required parameter in the
209+ `HomieDevice ` constructor).
210+
211+ .. image :: ../_static/tutorial_images/discovered_thing-light.png
212+ :class: only-light align-center
213+ .. image :: ../_static/tutorial_images/discovered_thing-dark.png
214+ :class: only-dark align-center
215+
216+ |click | on the discovered |homie-dev | and select :homie-dev: `Add as Thing ` from the pop-up menu.
217+ It will ask you for a customized name to be assigned to the |oh-thing |. By default it will use
218+ the ``device_id `` if not changed, so this step is optional. |click | the :oh-orange: `OK ` button
219+ when done.
220+ 3. You should now see the |homie-dev | in your list of |oh-thing |\ s.
221+
222+ .. image :: ../_static/tutorial_images/homie_thing-light.png
223+ :class: only-light align-center
224+ .. image :: ../_static/tutorial_images/homie_thing-dark.png
225+ :class: only-dark align-center
194226
195- Once you've got an example running, head over to you OpenHAB dashboard: http://openhabian:8080
196- (you may have to replace the hostname ``openhabian `` with the IP address like ``192.168.1.xxx ``).
197- To see any new Homie devices discovered by the MQTT binding, navigate to "Settings" -> "Things"
198- (http://openhabian:8080/settings/things/). At the bottom of the screen, you should see badge-like
199- notification titled "Inbox".
227+ To use this |homie-dev |'s properties in the OpenHAB user interfaces, you need to create an
228+ |oh-item | for each |homie-dev | property (programmatically instantiated with `HomieProperty ` or
229+ :doc: `one of its derivatives <../API/recipes >`). Each |oh-item | must be linked to a |homie-dev |
230+ property via an |oh-thing |'s channel(s).
231+
232+ To see the channels, navigate to the configuration of the |oh-thing | that represents your
233+ |homie-dev | (in your list of |oh-thing |\ s). |click | on the tab named ``Channels `` at the top of
234+ the page.
235+
236+ You should now see a list of properties belonging to your |homie-dev |. Using the `Simple test `_
237+ example, this list only has a ``color `` property. There are various ways to create |oh-item |\ s
238+ from the |oh-thing |'s ``Channels `` configuration page. Choosing 1 will depend on how you wish to
239+ craft your OpenHAB User Interface, Dashboard, or Sitemap.
240+
241+ - |click | on an available channel and select ``Add link to Item... ``, then select
242+ ``Create a new Item ``. This will create a single |oh-item |, but the item's ID must be unique in
243+ OpenHAB (cannot reuse the same ID for multiple |oh-item |\ s linked to the same |oh-thing |'s
244+ channel). While this is the most flexible, it can also become the most tedious.
245+ - |click | on the button titled :homie-val: `Add points to Model `. This will create the necessary
246+ |oh-item |\ (s) and link them to the respective property's channel.
247+ - |click | on the button titled :homie-val: `Add Equipment to Model `. This is similar to
248+ :homie-val: `Add points to Model `, however the created |oh-item |\ (s) are put into a group that
249+ represents a category of equipment.
250+
251+ .. admonition :: Going Forward
252+ :class: check
253+
254+ It is important to understand `OpenHAB's Semantic Model
255+ <https://www.openhab.org/docs/tutorial/model.html> `_ and how they can be used when crafting
256+ a User Interface.
257+
258+ This tutorial does not cover how to use OpenHAB in general. The main point of this tutorial
259+ is how to use the CircuitPython_Homie library for automatic discovery of DIY devices in
260+ OpenHAB.
0 commit comments