Python Plugin: MillHeat

Python and python framework

Moderator: leecollings

appelflap
Posts: 19
Joined: Friday 14 March 2014 22:12
Target OS: Linux
Domoticz version: beta
Contact:

Python Plugin: MillHeat

Post by appelflap »

Hi,

I'm building a domoticz python plugin for a MillHeat WiFi heater: https://github.com/appelflap/domoticz-millheat
And it uses this code as a connector to the heater: https://github.com/Danielhiversen/pymill

It creates 3 devices per heater found through the API: Status (on/off, read only), Temperature and Thermostat (editable)

I've tested it on my own host, with ubuntu 18.04 running Domoticz stable.
And I installed it on a Pi for a friend and it doesn't go further than the 'Started, Entering, Initialized'..
I did set Debug to enabled on both hosts.. but the Pi doesnt give a lot of info.

Anyone got an idea how to investigate further?

[edit]And one other thing: domoticz seems to hang if I want to change/remove the hardware (on my own host).. any ideas?[/edit]

This is my version:

Code: Select all

Version: 4.10224
Build Hash: 1b7e859d
Compile Date: 2018-11-22 08:51:25
dzVents Version: 2.4.8
Python Version: 3.6.7 (default, Oct 22 2018, 11:32:17) [GCC 8.2.0]

Code: Select all

