Connecting Plugwise-2-py via MQTT to Domoticz

User avatar
heggink
Posts: 531
Joined: Tuesday 08 September 2015 21:44
Target OS: Raspberry Pi
Domoticz version: V4.9999
Location: NL
Contact:

Re: Connecting Plugwise-2-py via MQTT to Domoticz

Post by heggink » Friday 02 December 2016 22:35

I run domoticz on a different pi than the one that has my plugwise stick. I am assuming things should just work if I fill in the right ip in domoticz as well as in the plugwise-2-pi configs, correct?
Thanks!
H
Pi3, latest beta
RFXCOM, z-wave (AEOTEC, switches, temhum, pir, contacts),
Plugwise2py, P1 'smart'meter & solar panel
Alexa, Wifi Cams motion detection
ESP: relays, PIR & Temp/TempHum
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest

SweetPants
Posts: 2250
Joined: Friday 12 July 2013 21:24
Target OS: Linux
Domoticz version: V4.9999
Location: The Netherlands
Contact:

Re: Connecting Plugwise-2-py via MQTT to Domoticz

Post by SweetPants » Sunday 04 December 2016 13:41

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)
Ubuntu 16.04.3 LTS, Intel NUC, MySensors 2.3.0-alpha, Pro Mini 3.3/8M RFM69(HW), ESP8266 (SDK2.2.0), Sonoff, RFLink, RFXcom, MQTT, NodeRed, Domoticz Beta (from source)

edwin1234
Posts: 106
Joined: Sunday 09 October 2016 20:20
Target OS: Windows
Domoticz version:
Contact:

Re: Connecting Plugwise-2-py via MQTT to Domoticz

Post by edwin1234 » Sunday 04 December 2016 18:57

Thank u very much
For youre help
I try that

User avatar
heggink
Posts: 531
Joined: Tuesday 08 September 2015 21:44
Target OS: Raspberry Pi
Domoticz version: V4.9999
Location: NL
Contact:

Re: Connecting Plugwise-2-py via MQTT to Domoticz

Post by heggink » Monday 05 December 2016 23:57

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.
Pi3, latest beta
RFXCOM, z-wave (AEOTEC, switches, temhum, pir, contacts),
Plugwise2py, P1 'smart'meter & solar panel
Alexa, Wifi Cams motion detection
ESP: relays, PIR & Temp/TempHum
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest

User avatar
heggink
Posts: 531
Joined: Tuesday 08 September 2015 21:44
Target OS: Raspberry Pi
Domoticz version: V4.9999
Location: NL
Contact:

Re: Connecting Plugwise-2-py via MQTT to Domoticz

Post by heggink » Tuesday 06 December 2016 0:29

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?
Pi3, latest beta
RFXCOM, z-wave (AEOTEC, switches, temhum, pir, contacts),
Plugwise2py, P1 'smart'meter & solar panel
Alexa, Wifi Cams motion detection
ESP: relays, PIR & Temp/TempHum
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest

User avatar
heggink
Posts: 531
Joined: Tuesday 08 September 2015 21:44
Target OS: Raspberry Pi
Domoticz version: V4.9999
Location: NL
Contact:

Re: Connecting Plugwise-2-py via MQTT to Domoticz

Post by heggink » Tuesday 03 January 2017 11:45

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
Pi3, latest beta
RFXCOM, z-wave (AEOTEC, switches, temhum, pir, contacts),
Plugwise2py, P1 'smart'meter & solar panel
Alexa, Wifi Cams motion detection
ESP: relays, PIR & Temp/TempHum
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest

User avatar
heggink
Posts: 531
Joined: Tuesday 08 September 2015 21:44
Target OS: Raspberry Pi
Domoticz version: V4.9999
Location: NL
Contact:

Re: Connecting Plugwise-2-py via MQTT to Domoticz

Post by heggink » Thursday 23 February 2017 9:57

