Comments (19)
As I was facing the same issue as several, I dig a bit in the plugin, and rewrote a bit the login function, to use json instead url-encoded logic. I also adapted the device discovery process to be able to discover my devices.
Here is the modified file:
plugin.py.zip
from domoticz-python-melcloud.
Here it is
from domoticz-python-melcloud.
same problem here.. :(
from domoticz-python-melcloud.
It looks like MELcloud does not accept urlencoded forms. I have created a quick-and-dirty (very dirty) fix by replacing the urlencoded form with a json one. I don't have a time for patch or pull request now, so you have to edit plugin.py manually
I also don't have time to check the whole code now so I don't want to patch the original melcloud_send_data function as it is used elsewhere. So copy the function melcloud_send_data as melcloud_send_data_json and change the content-type from application/x-www-form-urlencoded; to application/json;
def melcloud_send_data_json(self, url, values, state):
self.melcloud_state = state
if self.melcloud_key is not None:
headers = {'Content-Type': 'application/json;',
'Host': self.melcloud_baseurl,
'User-Agent': 'Domoticz/1.0',
'X-MitsContextKey': self.melcloud_key}
if state == "SET":
self.melcloud_conn.Send({'Verb': 'POST', 'URL': url, 'Headers': headers, 'Data': values})
else:
self.melcloud_conn.Send({'Verb': 'GET', 'URL': url, 'Headers': headers, 'Data': values})
else:
headers = {'Content-Type': 'application/x-www-form-urlencoded;',
'Host': self.melcloud_baseurl,
'User-Agent': 'Domoticz/1.0'}
self.melcloud_conn.Send({'Verb': 'POST', 'URL': url, 'Headers': headers, 'Data': values})
return True
Then change melcloud_set as follows (you may keep the old code as melcloud_set_urlencoded just in case):
def melcloud_set(self, unit, flag):
post_fields = "'Power':{0},'DeviceID':{1},'OperationMode':{2},'SetTemperature':{3},'SetFanSpeed':{4},'VaneHorizontal':{5},'VaneVertical':{6},'EffectiveFlags':{7},'HasPendingCommand':true"
post_fields = post_fields.format(str(unit['power']).lower(), unit['id'], unit['op_mode'], unit['set_temp'], unit['set_fan'], unit['vaneH'], unit['vaneV'], flag)
Domoticz.Debug("SET COMMAND SEND {0}".format(post_fields))
self.melcloud_send_data_json(self.melcloud_urls["set_unit"], "{"+post_fields+"}", "SET")
EDIT: it seems MELcloud is validating the json syntax so I had to make some changes (lowcase for power, single quotes)
from domoticz-python-melcloud.
Hello,
I have tried but it does unfortunately not operate properly (maybe due to a bad paste from my side), see log below.
By the way, it looks like there is some knowledgeable people there, would it be possible improving the plugin using a setpoint type device for temp setpoint instead of a multi level switch?
Patrice
2022-02-01 16:02:27.805 Status: MELCloud: Initialized version 0.7.8, author 'gysmo'
2022-02-01 16:02:27.435 Error: (FindModule) Domoticz/DomoticzEx modules not found in interpreter.
2022-02-01 16:02:28.018 Error: MELCloud: 'onConnect' failed 'AttributeError':''BasePlugin' object has no attribute 'melcloud_send_data''.
2022-02-01 16:02:28.018 Error: MELCloud: Exception traceback:
2022-02-01 16:02:28.018 Error: MELCloud: ----> Line 538 in '/home/pi/domoticz/plugins/domoticz-python-melcloud/plugin.py', function onConnect
2022-02-01 16:02:28.018 Error: MELCloud: ----> Line 149 in '/home/pi/domoticz/plugins/domoticz-python-melcloud/plugin.py', function onConnect
2022-02-01 16:02:28.018 Error: MELCloud: ----> Line 437 in '/home/pi/domoticz/plugins/domoticz-python-melcloud/plugin.py', function melcloud_login
2022-02-01 16:02:34.155 Status: User: Xxx (IP: xxx.xxx.xxx.xxx) initiated a switch command (621/MELCloud - Couloir - Mode/Set Level)
2022-02-01 16:02:34.198 Error: MELCloud: 'onCommand' failed 'TypeError':''bool' object does not support item assignment'.
2022-02-01 16:02:34.198 Error: MELCloud: Exception traceback:
2022-02-01 16:02:34.198 Error: MELCloud: ----> Line 550 in '/home/pi/domoticz/plugins/domoticz-python-melcloud/plugin.py', function onCommand
2022-02-01 16:02:34.198 Error: MELCloud: ----> Line 299 in '/home/pi/domoticz/plugins/domoticz-python-melcloud/plugin.py', function onCommand
from domoticz-python-melcloud.
Did you left the original melcloud_send_data function intact? You are supposed to copy it and then change the name and content type, leaving the original function as it is, because it is used elsewhere (during login process, for example).
You can probably make a script to synchronize the selector values with a setpoint.
from domoticz-python-melcloud.
It looks like I did not catch something. Could you please share your plugin.py file? Thanks!
from domoticz-python-melcloud.
Here it is
Thanks !
from domoticz-python-melcloud.
When using the latest plugin version, I get others errors, like described in #24 and #22
I'm using latest stable domoticz version, v2021.1 build 14119).
Using plugin version 0.7.6 the problem is not present, the device I have is found but I continue getting the 500 error.
Using latest 0.7.7 with your proposed change on plugin.py or uploaded one, problem goes away but no device found in the building and error mentionned appires.
If anyone can explain it...
from domoticz-python-melcloud.
It's hard to say. Unfortunately the debug setting does not work so you have to uncomment Domoticz.Debugging(62) or Domoticz.Debugging(-1) in my file and restart.
Try not to use areas, only floors. Do not use any non-ascii characters in names.
from domoticz-python-melcloud.
Many thanks, updating to floor instead of area and applying the new plugin.py worked :)
from domoticz-python-melcloud.
Thanks for this fix. It made me able to controle the airco's with Domoticz again. I do get the errors below. Any idea how to solve these?
2022-02-05 21:00:58.239 Error: Airco: (Airco) 'onMessage' failed 'UnboundLocalError':'local variable 'setPicID' referenced before assignment'.
2022-02-05 21:00:58.239 Error: Airco: (Airco) ----> Line 570 in '/home/pi/domoticz/plugins/Melcloud/plugin.py', function onMessage
2022-02-05 21:00:58.239 Error: Airco: (Airco) ----> Line 255 in '/home/pi/domoticz/plugins/Melcloud/plugin.py', function onMessage
2022-02-05 21:00:58.239 Error: Airco: (Airco) ----> Line 520 in '/home/pi/domoticz/plugins/Melcloud/plugin.py', function domoticz_sync_switchs
from domoticz-python-melcloud.
The given file works for me (only tested on a standard use case start/stop) ! Thx a lot :)
Note the given file also includes the changes relative to #25, and I'm waiting to see if it crashed after some time or not (ongoing test, I'll let you know).
from domoticz-python-melcloud.
As I was facing the same issue as several, I dig a bit in the plugin, and rewrote a bit the login function, to use json instead url-encoded logic. I also adapted the device discovery process to be able to discover my devices.
Here is the modified file: plugin.py.zip
I'll try this!
There are some things that looks strange to me regarding Melcloud.
- it looks to me that the official Melcloud webapp is not reliable for holiday mode, did you experience this? The issue is that holiday mode does not deactivate scheduled on/off events).
- since a couple of weeks, it looks to me that there is a temperature offset between setpoint and the real temperature of the room (Melcloud temp setpoint and readback are ok but temp measured in the room thanks to an independent thermometer is much higher).
- finally, temperature setpoint is really not convenient using a multi level switch, but I'm not skilled with Python to be able modifying the switch with a setpoint device. Can somebody help with this?
Thanks!
from domoticz-python-melcloud.
Hello,
Thanks to @mitkodotcom for the quick fix, it worked well for me.
I was previously on version 0.7.6
Hope the plugin will be updated properly :)
from domoticz-python-melcloud.
Hi,
I am facing the same issue :
2022-08-18 23:31:25.180 MelCloud clim: Set to Vent the unit Haut
2022-08-18 23:31:25.322 MelCloud clim: MELCloud receive unknonw message with error code 500
2022-08-18 23:31:25.373 MelCloud clim: MELCloud receive unknonw message with error code 500
2022-08-18 23:31:27.755 Status: User: Admin (IP: 192.168.1.4) initiated a switch command (1835/MelCloud clim - Haut - Mode/Set Level)
2022-08-18 23:31:27.787 MelCloud clim: onCommand called for Unit 8: Parameter 'Off', Level: 0
2022-08-18 23:31:27.787 MelCloud clim: Switch Off the unit Hautwith ID offset 7
2022-08-18 23:31:27.929 MelCloud clim: MELCloud receive unknonw message with error code 500
I tried several plugin.py, but still the same :(
from domoticz-python-melcloud.
Thanks for this fix. It made me able to controle the airco's with Domoticz again. I do get the errors below. Any idea how to solve these?
2022-02-05 21:00:58.239 Error: Airco: (Airco) 'onMessage' failed 'UnboundLocalError':'local variable 'setPicID' referenced before assignment'. 2022-02-05 21:00:58.239 Error: Airco: (Airco) ----> Line 570 in '/home/pi/domoticz/plugins/Melcloud/plugin.py', function onMessage 2022-02-05 21:00:58.239 Error: Airco: (Airco) ----> Line 255 in '/home/pi/domoticz/plugins/Melcloud/plugin.py', function onMessage 2022-02-05 21:00:58.239 Error: Airco: (Airco) ----> Line 520 in '/home/pi/domoticz/plugins/Melcloud/plugin.py', function domoticz_sync_switchs
did you fix it? mine starting doing the same thing after 2 days of running...
from domoticz-python-melcloud.
Gracias Patricen1, gracias a tu archivo todo funciona a la perfección.
from domoticz-python-melcloud.
Related Issues (20)
- Error messages with v0.7.6 HOT 6
- Change setpoint from multi level switch to setpoint device
- 10° default value when switching on & other issues HOT 1
- receive unknonw message with error code 404 HOT 2
- Error 'onMessage' failed 'KeyError' with 0.7.8 plugin HOT 5
- Error in the code
- error code 404 HOT 2
- Errors after adding plugin HOT 1
- Login issue when domoticz used
- Plugin crashing after domoticz restart
- Loosnay Energy Recovery Ventilation device available in the plugin
- The “Mode” value of MELCloud is not reflecting the status of the airco units and not responding to changes HOT 2
- Polling interval settings
- Language setting HOT 6
- half degree HOT 1
- MelCloud plugin makes Domoticz crash if database auto save is enabled HOT 1
- MELCloud api POST service updated to JSON Payload, rejecting the post parameters HOT 1
- Login error with known good credentiolas HOT 3
- setPicID referenced before assignment HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from domoticz-python-melcloud.