Nov 26 16:11:04 kermit domoticz[25924]: 2018-11-26 16:11:04.032  Status: (MillHeat) Started.
Nov 26 16:11:05 kermit domoticz[25924]: 2018-11-26 16:11:05.705  Status: (MillHeat) Entering work loop.
Nov 26 16:11:05 kermit domoticz[25924]: 2018-11-26 16:11:05.705  Status: (MillHeat) Initialized version 0.1.4, author 'appelflap'
Nov 26 16:11:05 kermit domoticz[25924]: 2018-11-26 16:11:05.715  (MillHeat) Device count: 6
Nov 26 16:11:05 kermit domoticz[25924]: 2018-11-26 16:11:05.716  (MillHeat) Device:           1 - ID: 850, Name: 'Bijkeuken Status', nValue: 0, sValue: '1'
Nov 26 16:11:05 kermit domoticz[25924]: 2018-11-26 16:11:05.716  (MillHeat) Device ID:       '850'
Nov 26 16:11:05 kermit domoticz[25924]: 2018-11-26 16:11:05.716  (MillHeat) Device Name:     'Bijkeuken Status'
Nov 26 16:11:05 kermit domoticz[25924]: 2018-11-26 16:11:05.716  (MillHeat) Device nValue:    0
Nov 26 16:11:05 kermit domoticz[25924]: 2018-11-26 16:11:05.716  (MillHeat) Device sValue:   '1'
Nov 26 16:11:05 kermit domoticz[25924]: 2018-11-26 16:11:05.716  (MillHeat) Device LastLevel: 0
Nov 26 16:11:05 kermit domoticz[25924]: 2018-11-26 16:11:05.716  (MillHeat) Device Image:     0
Nov 26 16:11:05 kermit domoticz[25924]: 2018-11-26 16:11:05.716  (MillHeat) Device:           2 - ID: 851, Name: 'Bijkeuken Temperature', nValue: 0, sValue: '15.0'
Nov 26 16:11:05 kermit domoticz[25924]: 2018-11-26 16:11:05.716  (MillHeat) Device ID:       '851'
Nov 26 16:11:05 kermit domoticz[25924]: 2018-11-26 16:11:05.716  (MillHeat) Device Name:     'Bijkeuken Temperature'
Nov 26 16:11:05 kermit domoticz[25924]: 2018-11-26 16:11:05.716  (MillHeat) Device nValue:    0
Nov 26 16:11:05 kermit domoticz[25924]: 2018-11-26 16:11:05.716  (MillHeat) Device sValue:   '15.0'
Nov 26 16:11:05 kermit domoticz[25924]: 2018-11-26 16:11:05.716  (MillHeat) Device LastLevel: 0
Nov 26 16:11:05 kermit domoticz[25924]: 2018-11-26 16:11:05.716  (MillHeat) Device Image:     0
Nov 26 16:11:05 kermit domoticz[25924]: 2018-11-26 16:11:05.716  (MillHeat) Device:           3 - ID: 852, Name: 'Bijkeuken Thermostat', nValue: 0, sValue: '15'
Nov 26 16:11:05 kermit domoticz[25924]: 2018-11-26 16:11:05.716  (MillHeat) Device ID:       '852'
Nov 26 16:11:05 kermit domoticz[25924]: 2018-11-26 16:11:05.716  (MillHeat) Device Name:     'Bijkeuken Thermostat'
Nov 26 16:11:05 kermit domoticz[25924]: 2018-11-26 16:11:05.716  (MillHeat) Device nValue:    0
Nov 26 16:11:05 kermit domoticz[25924]: 2018-11-26 16:11:05.716  (MillHeat) Device sValue:   '15'
Nov 26 16:11:05 kermit domoticz[25924]: 2018-11-26 16:11:05.716  (MillHeat) Device LastLevel: 0
Nov 26 16:11:05 kermit domoticz[25924]: 2018-11-26 16:11:05.716  (MillHeat) Device Image:     0
Nov 26 16:11:05 kermit domoticz[25924]: 2018-11-26 16:11:05.716  (MillHeat) Device:           4 - ID: 853, Name: 'Slaapkamer Status', nValue: 0, sValue: '0'
Nov 26 16:11:05 kermit domoticz[25924]: 2018-11-26 16:11:05.716  (MillHeat) Device ID:       '853'
Nov 26 16:11:05 kermit domoticz[25924]: 2018-11-26 16:11:05.716  (MillHeat) Device Name:     'Slaapkamer Status'
Nov 26 16:11:05 kermit domoticz[25924]: 2018-11-26 16:11:05.716  (MillHeat) Device nValue:    0
Nov 26 16:11:05 kermit domoticz[25924]: 2018-11-26 16:11:05.716  (MillHeat) Device sValue:   '0'
Nov 26 16:11:05 kermit domoticz[25924]: 2018-11-26 16:11:05.716  (MillHeat) Device LastLevel: 0
Nov 26 16:11:05 kermit domoticz[25924]: 2018-11-26 16:11:05.716  (MillHeat) Device Image:     0
Nov 26 16:11:05 kermit domoticz[25924]: 2018-11-26 16:11:05.716  (MillHeat) Device:           5 - ID: 854, Name: 'Slaapkamer Temperature', nValue: 0, sValue: '16.0'
Nov 26 16:11:05 kermit domoticz[25924]: 2018-11-26 16:11:05.716  (MillHeat) Device ID:       '854'
Nov 26 16:11:05 kermit domoticz[25924]: 2018-11-26 16:11:05.716  (MillHeat) Device Name:     'Slaapkamer Temperature'
Nov 26 16:11:05 kermit domoticz[25924]: 2018-11-26 16:11:05.716  (MillHeat) Device nValue:    0
Nov 26 16:11:05 kermit domoticz[25924]: 2018-11-26 16:11:05.716  (MillHeat) Device sValue:   '16.0'
Nov 26 16:11:05 kermit domoticz[25924]: 2018-11-26 16:11:05.716  (MillHeat) Device LastLevel: 0
Nov 26 16:11:05 kermit domoticz[25924]: 2018-11-26 16:11:05.717  (MillHeat) Device Image:     0
Nov 26 16:11:05 kermit domoticz[25924]: 2018-11-26 16:11:05.717  (MillHeat) Device:           6 - ID: 855, Name: 'Slaapkamer Thermostat', nValue: 0, sValue: '15'
Nov 26 16:11:05 kermit domoticz[25924]: 2018-11-26 16:11:05.717  (MillHeat) Device ID:       '855'
Nov 26 16:11:05 kermit domoticz[25924]: 2018-11-26 16:11:05.717  (MillHeat) Device Name:     'Slaapkamer Thermostat'
Nov 26 16:11:05 kermit domoticz[25924]: 2018-11-26 16:11:05.717  (MillHeat) Device nValue:    0
Nov 26 16:11:05 kermit domoticz[25924]: 2018-11-26 16:11:05.717  (MillHeat) Device sValue:   '15'
Nov 26 16:11:05 kermit domoticz[25924]: 2018-11-26 16:11:05.717  (MillHeat) Device LastLevel: 0
Nov 26 16:11:05 kermit domoticz[25924]: 2018-11-26 16:11:05.717  (MillHeat) Device Image:     0
Nov 26 16:11:05 kermit domoticz[25924]: 2018-11-26 16:11:05.717  (MillHeat) Pushing 'PollIntervalDirective' on to queue
Nov 26 16:11:05 kermit domoticz[25924]: 2018-11-26 16:11:05.966  (MillHeat) Indexing device 'DeviceID=DC431, Name=Bijkeuken Status, Unit=1, ID=850, Type=244' to the devlist
Nov 26 16:11:05 kermit domoticz[25924]: 2018-11-26 16:11:05.966  (MillHeat) Indexing device 'DeviceID=DC432, Name=Bijkeuken Temperature, Unit=2, ID=851, Type=80' to the devlist
Nov 26 16:11:05 kermit domoticz[25924]: 2018-11-26 16:11:05.967  (MillHeat) Indexing device 'DeviceID=DC433, Name=Bijkeuken Thermostat, Unit=3, ID=852, Type=242' to the devlist
Nov 26 16:11:05 kermit domoticz[25924]: 2018-11-26 16:11:05.967  (MillHeat) Indexing device 'DeviceID=F3791, Name=Slaapkamer Status, Unit=4, ID=853, Type=244' to the devlist
Nov 26 16:11:05 kermit domoticz[25924]: 2018-11-26 16:11:05.968  (MillHeat) Indexing device 'DeviceID=F3792, Name=Slaapkamer Temperature, Unit=5, ID=854, Type=80' to the devlist
Nov 26 16:11:05 kermit domoticz[25924]: 2018-11-26 16:11:05.968  (MillHeat) Indexing device 'DeviceID=F3793, Name=Slaapkamer Thermostat, Unit=6, ID=855, Type=242' to the devlist
Nov 26 16:11:06 kermit domoticz[25924]: 2018-11-26 16:11:06.077  (MillHeat) createDevices called
Nov 26 16:11:06 kermit domoticz[25924]: 2018-11-26 16:11:06.078  (MillHeat) Heater DC43 (name=Bijkeuken, device_id=56387, current_temp=15.0, set_temp=15, power_status=1, is_heating=1)
Nov 26 16:11:06 kermit domoticz[25924]: 2018-11-26 16:11:06.079  (MillHeat) Heater F379 (name=Slaapkamer, device_id=62329, current_temp=16.0, set_temp=15, power_status=1, is_heating=0)
Nov 26 16:11:06 kermit domoticz[25924]: 2018-11-26 16:11:06.079  (MillHeat) Indexing device 'DeviceID=DC431, Name=bijkeuken Status, Unit=1, ID=850, Type=244' to the devlist
Nov 26 16:11:06 kermit domoticz[25924]: 2018-11-26 16:11:06.079  (MillHeat) Indexing device 'DeviceID=DC432, Name=bijkeuken Temperature, Unit=2, ID=851, Type=80' to the devlist
Nov 26 16:11:06 kermit domoticz[25924]: 2018-11-26 16:11:06.080  (MillHeat) Indexing device 'DeviceID=DC433, Name=bijkeuken Thermostat, Unit=3, ID=852, Type=242' to the devlist
Nov 26 16:11:06 kermit domoticz[25924]: 2018-11-26 16:11:06.080  (MillHeat) Indexing device 'DeviceID=F3791, Name=Slaapkamer Status, Unit=4, ID=853, Type=244' to the devlist
Nov 26 16:11:06 kermit domoticz[25924]: 2018-11-26 16:11:06.081  (MillHeat) Indexing device 'DeviceID=F3792, Name=Slaapkamer Temperature, Unit=5, ID=854, Type=80' to the devlist
Nov 26 16:11:06 kermit domoticz[25924]: 2018-11-26 16:11:06.081  (MillHeat) Indexing device 'DeviceID=F3793, Name=Slaapkamer Thermostat, Unit=6, ID=855, Type=242' to the devlist
Nov 26 16:11:06 kermit domoticz[25924]: 2018-11-26 16:11:06.081  (MillHeat) Indexing device 'DeviceID=DC431, Name=Bijkeuken Status, Unit=1, ID=850, Type=244' to the devlist
Nov 26 16:11:06 kermit domoticz[25924]: 2018-11-26 16:11:06.082  (MillHeat) Indexing device 'DeviceID=DC432, Name=Bijkeuken Temperature, Unit=2, ID=851, Type=80' to the devlist
Nov 26 16:11:06 kermit domoticz[25924]: 2018-11-26 16:11:06.082  (MillHeat) Indexing device 'DeviceID=DC433, Name=Bijkeuken Thermostat, Unit=3, ID=852, Type=242' to the devlist
Nov 26 16:11:06 kermit domoticz[25924]: 2018-11-26 16:11:06.082  (MillHeat) Indexing device 'DeviceID=F3791, Name=Slaapkamer Status, Unit=4, ID=853, Type=244' to the devlist
Nov 26 16:11:06 kermit domoticz[25924]: 2018-11-26 16:11:06.083  (MillHeat) Indexing device 'DeviceID=F3792, Name=Slaapkamer Temperature, Unit=5, ID=854, Type=80' to the devlist
Nov 26 16:11:06 kermit domoticz[25924]: 2018-11-26 16:11:06.083  (MillHeat) Indexing device 'DeviceID=F3793, Name=Slaapkamer Thermostat, Unit=6, ID=855, Type=242' to the devlist
Nov 26 16:11:06 kermit domoticz[25924]: 2018-11-26 16:11:06.084  (MillHeat) Processing 'PollIntervalDirective' message
Nov 26 16:11:06 kermit domoticz[25924]: 2018-11-26 16:11:06.084  (MillHeat) Heartbeat interval set to: 60.
Nov 26 16:11:11 kermit domoticz[25924]: 2018-11-26 16:11:11.070  Status: (MillHeat) Stop directive received.
Nov 26 16:11:11 kermit domoticz[25924]: 2018-11-26 16:11:11.070  (MillHeat) Pushing 'onStopCallback' on to queue
Nov 26 16:11:11 kermit domoticz[25924]: 2018-11-26 16:11:11.070  Status: (MillHeat) Exiting work loop.
Nov 26 16:11:11 kermit domoticz[25924]: 2018-11-26 16:11:11.081  (MillHeat) Processing 'onStopCallback' message
Nov 26 16:11:11 kermit domoticz[25924]: 2018-11-26 16:11:11.081  (MillHeat) Calling message handler 'onStop'.
Nov 26 16:11:11 kermit domoticz[25924]: 2018-11-26 16:11:11.081  (MillHeat) Plugin is stopping
This is the Pi output:

Code: Select all

2018-11-27 12:20:40.002 Status: (MillHeat) Started.
2018-11-27 12:20:41.420 Status: (MillHeat) Entering work loop.
2018-11-27 12:20:41.420 Status: (MillHeat) Initialized version 0.1.4, author 'appelflap'
This is the running version:

Code: Select all

Version: 4.9700
Build Hash: a3a45906
Compile Date: 2018-06-23 16:24:51
dzVents Version: 2.4.6
Python Version: 3.5.3 (default, Sep 27 2018, 17:25:39) [GCC 6.3.0 20170516]
sema2022
Posts: 6
Joined: Friday 01 February 2019 11:15
Target OS: Windows
Domoticz version:
Contact:

Re: Python Plugin: MillHeat

Post by sema2022 »

Hi, thanks for sharing your Millheat plugin. I have installed it on my Domoticz (latest beta) with Python 3.5.4 (32 bit) on my Windows 10 based home server. After correcting paths, the plugin starts without errors but there are no devices detected. The test Mill Wifi Socket device is visible in the Mill iOS app and works fine. In the Domoticz log I can see the calling of “onHeartbeat” and “createDevices”. I have 2 other Python based plugins working fine.

There are one occasionally error in the log, “Millheat hardware (8) thread seems to have ended unexpectedly”, but this seems to be a common plugin related problem.