The consumption devices were there all along. Just didn't see them at first.
Pi3, latest beta
RFXCOM, z-wave (AEOTEC, switches, temhum, pir, contacts),
Plugwise2py, P1 'smart'meter & solar panel
Alexa, Wifi Cams motion detection
ESP: relays, PIR & Temp/TempHum
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest

edwin1234
Posts: 106
Joined: Sunday 09 October 2016 20:20
Target OS: Windows
Domoticz version:
Contact:

Re: Connecting Plugwise-2-py via MQTT to Domoticz

Post by edwin1234 » Monday 27 February 2017 14:19

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

edwin1234
Posts: 106
Joined: Sunday 09 October 2016 20:20
Target OS: Windows
Domoticz version:
Contact:

Re: Connecting Plugwise-2-py via MQTT to Domoticz

Post by edwin1234 » Tuesday 28 February 2017 10:39

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

edwin1234
Posts: 106
Joined: Sunday 09 October 2016 20:20
Target OS: Windows
Domoticz version:
Contact:

Re: Connecting Plugwise-2-py via MQTT to Domoticz

Post by edwin1234 » Tuesday 28 February 2017 13:14

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.

lukeotto
Posts: 1
Joined: Friday 24 March 2017 13:01
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Connecting Plugwise-2-py via MQTT to Domoticz

Post by lukeotto » Friday 24 March 2017 13:03

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?

walberg
Posts: 56
Joined: Thursday 28 May 2015 18:41
Target OS: NAS (Synology & others)
Domoticz version: 3.5877
Location: Diemen Netherlands
Contact:

Re: Connecting Plugwise-2-py via MQTT to Domoticz

Post by walberg » Thursday 15 June 2017 17:41

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
Attachments
Schermafbeelding 2017-06-15 om 17.37.13.jpg
Schermafbeelding 2017-06-15 om 17.37.13.jpg (176.5 KiB) Viewed 2568 times
Schermafbeelding 2017-06-15 om 17.36.08.jpg
Schermafbeelding 2017-06-15 om 17.36.08.jpg (138.3 KiB) Viewed 2568 times

Vince88
Posts: 2
Joined: Thursday 22 June 2017 23:19
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Connecting Plugwise-2-py via MQTT to Domoticz

Post by Vince88 » Thursday 22 June 2017 23:29

walberg wrote: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
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:)

basxcore
Posts: 2
Joined: Tuesday 31 October 2017 12:23
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Connecting Plugwise-2-py via MQTT to Domoticz

Post by basxcore » Wednesday 01 November 2017 16:48

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?

User avatar
heggink
Posts: 531
Joined: Tuesday 08 September 2015 21:44
Target OS: Raspberry Pi
Domoticz version: V4.9999
Location: NL
Contact:

Re: Connecting Plugwise-2-py via MQTT to Domoticz

Post by heggink » Sunday 26 November 2017 13:43

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...
Pi3, latest beta
RFXCOM, z-wave (AEOTEC, switches, temhum, pir, contacts),
Plugwise2py, P1 'smart'meter & solar panel
Alexa, Wifi Cams motion detection
ESP: relays, PIR & Temp/TempHum
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest

Corspruit
Posts: 4
Joined: Monday 12 March 2018 16:45
Target OS: NAS (Synology & others)
Domoticz version: 3.8153
Contact:

Re: Connecting Plugwise-2-py via MQTT to Domoticz

Post by Corspruit » Monday 12 March 2018 17:02

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?

Corspruit
Posts: 4
Joined: Monday 12 March 2018 16:45
Target OS: NAS (Synology & others)
Domoticz version: 3.8153
Contact:

Re: Connecting Plugwise-2-py via MQTT to Domoticz

Post by Corspruit » Monday 12 March 2018 22:13

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

uibeltje
Posts: 1
Joined: Monday 03 September 2018 23:15
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Connecting Plugwise-2-py via MQTT to Domoticz

Post by uibeltje » Monday 03 September 2018 23:35

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.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests