RaZberry: a full featured Z-Wave Home Controller
Re: RaZberry: a full featured Z-Wave Home Controller
I get
[ ok ] Restarting network daemon:: mosquitto.
[ ok ] Restarting network daemon:: mosquitto.
-
- Plugin Developer
- Posts: 2570
- Joined: Sat Jun 30, 2007 2:51 pm
- Location: Stockholm, Sweden
- Contact:
Re: RaZberry: a full featured Z-Wave Home Controller
Fine, so we now that mosquitto is running...
I will make a simple python script just to test that we can connect
I will make a simple python script just to test that we can connect
My released plugins
https://drive.google.com/drive/folders/ ... y01eVBKeHM
https://drive.google.com/drive/folders/ ... y01eVBKeHM
-
- Plugin Developer
- Posts: 2570
- Joined: Sat Jun 30, 2007 2:51 pm
- Location: Stockholm, Sweden
- Contact:
Re: RaZberry: a full featured Z-Wave Home Controller
1) Copy the attached mosquitto.py file to EG's \lib26\site-packages folder
3) Change the ip (the ip of your Pi)
Run the script and study the log if it connects and receives events
2) In EG, create a Python Script and paste the code from below3) Change the ip (the ip of your Pi)
Run the script and study the log if it connects and receives events
Code: Select all
#!/usr/bin/python
# Copyright (c) 2010,2011 Roger Light <roger@atchoo.org>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of mosquitto nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
import mosquitto
def on_connect(mosq, obj, rc):
mosq.subscribe("/zwave/#", 0)
print("rc: "+str(rc))
def on_message(mosq, obj, msg):
print(msg.topic+" "+str(msg.qos)+" "+str(msg.payload))
def on_publish(mosq, obj, mid):
print("mid: "+str(mid))
def on_subscribe(mosq, obj, mid, granted_qos):
print("Subscribed: "+str(mid)+" "+str(granted_qos))
def on_log(mosq, obj, level, string):
print(string)
# If you want to use a specific client id, use
# mqttc = mosquitto.Mosquitto("client-id")
# but note that the client id must be unique on the broker. Leaving the client
# id parameter empty will generate a random id for you.
mqttc = mosquitto.Mosquitto()
mqttc.on_message = on_message
mqttc.on_connect = on_connect
mqttc.on_publish = on_publish
mqttc.on_subscribe = on_subscribe
# Uncomment to enable debug messages
#mqttc.on_log = on_log
mqttc.connect("192.168.10.248")
mqttc.loop_start()
#mqttc.disconnect()
My released plugins
https://drive.google.com/drive/folders/ ... y01eVBKeHM
https://drive.google.com/drive/folders/ ... y01eVBKeHM
-
- Plugin Developer
- Posts: 2570
- Joined: Sat Jun 30, 2007 2:51 pm
- Location: Stockholm, Sweden
- Contact:
Re: RaZberry: a full featured Z-Wave Home Controller
Depending on the results from the test described in the previous post, it might be better to use a separate MQTT Client to verify that the Mosquitto broker is working correctly in your Pi.
Below is a screenshot where I use Paho for Windows. You find it here:
http://www.eclipse.org/paho/clients/tool/
Below is a screenshot where I use Paho for Windows. You find it here:
http://www.eclipse.org/paho/clients/tool/
My released plugins
https://drive.google.com/drive/folders/ ... y01eVBKeHM
https://drive.google.com/drive/folders/ ... y01eVBKeHM
Re: RaZberry: a full featured Z-Wave Home Controller
Hi
Weirdly, after a further reboot of the machine with event ghost running on its started working
07:52:00 RaZBerry Z-Way: Remote Socket OFF
07:52:01 Main./zwave '0 Device_3_Instance_0_off, 0'
07:52:02 Main./zwave '0 Device_3_Instance_0_off, 0'
07:52:04 Main./zwave '0 Device_3_Instance_0_off, 0'
07:52:05 Main./zwave '0 Device_3_Instance_0_off, 0
At least the remote socket part has, I havent altered the section for the sensor yet, thought id start easy!
Really not sure what changed with the reboot, maybe it was a windows update causing issues or.... ??
Weirdly, after a further reboot of the machine with event ghost running on its started working
07:52:00 RaZBerry Z-Way: Remote Socket OFF
07:52:01 Main./zwave '0 Device_3_Instance_0_off, 0'
07:52:02 Main./zwave '0 Device_3_Instance_0_off, 0'
07:52:04 Main./zwave '0 Device_3_Instance_0_off, 0'
07:52:05 Main./zwave '0 Device_3_Instance_0_off, 0
At least the remote socket part has, I havent altered the section for the sensor yet, thought id start easy!
Really not sure what changed with the reboot, maybe it was a windows update causing issues or.... ??
-
- Plugin Developer
- Posts: 2570
- Joined: Sat Jun 30, 2007 2:51 pm
- Location: Stockholm, Sweden
- Contact:
Re: RaZberry: a full featured Z-Wave Home Controller
Good, looks as you have it working. If you don't want repeated events that Z-Way sends out, you can adjust the delay in the plugin setting. Maybe 5 seconds is a good choice.
My released plugins
https://drive.google.com/drive/folders/ ... y01eVBKeHM
https://drive.google.com/drive/folders/ ... y01eVBKeHM
Re: RaZberry: a full featured Z-Wave Home Controller
I'm just following the thread, and it is interesting... I don't have z-wave devices, but was considering controlled sockets and some ip-zwave bridge (so I could interface it with a Loxone home automation server). The RazBerry seems like one of the best options so far, and I learned about it here. Thanks! The EventGhost functionality is an added bonus. Any Z-Wave things are still on long term planning, but it is good to know options. 

Re: RaZberry: a full featured Z-Wave Home Controller
I think I now have the temperature working,
10:45:43 Main./zwave '0 Device_2_Instance_0_temperature, 20.1'
however the fibaro also has a luminance detector as well, how do I add that?
I need to wait for some movement to know if the motion detector is reporting!
I've also noticed that if I reboot the pi it doesnt start reporting again until I go into the MQTT Client on eventghost to reconnect (unless I am just too impatient!)
10:45:43 Main./zwave '0 Device_2_Instance_0_temperature, 20.1'
however the fibaro also has a luminance detector as well, how do I add that?
I need to wait for some movement to know if the motion detector is reporting!
I've also noticed that if I reboot the pi it doesnt start reporting again until I go into the MQTT Client on eventghost to reconnect (unless I am just too impatient!)
Re: RaZberry: a full featured Z-Wave Home Controller
The motion sensor is working as well. You mention I can add a delay in the plug in, I can't see where though?
-
- Plugin Developer
- Posts: 2570
- Joined: Sat Jun 30, 2007 2:51 pm
- Location: Stockholm, Sweden
- Contact:
Re: RaZberry: a full featured Z-Wave Home Controller
You mention I can add a delay in the plug in, I can't see where though?
This is where main.js is needed to modify. The basic functionality is that you have to 'bind' to events in the Z-Way. Like it is done for temperature and switches it needs to be done for luminiscence events so we need to add a section for this in your main.js (eventually we need to add a new function as well), all this is rather straight forward. A very optimistic guess is that the code to be added to the main.js could look like this:the fibaro also has a luminance detector as well, how do I add that?
Code: Select all
function sensor_luminiscence (device, instance, theValue) {
device += "";
instance += "";
theValue += "";
eventString = 'Device_' + device + '_Instance_' + instance + '_luminiscence';
publish_mqtt(eventString, theValue);
}
zway.devices[2].instances[0].commandClasses.SensorMultilevel.data[3].val.bind(function() {
sensor_luminiscence (2, 0, this.value);
});
Code: Select all
http://pi:8083/ZWaveAPI/Run/devices[2].instances[0].commandClasses.SensorMultilevel.data[1].val
Code: Select all
http://pi:8083/ZWaveAPI/Run/devices[2].instances[0].commandClasses.SensorMultilevel.data[2].val
Code: Select all
http://pi:8083/ZWaveAPI/Run/devices[2].instances[0].commandClasses.SensorMultilevel.data[3].val
The MQTT Clients should try to reconnect automatically, at least they do for me. I think I have to check if I am running a newer unpublished version...it doesnt start reporting again until I go into the MQTT Client
Best regards, Walter
EDIT: I just realize, sorry for that, that I have made several improvements since I published the plugin. You can try this one instead. When you upgrade
1) Disable the current MQTT plugin and all MQTT Clients, save and exit EG
2) Replace the __init__.py file in the MQTT plugin folder
3) Start EG
4) Open MQTT plugin config and click OK
5) Enable the plugin
6) Enable the MQTT Clients and execute (run) them, check in the plugin that they are started and running
My released plugins
https://drive.google.com/drive/folders/ ... y01eVBKeHM
https://drive.google.com/drive/folders/ ... y01eVBKeHM
Re: RaZberry: a full featured Z-Wave Home Controller
Wonderful.
delay sorted (was looking in the wrong plugin
)
data[1] is providing temperature
data[3] is providing luminescence
data[2] - Error 500: Internal Server Error
Uncaught TypeError: Cannot read property 'val' of undefined
(maybe its the battery level or the movement alarm sensor)
I've updated the plug in but still it doesn't automatically reconnect after the pi is rebooted.
Also, please let me thank you for all the help you've given me with this, as a non-programmer large chunks of information are meaningless to me and you have been a great help.
delay sorted (was looking in the wrong plugin

data[1] is providing temperature
data[3] is providing luminescence
data[2] - Error 500: Internal Server Error
Uncaught TypeError: Cannot read property 'val' of undefined
(maybe its the battery level or the movement alarm sensor)
I've updated the plug in but still it doesn't automatically reconnect after the pi is rebooted.
Also, please let me thank you for all the help you've given me with this, as a non-programmer large chunks of information are meaningless to me and you have been a great help.
-
- Plugin Developer
- Posts: 2570
- Joined: Sat Jun 30, 2007 2:51 pm
- Location: Stockholm, Sweden
- Contact:
Re: RaZberry: a full featured Z-Wave Home Controller
No problem, cool that you got it working. Having a MQTT broker on board in the Pi makes it really useful, you can subscribe and publish events from any client in any type of system, not only EG and Windows.
After you did the url test, I think the code above for the main.js should work. You can copy & paste it into your existing main.js and then restart the z-way-server, hopefully you will get the luminiscence value. Maybe you have to configure how frequent it shall be reported (if it is possible, you will find it inthe zway gui).
After you did the url test, I think the code above for the main.js should work. You can copy & paste it into your existing main.js and then restart the z-way-server, hopefully you will get the luminiscence value. Maybe you have to configure how frequent it shall be reported (if it is possible, you will find it inthe zway gui).
I just rebooted my Pi and this is what I get in the EG log, my client is automatically reconnecting correctly and after a while events are popping inI've updated the plug in but still it doesn't automatically reconnect after the pi is rebooted.
Code: Select all
15:59:33 MQTT Client: Trying to reconnect with.../zwave/# 192.168.10.248
15:59:43 MQTT Client Z-Way: Succesfully connected with MQTT broker...
15:59:43 Subscribed: 2 (0,)
16:00:20 MQTT./zwave u"Device_6_Instance_3_temperature, 20.43"
My released plugins
https://drive.google.com/drive/folders/ ... y01eVBKeHM
https://drive.google.com/drive/folders/ ... y01eVBKeHM
Re: RaZberry: a full featured Z-Wave Home Controller
Im now getting motion, light and temperature readings which is fantastic.
When the pi gets rebooted I get
then no reconnection happens.
When the pi gets rebooted I get
Code: Select all
14:27:12 Exception in thread Z-Way:
14:27:12 Traceback (most recent call last):
14:27:12 File "threading.pyc", line 532, in __bootstrap_inner
14:27:12 File "C:\Program Files (x86)\EventGhost\plugins\MQTT Client\__init__.py", line 296, in run
14:27:12 resp = mqttc.connect(self.host, self.port, 30, "")
14:27:12 File "C:\Program Files (x86)\EventGhost\plugins\MQTT Client\mosquitto.py", line 569, in connect
14:27:12 return self.reconnect()
14:27:12 File "C:\Program Files (x86)\EventGhost\plugins\MQTT Client\mosquitto.py", line 645, in reconnect
14:27:12 self._sock = socket.create_connection((self._host, self._port))
14:27:12 File "socket.pyc", line 514, in create_connection
14:27:12 error: [Errno 10061] No connection could be made because the target machine actively refused it
14:27:12
-
- Plugin Developer
- Posts: 2570
- Joined: Sat Jun 30, 2007 2:51 pm
- Location: Stockholm, Sweden
- Contact:
Re: RaZberry: a full featured Z-Wave Home Controller
I see now, this is related to the mosquitto.py module itself. Actually, this is some time ago, I also made modifications to that one to overcome several problems similar to the one you experienced.
Try to replace with the attached one
Try to replace with the attached one
My released plugins
https://drive.google.com/drive/folders/ ... y01eVBKeHM
https://drive.google.com/drive/folders/ ... y01eVBKeHM
Re: RaZberry: a full featured Z-Wave Home Controller
Hi
Do you know if there are issues with recent RaZberry software updates? ?
I've updated both the version of raspbian and the z-wave software, the mqtt connects but im not getting anything notifications though.
I've checked the custom script is still in main.js and that mosquitto is running correctly.
thanks
/Phil
Do you know if there are issues with recent RaZberry software updates? ?
I've updated both the version of raspbian and the z-wave software, the mqtt connects but im not getting anything notifications though.
I've checked the custom script is still in main.js and that mosquitto is running correctly.
thanks
/Phil