Do you have any tip on this?

By the way, I have the same problem as you with hang when I try to stop/alter the plugin in the hardware page of Domoticz.
appelflap
Posts: 19
Joined: Friday 14 March 2014 22:12
Target OS: Linux
Domoticz version: beta
Contact:

Re: Python Plugin: MillHeat

Post by appelflap »

The plugin does a basic guess where the python packages are. This is needed for the pymill and prerequisites.
At the moment this is purely linux paths.. you can change it in the plugin.py file.

Code: Select all

# Add pip3 locations
sys.path.append('/home/'+getpass.getuser()+'/.local/lib/python3.5/site-packages')
sys.path.append('/home/'+getpass.getuser()+'/.local/lib/python3.6/site-packages')
sys.path.append('/usr/local/lib/python3.5/dist-packages')
sys.path.append('/usr/local/lib/python3.6/dist-packages')
sys.path.append('/usr/lib/python3/dist-packages')
For example (not tested):

Code: Select all

sys.path.append('C:\PythonXY\Lib\site-packages')
sys.path.append('C:\PythonXY\Lib\dist-packages')
sema2022
Posts: 6
Joined: Friday 01 February 2019 11:15
Target OS: Windows
Domoticz version:
Contact:

Re: Python Plugin: MillHeat

Post by sema2022 »

Thanks, but I think the path part should be updated (since the module starts). I find the Mill module under site-packages but there is no “dist-packages” directory in my c: disk. My extra paths are:

Code: Select all

# Add pip3 locations
sys.path.append('C:\Program Files (x86)\Python35-32\DLLs')
sys.path.append('C:\Program Files (x86)\Python35-32\lib')
sys.path.append('C:\Program Files (x86)\Python35-32')
sys.path.append('C:\Program Files (x86)\Python35-32\lib\site-packages')
# Not used: sys.path.append('C:\Program Files (x86)\Python35-32\lib\dist-packages')
I have reinstalled Python With 35.3 (as you have) and also the Millheat module and plugin, still the same problem. It seams to start as expected but no devices appear:

Code: Select all

2019-02-01 13:49:23.058 Status: (Millheat) Started.
2019-02-01 13:49:24.247 (Millheat) onStart called 
2019-02-01 13:49:24.004 Status: (Millheat) Entering work loop. 
2019-02-01 13:49:24.004 Status: (Millheat) Initialized version 0.1.4, author 'appelflap' 
2019-02-01 13:49:34.037 (Millheat) onHeartbeat called 
2019-02-01 13:49:35.287 (Millheat) createDevices called
appelflap
Posts: 19
Joined: Friday 14 March 2014 22:12
Target OS: Linux
Domoticz version: beta
Contact:

Re: Python Plugin: MillHeat

Post by appelflap »

I'm sorry, but I can't help you at the moment. On holiday for a few weeks. Please keep me updated through the forum if you find anything. I will take a look at it when I'm back.
zak45
Posts: 953
Joined: Sunday 22 January 2017 11:37
Target OS: Windows
Domoticz version: V2024.4
Contact:

Re: Python Plugin: MillHeat

Post by zak45 »

appelflap wrote: Friday 01 February 2019 16:12 I'm sorry, but I can't help you at the moment. On holiday for a few weeks. Please keep me updated through the forum if you find anything. I will take a look at it when I'm back.
this can help for path trouble:

