Wiki source code of OpenHAB with Zensehome

Last modified by Normann P. Nielsen on 2025/07/15 12:11

Hide last authors
Normann P. Nielsen 1.1 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 = Architecture =
4
5 {{diagram reference="Main.information-technology.openhab-with-zensehome.arkitektur-drawio.WebHome" /}}
6
7 = Java Application as Bridge =
8
9 Github Source: [[https://github.com/jobu279/zensehome]]
10
11 Compile the source code or fetch the runtime. Edit config.properties to suit your network and mqtt.
12
13 Samples below are referenced from /home/bnp/production/zensehome/zensemqtt
14
15 You need to create a "/home/bnp/production/zensehome/zensemqtt/logs" directory; - then execute the application
16
17
18 {{code}}
19 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
20 {{/code}}
21
22 = Setup a light source =
23
24 I have defined a [[Thing>>https://www.openhab.org/docs/configuration/things.html]] for the ZenseHome box:
25
26 [[image:Screenshot 2019-01-09 at 21.16.19.png||width="870"||alt="Screenshot 2019-01-09 at 21.16.19.png"]]
27
28 [[image:Screenshot 2019-01-09 at 21.07.32.png||width="870"||height="250"||alt="Screenshot 2019-01-09 at 21.07.32.png"]]
29
30 And are adding each light as a channel See [[Concepts>>https://www.openhab.org/docs/concepts/]]):
31
32 [[image:Screenshot 2019-01-09 at 21.05.19.png||width="900"||height="408"||alt="Screenshot 2019-01-09 at 21.05.19.png"]]
33
34 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:
35
36 [[image:Screenshot 2019-01-27 at 12.48.02.png||width="167"||height="250"||alt="Screenshot 2019-01-27 at 12.48.02.png"]]
37
38 {{success}}Adding as "Percentage value" instead of ON/OFF, gives a slider for the light{{/success}}
39
40 After the Save operation, the Channel has a unique id:
41
42 [[image:Screenshot 2019-01-27 at 16.17.53.png||width="565"||height="102"||alt="Screenshot 2019-01-27 at 16.17.53.png"]]
43
44 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 .
45
46 = Visible and testing in Paper UI - Controls =
47
48 You should be able to see the Channels in Paper UI and test them:
49
50 [[image:Screenshot 2019-01-09 at 21.36.17.png||width="550"||alt="Screenshot 2019-01-09 at 21.36.17.png"]]
51
52 = Installing as a service =
53
54 Follow: [[https://computingforgeeks.com/how-to-run-java-jar-application-with-systemd-on-linux/]]
55
56 = Logging =
57
58 Watch the Log in /home/bnp/production/zensehome/zensemqtt/logs
59
60
61 {{code}}
62 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
63 {{/code}}
64
65 Notice the "SEVERE: Error in socket creation: java.net.SocketException" - this means the ZenseHome box is non-responding
66
67 {{success}}Use the [[MQTT Explorer>>https://thomasnordquist.github.io/MQTT-Explorer/]] for examining the topics{{/success}}