Wiki source code of Home Assistant with Zensehome

Version 10.1 by Normann P. Nielsen on 2026/11/15 15:41

Hide last authors
Normann P. Nielsen 1.1 1 = Architecture =
2
3 {{diagram reference="Main.information-technology.home-assistant.home-assistant-with-zensehome.arkitektur-drawio.WebHome" /}}
4
5
6
7
8
9 = MQTT =
10
11 Home Assistant does not have a builtin MQTT Broker, so I have a docker for it: [[Adding Mosquitto (MQTT) to my Home Automation>>Main.information-technology.home-assistant.adding-mosquitto-mqtt-to-my-home-automation]]
12
13 = Java Application as Bridge =
14
15 Github Source: [[https://github.com/jobu279/zensehome]]
16
17 Compile the source code or fetch the runtime. Edit config.properties to suit your network and mqtt.
18
19 Samples below are referenced from /home/bnp/production/zensehome/zensemqtt
20
21 You need to create a "/home/bnp/production/zensehome/zensemqtt/logs" directory; - then execute the application
22
23
24 {{code}}
25 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
26 {{/code}}
27
28 = Setup a light source =
29
30 My configuration.yaml has these parts:
31
32
33 {{code}}
34 mqtt: broker: 10.0.0.150light: !include light.yaml
35 {{/code}}
36
37 My lights.yaml looks like this:
38
39
40 {{code}}
41 - platform: mqtt name: "Kitchen Light" state_topic: "zense/execute/18324" command_topic: "zense/execute/18324" payload_on: "ON" payload_off: "OFF" - platform: mqtt name: "Office Light" state_topic: "zense/execute/10604" command_topic: "zense/execute/10604" payload_on: "ON" payload_off: "OFF" - platform: mqtt name: "Bedroom Light" state_topic: "zense/execute/58739" command_topic: "zense/execute/58739" payload_on: "ON" payload_off: "OFF"........
42 {{/code}}
43
44 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:
45
46 [[image:Screenshot 2019-01-27 at 12.48.02.png||alt="Screenshot 2019-01-27 at 12.48.02.png"]]
47
48
49
50 After restarting Home Assistent, the lights will be entries:
51
52
53
54 [[image:Screenshot 2019-11-29 at 17.07.08.png||width="800"||alt="Screenshot 2019-11-29 at 17.07.08.png"]]
55
56 = Installing as a service =
57
58 Follow: [[https://computingforgeeks.com/how-to-run-java-jar-application-with-systemd-on-linux/]]
59
60 = Logging =
61
62 Watch the Log in /home/bnp/production/zensehome/zensemqtt/logs
63
64
65 {{code}}
66 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
67 {{/code}}
68
69 Notice the "SEVERE: Error in socket creation: java.net.SocketException" - this means the ZenseHome box is non-responding
70
71 {{success}}Use the [[MQTT Explorer>>https://thomasnordquist.github.io/MQTT-Explorer/]] for examining the topics{{/success}}