Code: Select all

# Required for import: path is OS dependent
# Python framework in Domoticz do not include OS dependent path
#
import site
import sys
import os
path=''
path=site.getsitepackages()
for i in path:    
    sys.path.append(i)
#

sema2022
Posts: 6
Joined: Friday 01 February 2019 11:15
Target OS: Windows
Domoticz version:
Contact:

Re: Python Plugin: MillHeat

Post by sema2022 »

Thanks, the path coding worked, and I could now delete the manually inserted path.append lines. However, I did not solve the initial problem with Millheat plugin not detecting any devices.
User avatar
Dnpwwo
Posts: 820
Joined: Sunday 23 March 2014 9:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Melbourne, Australia
Contact:

Re: Python Plugin: MillHeat

Post by Dnpwwo »

@appelflap,
And one other thing: domoticz seems to hang if I want to change/remove the hardware (on my own host).. any ideas?
The Python Plugin Framework can't hang Domoticz, what it can do is crash it which can appear the same if you are looking at the web UI and is probably what is happening here.

The 'mill' code there is a lot of asynchronous reading and writing which should be okay while the plugin is running but can cause an issue on shutdown (which happens when you 'Update' the plugin in the Hardware tab). Python has this delightful feature where there is not real mechanism to abort/kill threads (that I can find :o ) but it will abort the host application if there are any threads running during interpreter shutdown :shock:

