This is the forum archive of Homey. For more information about Homey, visit the Official Homey website.

The Homey Community has been moved to https://community.athom.com.

This forum is now read-only for archive purposes.
plugwise

[NEW UPDATE] Plugwise-2-py (v2.0.4)

gruijter_devgruijter_dev Member
edited April 2018 in Apps

Plugwise-2-py

Homey app to connect plugwise circles via Plugwise-2-py. This tool, developed by Seven Watt, can be used as an alternative for Plugwise Source. It runs on all devices that support python, such as your NAS or a raspberry pi.

Homey functionality

Device Card in browser and on mobile app:

  • Switch on or off
  • See real-time power usage (Watts, 8 seconds average)
  • See total power meter of circle (kWh)

Insights:

  • Switched on or off
  • Power usage (W, production is negative Watts)
  • Power meter (kWh)

Trigger Flow Cards:

  • Switched on or off
  • Power usage change
  • Power meter change

Condition Flow Cards:

  • Switched on or off

Action Flow Cards:

  • Switch on or off
  • Toggle on or off

Setting up the PW2PY server

A manual for setting it up on a rpi is provided on Plugwise-2-py.

To make it work properly with Homey you must do some base settings within PW2PY:

  • Enable 10-seconds monitoring: this should be enabled
  • Enable logging form Circle internal metering buffers: this should be enabled
  • Log interval: I advise to set this to 60 minutes
  • Schedules: can be used to switch a circle to powersaving mode automatically
  • Always on: enable this for circles that must not be switchable from Homey
  • Production: enable this for circles that measure production (e.g. solar panel)

Setting up Homey

After setting up PW2PY you can configure Homey to connect to it. Go to the app settings screen and enter the IP address of the PW2PY-MQTT server that you are using. Circles can then be added through the Devices tab of Homey. After pairing a circle you can set the polling interval per circle in the device settings (minimum 10 seconds).

Donate:

If you like the app you can show your appreciation by posting it in the forum. If you really like it you can buy me a beer, or coffee, or whatever you like :)

Paypal donate

===============================================================================

Version changelog

v2.0.4  2018.04.07 MQTT update v2.17.0. Log module added. Stability improvements.
v2.0.3  2018.01.14 Security fix (mqtt module)
v2.0.2  2017.11.25 Hotfix for Homey fw 1.5.6
v2.0.0  2017.11.15 Complete code rewrite to SDK V2
v1.0.0  2016.12.04 MQTT client updated to v2.1.3. Minor code changes
v0.0.1  2016.09.30 Initial release
Tagged:

Comments

  • Hi,

    It worked for a few hour, now I get this error message:

    SyntaxError: Unexpected end of input
    at Object.parse (native)
    at MqttClient.<anonymous> (/drivers/circle/driver.js:58:31)
    at emitThree (events.js:97:13)
    at MqttClient.emit (events.js:175:7)
    at MqttClient._handlePublish (/node_modules/mqtt/lib/client.js:806:12)
    at MqttClient._handlePacket (/node_modules/mqtt/lib/client.js:286:12)
    at process (/node_modules/mqtt/lib/client.js:242:12)
    at Writable.writable._write (/node_modules/mqtt/lib/client.js:252:5)
    at doWrite (/node_modules/mqtt/node_modules/readable-stream/lib/_stream_writable.js:319:64)
    at writeOrBuffer (/node_modules/mqtt/node_modules/readable-stream/lib/_stream_writable.js:308:5)

    Exit code: 1
  • well, it is clear: you shouldn't end the input unexpectedly LOL


    I saw your pull request for empty message from MQTT. If this solves it for you I will change that. I must say I don't get empty messages from MQTT. Maybe you should check your MQTT setup (or wifi connection maybe?)
  • well, it is clear: you shouldn't end the input unexpectedly LOL


    I saw your pull request for empty message from MQTT. If this solves it for you I will change that. I must say I don't get empty messages from MQTT. Maybe you should check your MQTT setup (or wifi connection maybe?)
    I know the problem, the house cleaning lady pull out the pugwise plugin out of the wallet. So it was not visible anymore :)
  • gruijter_devgruijter_dev Member
    edited October 2016
    v0.0.3 is pending approval in the app store. It removes 0-readings after app start and fixes 'Unexpected end of input' crash
  • v1.0.0 is pending approval in the appstore. Only some minor changes since the app has actually been very stable from the start :)
  • v1.0.1 is waiting approval in the appstore. Again only minor updates.
  • JPeJPe Member
    edited March 2017
    Where can I find the 'MAC' of the circles, I only have the Circle ID as a 5 digit hex number?
    (Haven't used the circles for a long time, but most of them are still plugged in)

    Never mind, I already found it in the Module-details.
  • @JPe There is an instruction here https://domotiga.nl/projects/domotiga/wiki/Plugwise

    For the circles I own I just had to put  '000D6F0000' or '000D6F0001' in front of the 6 hex digits that are printed on the label of the circle.
  • JPeJPe Member
    Thanks @gruijter_dev ,
    in the Module-details of the Plugwise-Source, I found :
    Magnetron      000D6F0000469F6C    Circle+
    Koffiezetter     000D6F00003D4F9E    Circle

  • version 1.1.0 is pending approval in the appstore. It has some bugfixes.
  • I have great news for the small, but hardcore, group that is using this app: I finished migrating the app to the new SDK, and fixed some bugs in the process.

    V2.0.0 is available in the appstore now.

    Have fun and let me know if you like the app!
  • JPeJPe Member
    edited November 2017
    not much fun over here!!

  • Oops. I have had some other reports coming in as well. Did you try in settings to clear and re-enter the mqtt settings?

    And are you on the latest version mqtt and pw2py on the server side?

    I did test the migration myself as far as I could, but there might be very old settings in your Homey. If all else fails you might have to delete and reinstall the app. :'( 

    I do have v2.0.0 running without any issues myself for a week now, so I know it is pretty stable...
  • @JPe any news from your side? I hope you got it back working again :#
  • JPeJPe Member
    edited November 2017
    I've not taken any action yet, but in the meantime, there has been an app crash:

    The log has been sent to the developer.
    The unique log ID is: d783c9f9-74ea-4974-9171-6b73999bde74
  • gruijter_devgruijter_dev Member
    edited April 2018
    New version 2.0.4 is coming up :)

    Several stability improvements were implemented and a log module was added for debugging and general event log.
  • I still get crash reports from one or more users stating that the app crashed due to too many mem warnings. Who is experiencing these app crashes, and under which conditions does it occur? 

    Please send me the logs (pw2py app settings).

    I hope that helps me in pinpointing the cause. (I dont have these crashes myself....)
  • JPeJPe Member
    Have done a complete new install on the Pi and so far so good, I think :
    2018-04-19 15:45:00 [log] [ManagerDrivers] [circle] switching off: 000D6F00003FD43F waterkoker 
    2018-04-19 15:44:23 [log] [ManagerDrivers] [circle] switching on: 000D6F00003FD43F waterkoker 
    2018-04-19 15:43:43 [log] [ManagerDrivers] [circle] switching off: 000D6F00003FD43F waterkoker 
    2018-04-19 15:42:55 [log] [ManagerDrivers] [circle] switching on: 000D6F00003D4F9E koelkast 
    2018-04-19 15:42:21 [log] [ManagerDrivers] [circle] switching off: 000D6F00003D4F9E koelkast 
    2018-04-19 15:38:51 [log] [ManagerDrivers] [circle] mqtt subscription ok: [{"topic":"plugwise2py/state/circle/#","qos":0},{"topic":"plugwise2py/state/energy/#","qos":0}] 
    2018-04-19 15:38:51 [log] [ManagerDrivers] [circle] mqtt connection ok: {"cmd":"connack","retain":false,"qos":0,"dup":false,"length":2,"topic":null,"payload":null,"sessionPresent":false,"returnCode":0} 
    2018-04-19 15:38:51 [log] [ManagerDrivers] [circle] [8] device init socket 000D6F00003D4F15 cv-ketel 
    2018-04-19 15:38:51 [log] [ManagerDrivers] [circle] [7] device init socket 000D6F00003FE434 vriezer 
    2018-04-19 15:38:51 [log] [ManagerDrivers] [circle] [6] device init socket 000D6F00003D4F3C wasmachine 
    2018-04-19 15:38:51 [log] [ManagerDrivers] [circle] [5] device init socket 000D6F00003FD43F waterkoker 
    2018-04-19 15:38:51 [log] [ManagerDrivers] [circle] [4] device init socket 000D6F00003FE459 keukenboiler 
    2018-04-19 15:38:51 [log] [ManagerDrivers] [circle] [3] device init socket 000D6F00003FD8FE vaatwasser 
    2018-04-19 15:38:51 [log] [ManagerDrivers] [circle] [2] device init socket 000D6F0000469F6C magnetron 
    2018-04-19 15:38:51 [log] [ManagerDrivers] [circle] [1] device init socket 000D6F00003FE455 senseo 
    2018-04-19 15:38:51 [log] [ManagerDrivers] [circle] [0] device init socket 000D6F00003D4F9E koelkast 
    2018-04-19 15:38:50 [log] [ManagerDrivers] [circle] Pw2pyDriver onInit 
    2018-04-19 15:38:50 [err] [settingsBackend] error reading logfile: ENOENT: no such file or directory, open '/userdata/log.json' 
    2018-04-19 15:38:50 [log] [settingsBackend] capturing stderr 
  • JPeJPe Member
    edited April 2018
    My Pi seems to be crashed again, nothing wrong with your app, the koelkast on/of at 18:50 did not switch the circle on or off, seems there is no communication between the Pi and the circles anymore.

    Can it be that there is to many data logged from the circles? I'm using a Pi-3

  • gruijter_devgruijter_dev Member
    edited April 2018
    @JPe I have 11 circles and no problem on the pi3 with logs or anything. Has been running stable more than a year, but I do regularly update the pi with sudo apt-get update / upgrade.
    My pi3 is connected through wifi, and basically doing only pw2py. Did you do a full fresh raspbian install? Unfortunately I dont know much about raspbian/linux/python etc. So I cannot really help you there. Maybe SevenW can help you? https://github.com/SevenW/Plugwise-2-py
  • And a question I have: does the Homey app crash when the communication is lost with the rpi?
  • JPeJPe Member
    Maybe crash is not the right word, some parts of the Pi are still running, the web-interface is still active, I can move the switches there, but the devices don't switch, seems that the communication between the Pi and the circles is stopped, the log files are not updated anymore after the time as shown in my previous post, but in these log-files, I don't see any errors, neither in the log-file of your app.
    Just did a reboot of the Pi and this is logged:
    2018-04-20 19:38:36 [log] [ManagerDrivers] [circle] switching off: 000D6F00003D4F9E koelkast 
    2018-04-20 19:38:18 [log] [ManagerDrivers] [circle] switching on: 000D6F00003D4F9E koelkast 
    2018-04-20 19:23:14 [log] [ManagerDrivers] [circle] mqtt subscription ok: [] 
    2018-04-20 19:23:14 [log] [ManagerDrivers] [circle] mqtt connection ok: {"cmd":"connack","retain":false,"qos":0,"dup":false,"length":2,"topic":null,"payload":null,"sessionPresent":false,"returnCode":0} 
    2018-04-20 19:23:14 [log] [ManagerDrivers] [circle] client is trying to reconnect 
    2018-04-20 19:23:04 [log] [ManagerDrivers] [circle] client closed (disconnected) 
    2018-04-20 19:22:34 [log] [ManagerDrivers] [circle] client is trying to reconnect 
    2018-04-20 19:22:24 [log] [ManagerDrivers] [circle] client closed (disconnected) 
    2018-04-20 19:22:24 [log] [ManagerDrivers] [circle] mqtt broker is offline 
    Looks good, but the circle is not switching ON/OFF, so your App is running fine and keeps running.
    When I run:  tail -f /home/pi/pwlog/pw-logger.log  on the Pi, the latest 10 lines of yesterday are shown from the file pw-logger.log 
Sign In or Register to comment.