Page 5 of 6
Re: Connecting Plugwise-2-py via MQTT to Domoticz
Posted: Sunday 04 December 2016 12:41
by SweetPants
edwin1234 wrote:I have solved the first isue but now i have an error that theres no paho mqtt client but i have mosquitto, can i use that too?
If the error comes from the plugwise python script, you have to stick with Paho or re-write the plugwise script to support something else. Just google how to install Paho client on your windows machine and your done (i hope)
Re: Connecting Plugwise-2-py via MQTT to Domoticz
Posted: Sunday 04 December 2016 17:57
by edwin1234
Thank u very much
For youre help
I try that
Re: Connecting Plugwise-2-py via MQTT to Domoticz
Posted: Monday 05 December 2016 22:57
by heggink
Stuggling to get this to work. Plugwise runs in 1 pi, domoticz (and mqqt / node-red) on another
What works:
Plugwise-2 and Plugwise-2-web both run. I can change devices via the web interface and I can see power usage (yay)
Logs also show that the buffers are bing read and recorded
On domoticz:
- HW MQTT gateway installed on localhost idx 42
- node-red config updated to use idx 42 and localhost (127.0.0.1, default)
- node-red sees incoming messages:
Dec 5 22:47:01 domoticz Node-RED[449]: 5 Dec 22:47:01 - [info] [function:Plugwise2 Power to Domoticz] Relay Plugwise MQTT power message to Domoticz HTTP
Dec 5 22:47:01 domoticz Node-RED[449]: 5 Dec 22:47:01 - [info] [debug:msg.url]
http://127.0.0.1:8080/json.htm?type=com ... e=241.36;0
using mosquitto_pub, I can update a virtual switch in domoticz from the other pi
Problem: no devices are being created (either with accept new hardware devices on or off)
mosquitto log shows socket error:
1480971162: mosquitto version 1.4.10 (build date Thu, 25 Aug 2016 10:12:09 +0100) starting
1480971163: Config loaded from /etc/mosquitto/mosquitto.conf.
1480971163: Opening ipv4 listen socket on port 1883.
1480971163: Opening ipv6 listen socket on port 1883.
1480971167: New connection from 192.168.1.110 on port 1883.
1480971167: New client connected from 192.168.1.110 as Plugwise-2-web4925 (c1, k60).
1480971170: New connection from 127.0.0.1 on port 1883.
1480971170: New client connected from 127.0.0.1 as mosq/V=_r1=HuPYP4[E_8Ki (c1, k60).
1480971186: New connection from 127.0.0.1 on port 1883.
1480971186: New client connected from 127.0.0.1 as mqtt_57bf9d9f.a84064 (c1, k60).
1480971218: Socket error on client Plugwise-2-web4925, disconnecting.
Not sure if the socket error is the culprit but I cannot find any other errors at the moment.
Any help is greatly appreciated.
Re: Connecting Plugwise-2-py via MQTT to Domoticz
Posted: Monday 05 December 2016 23:29
by heggink
NVM, turned out that domoticz was not accepting any calls from localhost and wanted the IP instead.
Is it normal to have 3 devices per plug: 1 on, 1 off and one power?
Re: Connecting Plugwise-2-py via MQTT to Domoticz
Posted: Tuesday 03 January 2017 10:45
by heggink
Hi SevenW,
Quick question on your implementation: I noticed that the devices are not listed as consumption devices. I do get the power readings but Domoticz doesn't track total consumption (unlike e.g. a dimmer with a power reading).
Does that make sense or did something go wrong discovering devices? Thx!
H
Re: Connecting Plugwise-2-py via MQTT to Domoticz
Posted: Thursday 23 February 2017 8:57
by heggink
The consumption devices were there all along. Just didn't see them at first.
Re: Connecting Plugwise-2-py via MQTT to Domoticz
Posted: Monday 27 February 2017 13:19
by edwin1234
HI,i cant get it start at all,
i folowed the wiki ,configured the config.json files and the node red flow ,node red is running and mosquito also,i have made a dummy hardware device idx 9 and adjust that in the node red flow
but when i try to run plugwise-2.py i get this error:
pi@raspberrypi:~/Plugwise-2-py $ python Plugwise-2.py
True
Traceback (most recent call last):
File "Plugwise-2.py", line 88, in <module>
open_logcomm(logpath+"pw-communication.log")
File "/home/pi/Plugwise-2-py/swutil/util.py", line 106, in open_logcomm
handler = logging.handlers.RotatingFileHandler(filename, maxBytes=1000000, backupCount=5)
File "/usr/lib/python2.7/logging/handlers.py", line 117, in __init__
BaseRotatingHandler.__init__(self, filename, mode, encoding, delay)
File "/usr/lib/python2.7/logging/handlers.py", line 64, in __init__
logging.FileHandler.__init__(self, filename, mode, encoding, delay)
File "/usr/lib/python2.7/logging/__init__.py", line 911, in __init__
StreamHandler.__init__(self, self._open())
File "/usr/lib/python2.7/logging/__init__.py", line 936, in _open
stream = open(self.baseFilename, self.mode)
IOError: [Errno 13] Permission denied: u'/home/pi/pwlog/pw-communication.log'
pi@raspberrypi:~/Plugwise-2-py $
what is wrong?
thanks
Re: Connecting Plugwise-2-py via MQTT to Domoticz
Posted: Tuesday 28 February 2017 9:39
by edwin1234
i have it running now
i think its a permission thing,when i use sudo in front it works.
but my py cpu usese 84% now before the script it was like 15% is this a problem ? if so how to fix this?
thank you
Re: Connecting Plugwise-2-py via MQTT to Domoticz
Posted: Tuesday 28 February 2017 12:14
by edwin1234
after restarting the pi
it doesnt work annymore
can someone please help?
i get this:
sudo python Plugwise-2.py
True
rsync -aXuq /home/pi/datalog/2017/pwact/pwact-2017-02-28*.log /tmp/2017/pwact/
Traceback (most recent call last):
File "Plugwise-2.py", line 1467, in <module>
main=PWControl()
File "Plugwise-2.py", line 126, in __init__
self.device = Stick(port, timeout=1)
File "/home/pi/Plugwise-2-py/plugwise/api.py", line 60, in __init__
self.init()
File "/home/pi/Plugwise-2-py/plugwise/api.py", line 65, in init
self.send_msg(msg)
File "/home/pi/Plugwise-2-py/plugwise/api.py", line 93, in send_msg
resp = self.expect_response(PlugwiseAckResponse)
File "/home/pi/Plugwise-2-py/plugwise/api.py", line 186, in expect_response
msg = self._recv_response(retry_timeout)
File "/home/pi/Plugwise-2-py/plugwise/api.py", line 142, in _recv_response
raise TimeoutException("Timeout while waiting for response from device")
plugwise.exceptions.TimeoutException: Timeout while waiting for response from device
cat /tmp/pwout.log
True
rsync -aXuq /home/pi/datalog/2017/pwact/pwact-2017-02-28*.log /tmp/2017/pwact/
Traceback (most recent call last):
File "Plugwise-2.py", line 1467, in <module>
main=PWControl()
File "Plugwise-2.py", line 126, in __init__
self.device = Stick(port, timeout=1)
File "/home/pi/Plugwise-2-py/plugwise/api.py", line 60, in __init__
self.init()
File "/home/pi/Plugwise-2-py/plugwise/api.py", line 65, in init
self.send_msg(msg)
File "/home/pi/Plugwise-2-py/plugwise/api.py", line 93, in send_msg
resp = self.expect_response(PlugwiseAckResponse)
File "/home/pi/Plugwise-2-py/plugwise/api.py", line 186, in expect_response
msg = self._recv_response(retry_timeout)
File "/home/pi/Plugwise-2-py/plugwise/api.py", line 142, in _recv_response
raise TimeoutException("Timeout while waiting for response from device")
plugwise.exceptions.TimeoutException: Timeout while waiting for response from device
True
Traceback (most recent call last):
File "/home/pi/Plugwise-2-py/Plugwise-2.py", line 66, in <module>
cfg = json.load(open("config/pw-hostconfig.json"))
IOError: [Errno 2] No such file or directory: 'config/pw-hostconfig.json'
i checked :pw-hostconfig.json is in the map config.
Re: Connecting Plugwise-2-py via MQTT to Domoticz
Posted: Friday 24 March 2017 12:03
by lukeotto
bink wrote:First I would like to thank SevenW. for integrating the Plugwise into domoticz. Have been using the Plugwise-2-py scripts and feeding the info into domoticz for some months now. However I'm now running into the following issue:
I'm trying to replace my current Kaku switch as it's not 100% reliable with a plugwise circle to switch on/off some lights. I'm using a scene to switch on the lights when I press a kaku button. The scene includes some Hue lights a couple of zWave switches and now a plugwise circle. All the devices except the circle are switching on/off. If I look into log the switch command seems to be sent and the circle status does change inside domoticz. However the circle does not change status in real life. If I look in the pw-logger.log I also don't see a switch command coming by. So it looks like domoticz is not sending the MQTT command out (If Iswitch the circle manually from the domoticz switches page it works without a problem).
Does anybody have an idea why this is not working?
I have the same problem. Is there already a solution for this problem?
Re: Connecting Plugwise-2-py via MQTT to Domoticz
Posted: Thursday 15 June 2017 17:41
by walberg
I have followed the link
https://github.com/SevenW/Plugwise-2-py ... cz.nodered
I put the code into Node red and said import. The link does not tell me what to do next. I have a Plugwise stick 1 Circle + and 7 circles
https://www.domoticz.com/forum/download ... w&id=11643
https://www.domoticz.com/forum/download ... w&id=11643
Re: Connecting Plugwise-2-py via MQTT to Domoticz
Posted: Thursday 22 June 2017 23:29
by Vince88
indeed this is where the readme stops. I struggled here as well since it was my first time to use node-red. You changed the Idx in the node to point towards your virtual device i assume? If so, press the 'deploy' button in the top right corner.. press this and your circles should appear:)
Re: Connecting Plugwise-2-py via MQTT to Domoticz
Posted: Wednesday 01 November 2017 15:48
by basxcore
I've got everything running. NodeRed, MQTT, Plugwise-2-py. I get all of my plugs in Domoticz, their ID is the UID of the Circle. But the 'Name' field is 'unknown'. I do not know if this should be filled in to whats set in 'pw-conf.json'.
Any thoughts?
Re: Connecting Plugwise-2-py via MQTT to Domoticz
Posted: Sunday 26 November 2017 12:43
by heggink
I never managed to get the on/off for any switch to work. Instead, Whenever I switch, I get an error: MySensors: Light command received for unknown node_id: 213
Using mqtt, I can create dummy devices that switch so I have a workaround but it creates a lot more admin/work. Any clues how to fix? I get all the power/consumption readings just fine...
Re: Connecting Plugwise-2-py via MQTT to Domoticz
Posted: Monday 12 March 2018 16:02
by Corspruit
I'm strugling with the switching. I got the message Error: Switch command not send!, Hardware device disabled or not found! in the Domoticz log. Is there a circumvention available to switch via On/Off Action?
Re: Connecting Plugwise-2-py via MQTT to Domoticz
Posted: Monday 12 March 2018 21:13
by Corspruit
I have the following situation:
- I have devices added
11 VirtualPlugwise-2-py B416BCAE 1 Overloop on Lighting 2 AC On - - Zet als ongebruikt Naam wijzigen Log 2018-03-12
12 VirtualPlugwise-2-py C416BCAE 1 Overloop off Lighting 2 AC Off - - Zet als ongebruikt Naam wijzigen Log 2018-03-12
- I can switch on/off devices with mosquitto, i can see changes in the bulb
(mosquitto_pub -h localhost -t "domoticz/in" -m '{ "idx" : 11, "nvalue" : 0 }')
- but in real live the bulb is not switching on or off at all
Re: Connecting Plugwise-2-py via MQTT to Domoticz
Posted: Monday 03 September 2018 23:35
by uibeltje
I am stuck at this moment connecting my plugwise circles to Domoticz.
Everything seems to work fine except the connection between node-red and Domoticz. I do see data in the data-log folder but fail to import it in Domoticz via node-red.
I have created the Virtualplugwise-2-py hardware and entered the idx in node-red but the circles don't pop-up in the list.
Does anybody know where to look for errors? Is there a node-red logfile? My experience with the command line is limited but I learn by trial and error.
Re: Connecting Plugwise-2-py via MQTT to Domoticz
Posted: Sunday 07 October 2018 19:16
by mvdp
I have Plugwise-2-py via MQTT to Domoticz running.
I started with version 3.x of Domoticz which was able to create all devices in Domoticz and update values.
So far so good.
I've now upgraded to version 4.9700 and want to run a modified version of the Node-red scripts to read out a rtl-433 device via MQTT.
The problem I now have is that no devices are created and updated with values.
Browsing through the Domoticz source code it seems a check was added to the udevice json command handler to verify the device actually exists.
This is added since version 3.x in mainworker.cpp line 12951:
// Prevent hazardous modification of DB from JSON calls
if (!m_sql.DoesDeviceExist(HardwareID, DeviceID.c_str(), unit, devType, subType))
return false;
It looks like this check was not here for the 3.x version so I assume that Plugwise-2-py used to work with the 3.x version but fails to run correctly with the 4.x version.
A fix would be to call the createdevice json command in case the device doesn't exist yet.
I might be wrong in this so Domoticz / Plugwise-2-py maintainers please respond.
Re: Connecting Plugwise-2-py via MQTT to Domoticz
Posted: Sunday 04 November 2018 12:20
by powermundsen
Thanks for the tip mvdp! I was struggling to get my plugs showing up in the devices menu on 4.X but managed to get it working by installing a 3.X version.
Starting up a 3.X version I found online was not working on its own so ended up taking the easy way out by also going back to an earlier version of Rasbian Jessie (
http://downloads.raspberrypi.org/raspbi ... 017-07-05/). When running domoticz_3.8153_linux_armv7l on the Pi all my devices showed up immediately. I'm sure this is not ideal for security, but for the purposes of collecting some consumption data, it worked great for me.
Re: Connecting Plugwise-2-py via MQTT to Domoticz
Posted: Wednesday 09 January 2019 8:05
by dorenberg
Is there some more news already about this?