What does this mean? It means that plugin developers using threads (directly or otherwise) need to make sure they are shutdown before the plugin exits. (have a look at my google plugin for an example https://github.com/dnpwwo/Domoticz-Google-Plugin)

To see if this is the case you can add something like this to your code:

Code: Select all

import threading
...
    def onStop(self):
        Domoticz.Log("Threads still active: "+str(threading.active_count())+", should be 1.")
        while (threading.active_count() > 1):
            for thread in threading.enumerate():
                if (thread.name != threading.current_thread().name):
                    Domoticz.Log("'"+thread.name+"' is still running, waiting otherwise Domoticz will crash on plugin exit.")
            time.sleep(1.0)
(although you might not want to make it wait forever)

If this is your problem you will need to work out how to stop the other running threads.

Good luck !
The reasonable man adapts himself to the world; the unreasonable one persists to adapt the world to himself. Therefore all progress depends on the unreasonable man. George Bernard Shaw
appelflap
Posts: 19
Joined: Friday 14 March 2014 22:12
Target OS: Linux
Domoticz version: beta
Contact:

Re: Python Plugin: MillHeat

Post by appelflap »

Thanks Dnpwwo! I searched the forum for multiple days back then, but couldn't find the reason behind it.
I have changed the code on my github, but I don't have a mill heater to test with :?
sema2022
Posts: 6
Joined: Friday 01 February 2019 11:15
Target OS: Windows
Domoticz version:
Contact:

Re: Python Plugin: MillHeat

Post by sema2022 »

Hi, today I looked further into my Millheat plugin problem. It seems like the devices don’t show up when they are connected to rooms in my account setup (Mill App on iPhone). After disconnecting (converting to independed devices) they appeared in Domoticz.

So far, so god, but they are only visible in a few seconds in Domoticz. In the log I see the new devices being classified as “obsolete” and deleted by the Millheater plugin as shown below:

Code: Select all

2019-02-08 16:00:17.538 (Mill) Pushing 'PollIntervalDirective' on to queue 
2019-02-08 16:00:17.538 Status: (Mill) Entering work loop. 
2019-02-08 16:00:17.538 Status: (Mill) Initialized version 0.1.4, author 'appelflap' 
2019-02-08 16:00:19.041 (Mill) createDevices called 
2019-02-08 16:00:19.041 (Mill) Heater 150B4 (name=Stue, device_id=86196, current_temp=23.0, set_temp=30, power_status=1, is_heating=1) 
2019-02-08 16:00:19.041 (Mill) Creating device 'Stue Status'. 
2019-02-08 16:00:19.072 (Mill) Creating device 'Stue Temperature'. 
2019-02-08 16:00:19.088 (Mill) Creating device 'Stue Thermostat'. 
2019-02-08 16:00:19.103 (Mill) Indexing device 'DeviceID=150B41, Name=Mill - Stue Status, Unit=1, ID=1, Type=244' to the devlist 
2019-02-08 16:00:19.103 (Mill) Indexing device 'DeviceID=150B42, Name=Mill - Stue Temperature, Unit=2, ID=2, Type=80' to the devlist 
2019-02-08 16:00:19.103 (Mill) Indexing device 'DeviceID=150B43, Name=Mill - Stue Thermostat, Unit=3, ID=3, Type=242' to the devlist 
2019-02-08 16:00:19.103 (Mill - Stue Status) Updating device from 0:'' to have values 0:'1'. 
2019-02-08 16:00:19.125 (Mill) Update Mill - Stue Status: 0 - '1' 
2019-02-08 16:00:19.125 (Mill - Stue Temperature) Updating device from 0:'' to have values 0:'23.0'. 
2019-02-08 16:00:19.141 (Mill) Update Mill - Stue Temperature: 0 - '23.0' 
2019-02-08 16:00:19.141 (Mill - Stue Thermostat) Updating device from 0:'' to have values 0:'30'. 
2019-02-08 16:00:19.157 (Mill) Update Mill - Stue Thermostat: 0 - '30' 
2019-02-08 16:00:19.157 (Mill) Heater 150B5 (name=Kjellerstue, device_id=86197, current_temp=26.0, set_temp=29, power_status=0, is_heating=0) 
2019-02-08 16:00:19.157 (Mill) Creating device 'Kjellerstue Status'. 
2019-02-08 16:00:19.172 (Mill) Creating device 'Kjellerstue Temperature'. 
2019-02-08 16:00:19.188 (Mill) Creating device 'Kjellerstue Thermostat'. 
2019-02-08 16:00:19.204 (Mill) Indexing device 'DeviceID=150B41, Name=Mill - Stue Status, Unit=1, ID=1, Type=244' to the devlist 
2019-02-08 16:00:19.204 (Mill) Indexing device 'DeviceID=150B42, Name=Mill - Stue Temperature, Unit=2, ID=2, Type=80' to the devlist 
2019-02-08 16:00:19.204 (Mill) Indexing device 'DeviceID=150B43, Name=Mill - Stue Thermostat, Unit=3, ID=3, Type=242' to the devlist 
2019-02-08 16:00:19.204 (Mill) Indexing device 'DeviceID=150B51, Name=Mill - Kjellerstue Status, Unit=4, ID=4, Type=244' to the devlist 
2019-02-08 16:00:19.204 (Mill) Indexing device 'DeviceID=150B52, Name=Mill - Kjellerstue Temperature, Unit=5, ID=5, Type=80' to the devlist 
2019-02-08 16:00:19.204 (Mill) Indexing device 'DeviceID=150B53, Name=Mill - Kjellerstue Thermostat, Unit=6, ID=6, Type=242' to the devlist 
2019-02-08 16:00:19.204 (Mill - Kjellerstue Status) Updating device from 0:'' to have values 0:'0'. 
2019-02-08 16:00:19.226 (Mill) Update Mill - Kjellerstue Status: 0 - '0' 
2019-02-08 16:00:19.226 (Mill - Kjellerstue Temperature) Updating device from 0:'' to have values 0:'26.0'. 
2019-02-08 16:00:19.241 (Mill) Update Mill - Kjellerstue Temperature: 0 - '26.0' 
2019-02-08 16:00:19.241 (Mill - Kjellerstue Thermostat) Updating device from 0:'' to have values 0:'29'. 
2019-02-08 16:00:19.273 (Mill) Update Mill - Kjellerstue Thermostat: 0 - '29' 
2019-02-08 16:00:19.273 (Mill) Indexing device 'DeviceID=150B41, Name=Mill - Stue Status, Unit=1, ID=1, Type=244' to the devlist 
2019-02-08 16:00:19.273 (Mill) Indexing device 'DeviceID=150B42, Name=Mill - Stue Temperature, Unit=2, ID=2, Type=80' to the devlist 
2019-02-08 16:00:19.273 (Mill) Indexing device 'DeviceID=150B43, Name=Mill - Stue Thermostat, Unit=3, ID=3, Type=242' to the devlist 
2019-02-08 16:00:19.273 (Mill) Indexing device 'DeviceID=150B51, Name=Mill - Kjellerstue Status, Unit=4, ID=4, Type=244' to the devlist 
2019-02-08 16:00:19.273 (Mill) Indexing device 'DeviceID=150B52, Name=Mill - Kjellerstue Temperature, Unit=5, ID=5, Type=80' to the devlist 
2019-02-08 16:00:19.273 (Mill) Indexing device 'DeviceID=150B53, Name=Mill - Kjellerstue Thermostat, Unit=6, ID=6, Type=242' to the devlist 
2019-02-08 16:00:19.273 (Mill) Removing Mill Heater 1 Mill - Stue Status (obsolete). 
2019-02-08 16:00:19.273 (Mill) Deleting device 'Mill - Stue Status'. 
2019-02-08 16:00:19.273 (Mill) Removing Mill Heater 2 Mill - Stue Temperature (obsolete). 
2019-02-08 16:00:19.273 (Mill) Deleting device 'Mill - Stue Temperature'. 
2019-02-08 16:00:19.288 (Mill) Removing Mill Heater 3 Mill - Stue Thermostat (obsolete). 
2019-02-08 16:00:19.288 (Mill) Deleting device 'Mill - Stue Thermostat'. 
2019-02-08 16:00:19.304 (Mill) Removing Mill Heater 4 Mill - Kjellerstue Status (obsolete). 
2019-02-08 16:00:19.304 (Mill) Deleting device 'Mill - Kjellerstue Status'. 
2019-02-08 16:00:19.326 (Mill) Removing Mill Heater 5 Mill - Kjellerstue Temperature (obsolete). 
2019-02-08 16:00:19.326 (Mill) Deleting device 'Mill - Kjellerstue Temperature'. 
2019-02-08 16:00:19.326 (Mill) Removing Mill Heater 6 Mill - Kjellerstue Thermostat (obsolete). 
2019-02-08 16:00:19.326 (Mill) Deleting device 'Mill - Kjellerstue Thermostat'. 
2019-02-08 16:00:19.342 (Mill) Processing 'PollIntervalDirective' message 
2019-02-08 16:00:19.342 (Mill) Heartbeat interval set to: 60. 
2019-02-08 16:00:28.968 (Mill) Pushing 'onHeartbeatCallback' on to queue 
2019-02-08 16:00:29.015 (Mill) Processing 'onHeartbeatCallback' message 
(And all is repeted every 60 sec.)
It seems like the “createDevices” routine in the Millheater plugin detect new devices, but don’t update the “myHeaters” string and then triggers deletion.

However, the devices stay in Domoticz if I disable the “find and remove obsolete devices” code in the plugin. The values are then updated and it seems like the Api iteration towards the Millheat Cloud are working, but nothing happens when I push the On/Off buttons, something seems to be messed up .

I have tried the setup on three different PC’s with Windows 10 and Python 3.5.3 with same result. I am not a programmer or Python expert and are now stuck.

Are there any skilled persons able to give me a hint on the problem?
sema2022
Posts: 6
Joined: Friday 01 February 2019 11:15
Target OS: Windows
Domoticz version:
Contact:

Re: Python Plugin: MillHeat

Post by sema2022 »

I found out about the problem with the Millheat plugin not working in my Windows 10 based system with latest beta Domoticz and Python 3.7.2. I have 4 Milheat WiFi Socket Gen.2 devices connected to 4 ovens. The Mill devices show up but was immediately deleted again as explained in my prior post. Here is what I did to make it work in my Windows based setup:

The content of “myHeaters” is handled right after correcting the "DeviceID[0:4]” parameters in Millheat plugin lines 130, 134, 138 and 204 to “DeviceID[0:5]”. After this, the devices remained, and the heater's on/off actions works.

To have the heaters work correctly I also needed to set the “fan_status=0” in line 131 and 135 parameter to “fan_status=1”. Further I changed the heater values in line 130 from “0, str(myHeaters[heaterId].is_heating))” to “myHeaters[heaterId].power_status, str(myHeaters[heaterId].is_heating))”. This might be due to the gen2 Wifi Socket having an extra function where you can choose to utilize the internal thermostat function combined with the power On/Off switch or not, and this is controlled by the “fan_status=1” parameters, or... ?

