Wiki source code of OpenHAB with Zensehome
Last modified by Normann P. Nielsen on 2025/12/12 15:16
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | {{success}}Update 08-12-2022. Now a days ZenseHome has MQTT connection, so this page is 100% outdated. Use the MQTT Connection in ZenseHome to provide bridging to OpenHAB or similar.{{/success}} | ||
| 2 | |||
| 3 | |||
| 4 | = Architecture = | ||
| 5 | |||
| 6 | {{drawio diagramName="Arkitektur.drawio" /}} | ||
| 7 | |||
| 8 | = Java Application as Bridge = | ||
| 9 | |||
| 10 | Github Source: [[https://github.com/jobu279/zensehome]] | ||
| 11 | |||
| 12 | Compile the source code or fetch the runtime. Edit config.properties to suit your network and mqtt. | ||
| 13 | |||
| 14 | Samples below are referenced from /home/bnp/production/zensehome/zensemqtt | ||
| 15 | |||
| 16 | You need to create a "/home/bnp/production/zensehome/zensemqtt/logs" directory; - then execute the application | ||
| 17 | |||
| 18 | |||
| 19 | {{code}} | ||
| 20 | root@robin:~/production/zensehome/zensemqtt# java -Dfile.encoding=UTF-8 -classpath /home/bnp/production/zensehome:/home/bnp/production/zensehome/zensemqtt/mqtt-client-0.4.0.jar zensemqtt.ZenseMQTTJan 09, 2019 8:14:01 PM zensemqtt.Log loggingINFO: Starting ZenseHome MQTT listener | ||
| 21 | {{/code}} | ||
| 22 | |||
| 23 | = Setup a light source = | ||
| 24 | |||
| 25 | I have defined a [[Thing>>https://www.openhab.org/docs/configuration/things.html]] for the ZenseHome box: | ||
| 26 | |||
| 27 | [[image:Screenshot 2019-01-09 at 21.16.19.png||width="870"]] | ||
| 28 | |||
| 29 | [[image:Screenshot 2019-01-09 at 21.07.32.png||width="870"||height="250"]] | ||
| 30 | |||
| 31 | And are adding each light as a channel See [[Concepts>>https://www.openhab.org/docs/concepts/]]): | ||
| 32 | |||
| 33 | [[image:Screenshot 2019-01-09 at 21.05.19.png||width="900"||height="408"]] | ||
| 34 | |||
| 35 | With the [[Topics>>http://www.steves-internet-guide.com/understanding-mqtt-topics/]] according to [[https://github.com/jobu279/zensehome]]. The Id can be found in the Zensehome Windows Application: | ||
| 36 | |||
| 37 | [[image:Screenshot 2019-01-27 at 12.48.02.png||width="167"||height="250"]] | ||
| 38 | {{success}}Adding as "Percentage value" instead of ON/OFF, gives a slider for the light{{/success}} | ||
| 39 | |||
| 40 | |||
| 41 | After the Save operation, the Channel has a unique id: | ||
| 42 | |||
| 43 | [[image:Screenshot 2019-01-27 at 16.17.53.png||width="565"||height="102"]] | ||
| 44 | |||
| 45 | This is is used in [[Sitemaps>>https://www.openhab.org/docs/configuration/sitemaps.html]] and [[Item>>https://www.openhab.org/docs/concepts/items.html]] files . | ||
| 46 | |||
| 47 | = Visible and testing in Paper UI - Controls = | ||
| 48 | |||
| 49 | You should be able to see the Channels in Paper UI and test them: | ||
| 50 | |||
| 51 | [[image:Screenshot 2019-01-09 at 21.36.17.png||width="550"]] | ||
| 52 | |||
| 53 | = Installing as a service = | ||
| 54 | |||
| 55 | Follow: [[https://computingforgeeks.com/how-to-run-java-jar-application-with-systemd-on-linux/]] | ||
| 56 | |||
| 57 | = Logging = | ||
| 58 | |||
| 59 | Watch the Log in /home/bnp/production/zensehome/zensemqtt/logs | ||
| 60 | |||
| 61 | |||
| 62 | {{code}} | ||
| 63 | root@robin:~/production/zensehome/zensemqtt/logs# cat 2019-1_ZenseLog.logJan 09, 2019 7:44:53 PM zensemqtt.Log loggingINFO: Starting ZenseHome MQTT listenerJan 09, 2019 7:46:35 PM zensemqtt.Log loggingINFO: New message with topic: zense/execute/10604, Message: ONJan 09, 2019 7:46:37 PM zensemqtt.Log loggingINFO: New message with topic: zense/execute/10604, Message: OFFJan 09, 2019 7:46:43 PM zensemqtt.Log loggingINFO: New message with topic: zense/execute/10604, Message: ONJan 09, 2019 7:46:44 PM zensemqtt.Log loggingSEVERE: Error in socket creation: java.net.SocketExceptionJan 09, 2019 7:46:54 PM zensemqtt.Log loggingINFO: New message with topic: zense/execute/10604, Message: OFFJan 09, 2019 7:46:55 PM zensemqtt.Log loggingSEVERE: Error in socket creation: java.net.SocketExceptionJan 09, 2019 7:47:00 PM zensemqtt.Log loggingINFO: New message with topic: zense/execute/10604, Message: ON | ||
| 64 | {{/code}} | ||
| 65 | |||
| 66 | Notice the "SEVERE: Error in socket creation: java.net.SocketException" - this means the ZenseHome box is non-responding | ||
| 67 | {{success}}Use the [[MQTT Explorer>>https://thomasnordquist.github.io/MQTT-Explorer/]] for examining the topics{{/success}} |