The crash during update/closing of the Millheat plugin in the Hardware setups seems to be a less problem with Python 3.7.2, even without the lines 95 to 100 in the “onStop” routine. The threads is being closed without a crash.

Also remember to “Allow for new hardware” in the setup when enrolling new Mill devices. If not, you will get a “KeyError” in the log.

I have created a virtual hardware device setup as a selector switch with three heater modus buttons (Comfort 23c, Saving 19c and Frost 5c) running .bat scripts with Json commands controlling the 4 Millheaters. This is a very simple setup, working well (as long as device IDx are not changed).
jobvr
Posts: 4
Joined: Monday 23 December 2019 19:52
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: MillHeat

Post by jobvr »

@sema2022,
The changes you suggested did the trick. I also have a generation-2 heater. The only thing I can't get to work (or i can't find the place to do it) is to alter the setpoint for the heater)
under temperature it shows the current temp in the room. Under switches i can turn the device on/off, but i can't find a place to alter the setpoint.
Do you have any suggestions ?
SuperZite
Posts: 12
Joined: Tuesday 14 June 2016 21:08
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: MillHeat

Post by SuperZite »

Is it still some problem whit this plugin ?

I have done the changes that was explaind in this link and got the devices that was not connected to a room added but devices that was grouped to a room is not showing up.
jobvr
Posts: 4
Joined: Monday 23 December 2019 19:52
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: MillHeat

Post by jobvr »

Not that I am aware of. the plugin is running fine in Domoticz. only sometimes there is a error in de LOG, bur everything is working fine
jobvr
Posts: 4
Joined: Monday 23 December 2019 19:52
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: MillHeat

Post by jobvr »

Now i did run into trouble.

I had it working, but I did a complete new install on my Raspberry from scratch. Now i don't get de Device to show up.
I have a GEN2 so did the changes with the flame status ETC. However sommeting seems to be in the wrong place. I get this error in the LOG when Domoticz starts.
2020-02-22 07:56:31.999 Error: (MillHeat) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/millheat/:/usr/lib/python37.zip:/usr/lib/python3.7:/usr/lib/python3.7/lib-dynload:/usr/local/lib/python3.7/dist-packages:/usr/lib/python3/dist-packages:/usr/lib/python3.7/dist-packages'.
2020-02-22 07:56:31.999 Error: (Bathroom-Mill_heat) Module Import failed, exception: 'ModuleNotFoundError'
2020-02-22 07:56:31.999 Error: (Bathroom-Mill_heat) Module Import failed: ' Name: mill'
2020-02-22 07:56:31.999 Error: (Bathroom-Mill_heat) Error Line details not available.
any ideas?
copywizard
Posts: 5
Joined: Tuesday 25 February 2020 7:00
Target OS: -
Domoticz version:
Contact:

Re: Python Plugin: MillHeat

Post by copywizard »

jobvr wrote: Saturday 22 February 2020 8:08 Now i did run into trouble.

I had it working, but I did a complete new install on my Raspberry from scratch. Now i don't get de Device to show up.
I have a GEN2 so did the changes with the flame status ETC. However sommeting seems to be in the wrong place. I get this error in the LOG when Domoticz starts.
2020-02-22 07:56:31.999 Error: (MillHeat) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/millheat/:/usr/lib/python37.zip:/usr/lib/python3.7:/usr/lib/python3.7/lib-dynload:/usr/local/lib/python3.7/dist-packages:/usr/lib/python3/dist-packages:/usr/lib/python3.7/dist-packages'.
2020-02-22 07:56:31.999 Error: (Bathroom-Mill_heat) Module Import failed, exception: 'ModuleNotFoundError'
2020-02-22 07:56:31.999 Error: (Bathroom-Mill_heat) Module Import failed: ' Name: mill'
2020-02-22 07:56:31.999 Error: (Bathroom-Mill_heat) Error Line details not available.
any ideas?
i have the exact same problem i think it has something to do with the paths being incorrect but i have no idea how to fix it so if you find a solution i would love to know it to!
copywizard
Posts: 5
Joined: Tuesday 25 February 2020 7:00
Target OS: -
Domoticz version:
Contact:

Re: Python Plugin: MillHeat

Post by copywizard »

still no one that can help us whit this problem? any help in the right direction would help?
appelflap
Posts: 19
Joined: Friday 14 March 2014 22:12
Target OS: Linux
Domoticz version: beta
Contact:

Re: Python Plugin: MillHeat

Post by appelflap »

In the current version the python code tries to find the packages it needs through the sys.path.
But maybe your packages are put somewhere else. You can try including (one of) them by doing it manually.
You will have to find out which version of python you are using currently and adjust the path accordingly.

Code: Select all

sys.path.append('/home/'+getpass.getuser()+'/.local/lib/python3.5/site-packages')	
sys.path.append('/home/'+getpass.getuser()+'/.local/lib/python3.6/site-packages')	
sys.path.append('/usr/local/lib/python3.5/dist-packages')
sys.path.append('/usr/local/lib/python3.6/dist-packages')
sys.path.append('/usr/lib/python3/dist-packages')
I do not own a MillHeat device myself. So I'm not able to actively support/develop the code anymore.
copywizard
Posts: 5
Joined: Tuesday 25 February 2020 7:00
Target OS: -
Domoticz version:
Contact:

Re: Python Plugin: MillHeat

Post by copywizard »

appelflap wrote: Wednesday 18 March 2020 9:25 In the current version the python code tries to find the packages it needs through the sys.path.
But maybe your packages are put somewhere else. You can try including (one of) them by doing it manually.
You will have to find out which version of python you are using currently and adjust the path accordingly.

Code: Select all

sys.path.append('/home/'+getpass.getuser()+'/.local/lib/python3.5/site-packages')	
sys.path.append('/home/'+getpass.getuser()+'/.local/lib/python3.6/site-packages')	
sys.path.append('/usr/local/lib/python3.5/dist-packages')
sys.path.append('/usr/local/lib/python3.6/dist-packages')
sys.path.append('/usr/lib/python3/dist-packages')
I do not own a MillHeat device myself. So I'm not able to actively support/develop the code anymore.
thanks alot for your reply ! my domoticz uses python 3.7.2 i have tried to add this line to the plugin.py script but it keeps giving me the same error even if i try to put in the paths for python 2.7 thats also installed.

i do not ask you do develop the plugin more but it would be cool if you could help me and maybe others out by explaining how i add the right pyhton version and where i do this?

the error suggests its looking for a very long path that does not exists on my pi/domoticz install including that it is looking for a python*.zip file i have no idea why?

my python is installed in the location /usr/local/lib/python3.7 same goes for 2.7 and 2.7 has both the directories dist and site packages and 3.7 only has dist-packages in it all are empty.

thanks for any help in advanced.
appelflap
Posts: 19
Joined: Friday 14 March 2014 22:12
Target OS: Linux
Domoticz version: beta
Contact:

Re: Python Plugin: MillHeat

Post by appelflap »

Did you install the pymill component using this command?
pip3 install millheater
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest