Page 36 of 37

Re: ELV Max! Heating control system

Posted: Saturday 29 September 2018 15:55
by mvzut
demon1977 wrote: Saturday 29 September 2018 15:51 Unfortunately does not work:(
Spoiler: show
2018-09-29 16:47:52.199 Status: (MAX!) Started.
2018-09-29 16:47:54.130 Status: (MAX!) Entering work loop.
2018-09-29 16:47:54.130 Status: (MAX!) Initialized version 0.3.1, author 'mvzut'
2018-09-29 16:47:56.190 (Phyton) Plugin:MaxCube cannot be managed with PP-Manager!!.
2018-09-29 16:47:56.312 (MAX!) Debug logging mask set to: PYTHON
2018-09-29 16:47:56.312 (MAX!) Debugging mode activated
2018-09-29 16:47:56.312 (MAX!) Reading e-Q3 MAX! devices from Cube...
2018-09-29 16:47:58.966 (MAX!) Number of rooms found: 2 (highest number: 2)
2018-09-29 16:48:15.647 (MAX!) Reading e-Q3 MAX! devices from Cube...
2018-09-29 16:48:18.322 (MAX!) Checking device 'SpalnyaT' in room 2
2018-09-29 16:48:18.322 (MAX!) Checking device 'DetskayaT' in room 4
2018-09-29 16:48:18.322 Error: (MAX!) 'onHeartbeat' failed 'IndexError':'list index out of range'.
2018-09-29 16:48:18.323 Error: (MAX!) ----> Line 249 in '/home/pi/domoticz/plugins/MaxCube/plugin.py', function onHeartbeat
2018-09-29 16:48:18.323 Error: (MAX!) ----> Line 181 in '/home/pi/domoticz/plugins/MaxCube/plugin.py', function onHeartbeat
2018-09-29 16:48:47.856 (MAX!) Skipping heartbeat: 1
2018-09-29 16:49:17.875 (MAX!) Skipping heartbeat: 2
Ok, don't know what I was thinking but my "better" solution what bullshit. Can you try the newest version (0.3.2)?

Re: ELV Max! Heating control system

Posted: Saturday 29 September 2018 16:12
by demon1977
Excellent! Error gone missing. But ... The valve was added (2 rooms), the sensors of the windows were added (2 rooms), thermostat, temperature, mode is only one room.
Spoiler: show
2018-09-29 17:03:41.517 (MAX!) Skipping heartbeat: 8
2018-09-29 17:04:11.521 (MAX!) Skipping heartbeat: 9
2018-09-29 17:04:41.514 (MAX!) Reading e-Q3 MAX! devices from Cube...
2018-09-29 17:04:44.151 (MAX!) Checking device 'SpalnyaT' in room 2
2018-09-29 17:04:44.151 (MAX!) Updating setpoint for MAX! - SpalnyaT - Thermostat: 25.0 °C
2018-09-29 17:04:44.159 (MAX!) Updating mode for MAX! - SpalnyaT - Mode
2018-09-29 17:04:44.181 (MAX!) Updating temperature for MAX! - SpalnyaT - Temperature: 18.8 °C
2018-09-29 17:04:44.191 (MAX!) Checking device 'DetskayaT' in room 4
2018-09-29 17:04:44.191 (MAX!) Checking device 'SpalnyaS' in room 2
2018-09-29 17:04:44.191 (MAX!) Checking device 'DetskayaS' in room 4
2018-09-29 17:05:13.784 (MAX!) Skipping heartbeat: 1
2018-09-29 17:05:43.806 (MAX!) Skipping heartbeat: 2
2018-09-29 17:06:13.773 (MAX!) Skipping heartbeat: 3
2018-09-29 17:06:43.813 (MAX!) Skipping heartbeat: 4
2018-09-29 17:07:13.842 (MAX!) Skipping heartbeat: 5
2018-09-29 17:07:43.859 (MAX!) Skipping heartbeat: 6
2018-09-29 17:07:51.708 (MAX!) Debug logging mask set to: PYTHON
2018-09-29 17:07:51.709 (MAX!) Debugging mode activated
2018-09-29 17:07:51.709 (MAX!) Reading e-Q3 MAX! devices from Cube...
2018-09-29 17:07:51.270 Status: (MAX!) Stop directive received.
2018-09-29 17:07:51.270 Status: (MAX!) Exiting work loop.
2018-09-29 17:07:51.474 Status: (MAX!) Stopping threads.
2018-09-29 17:07:51.474 Status: (MAX!) Stopped.
2018-09-29 17:07:51.474 Status: (MAX!) Started.
2018-09-29 17:07:51.704 Status: (MAX!) Entering work loop.
2018-09-29 17:07:51.705 Status: (MAX!) Initialized version 0.3.2, author 'mvzut'
2018-09-29 17:07:54.357 (MAX!) Number of rooms found: 2 (highest number: 4)
2018-09-29 17:08:03.883 (MAX!) Reading e-Q3 MAX! devices from Cube...
2018-09-29 17:08:06.557 (MAX!) Checking device 'SpalnyaT' in room 2
2018-09-29 17:08:06.558 (MAX!) Updating mode for MAX! - SpalnyaT - Mode
2018-09-29 17:08:06.573 (MAX!) Checking device 'DetskayaT' in room 4
2018-09-29 17:08:06.573 (MAX!) Updating valve position for MAX! - DetskayaT - Valve position: 0%
2018-09-29 17:08:06.600 (MAX!) Checking device 'SpalnyaS' in room 2
2018-09-29 17:08:06.601 (MAX!) Checking device 'DetskayaS' in room 4
2018-09-29 17:08:36.142 (MAX!) Skipping heartbeat: 1
2018-09-29 17:09:06.133 (MAX!) Skipping heartbeat: 2
2018-09-29 17:09:36.165 (MAX!) Skipping heartbeat: 3
2018-09-29 17:10:06.149 (MAX!) Skipping heartbeat: 4
2018-09-29 17:10:36.152 (MAX!) Skipping heartbeat: 5
2018-09-29 17:11:06.183 (MAX!) Skipping heartbeat: 6
2018-09-29 17:11:36.190 (MAX!) Skipping heartbeat: 7

Re: ELV Max! Heating control system

Posted: Saturday 29 September 2018 16:39
by demon1977
Excellent !!! I deleted everything, after which everything was added. Great work! Thank you!

Re: ELV Max! Heating control system

Posted: Saturday 29 September 2018 16:40
by sakekl
mvzut wrote: Saturday 29 September 2018 15:50 About the manual and automatic modes: isn't this the expected behavior? Don't the setpoints only change at the programmed times? Or does it immediately change to the temperature programmed for that time block when you set it to Auto on the thermostat itself? What if you wait 5 minutes, is the setpoint updated then?
Pressing the buttons on the valve to switch from manual to automatic mode always get the temperature that was previously personalized in the plan of the day.
For example, if the temperature in the day schedule is 21 degrees and we change it to a higher one and come to the manual mode and we will be back to automatic mode, we will have a temperature of 21 degrees
However, when using the selector at domotic, the temperature stays the same as set earlier and does not change to the temperature from the schedule, ie 21 degrees.

It seems to me that correct behavior after pressing the auto button on the selector should result in setting the valve in automatic mode at a temperature compatible with the day's schedule, ie 21 degrees.

ELV Max! Heating control system

Posted: Saturday 29 September 2018 17:05
by mvzut
I have uploaded a new version (0.4.0) to Github, this one should always recreate all missing devices.

Note that if you don't need/want a certain device, it makes no sense deleting it, since it will be recreated anyway the next time you start the plugin. If you don't want to see it, just remove it from the used devices via the Devices page (blue button with white <- arrow behind the device). If you don't want Mode switches, don't select this option in the plugin.

Would be great if some of you can test this one too (don't throw away the old one so that you can always go back to the previous version ;-))

Re: ELV Max! Heating control system

Posted: Saturday 29 September 2018 17:58
by mvzut
Hi all,

I have created a dedicated topic for the plugin, as this topic is already very long & old, and was started when we were still using Maxbuddy etc. to control our Cubes. You can find the new topic here:
viewtopic.php?f=34&t=25081&p=192854#p192854
I suggest that we continue the discussions about the plugin there, and keep this topic open for people who are still using the other (e.g. php or Lua) methods.
I hope our moderators are ok with this.

Re: ELV Max! Heating control system

Posted: Sunday 30 September 2018 16:51
by nono212
Can you write us the git pull comand ... I am unable to make the update
Regards

ELV Max! Heating control system

Posted: Sunday 30 September 2018 19:07
by mvzut
nono212 wrote: Sunday 30 September 2018 16:51 Can you write us the git pull comand ... I am unable to make the update
Regards
Hi,
I have no idea how to do this, I have no experience with Github and how to use pull requests etc. I have been trying to find an explanation on the web, but I get stuck when I have to choose what to compare with the master in order to make a pull request.

Can't you just download a new clone? It's only one file (plugin.py) that is changing every time. Or if you explain me the procedure in Github, I'll be more than happy to follow your instructions.

Re: ELV Max! Heating control system

Posted: Sunday 30 September 2018 20:52
by nono212
In fact I did a git pull but it did not work ...
But now I follow your advise I moved the max cube directory and did another git clone
Thanks

Re: ELV Max! Heating control system

Posted: Monday 01 October 2018 23:32
by mvzut
nono212 wrote: Sunday 30 September 2018 20:52 In fact I did a git pull but it did not work ...
But now I follow your advise I moved the max cube directory and did another git clone
Thanks
I'm not what you did, but if you use

Code: Select all

git reset --hard
git pull
from within the eQ-3 plugin folder (e.g. ~/domotics/plugins/MaxCube/), it seems to update when there is a new version.

Re: ELV Max! Heating control system

Posted: Tuesday 02 October 2018 8:40
by michass
mvzut wrote: Thursday 27 September 2018 23:04 Hi all,

Finally I had some time to dive into the new Python plugin system. It was a steep learning curve, since I had no prior Python experience, but I think I succeeded, mostly... So here is my ELV/eQ-3 MAX! Python plugin for Domoticz!

https://github.com/mvzut/maxcube-Domoticz-plugin

...
Great work!
Thanks :!:

Re: ELV Max! Heating control system

Posted: Saturday 06 October 2018 9:11
by Umberto
Hi all,

Just to add my piece to the MAX scripting. I used the many lua scripts I have found on the forum to enhance it a bit (at least in my opinion) and wanted it to share it with you all.

What the script does:
- test if the MAX hardware is available in domoticz, if not: auto create it
- test if the devices are available in domoticz, if not: auto create it.
- it tests whether the Domoticz value is more recent than the intervall time of the script: if so, change domoticz or else change MAX. This is done for Mode and Setpoint seperately.
- you can enable / disable all logging in the script by setting the appropriate variable to 1 or 0 in the first part of the script

The devices are created with:
- ' ' (spaces) replaced by '_' (underscores) since I noticed that spaces in a name are mostly leading to problems;
- names are extended with 'ActTemp' for the Actual Temperature of the device, Mode for the mode, Battery for Battery and Setpoint for Setpoint. Off course all devices are auto created using the appropriate dummy device in Domoticz.


What I still need (maybe someone could help or give me a clue):
- auto change the level names of the battery and the mode switch
- check whether the communication with the cube is valid

How to install:
- follow het install instructions for the MAX lua script on the Wiki page
- open crontab ('crontab -e') and insert a line with the interval you like (I prefer 5 minutes, since the cube gets instable if it runs to often)
- the script as attachement to this post: it's named maxcon.txt, please rename to maxcron.lua

Open issues:
- sometimes the mode of the MAXCube is changed, but I have no clue why (happens so rarely that I haven't been able to catch the error, but it is somewhere hidden in the script.
- maybe some further code cleanup
- check if the calculated temperatures are valid in the Max communication part in the script (did some small changes which improved the script, but still not completely happy with it)

Bonus:
- you can use the framework in the script to make your own dummy devices and update them easily. It uses JSON to create lots of dummy devices and hold the possibility to update most of them (didn't fully test or complete them, so feel free... ;-) ).

Credits: to all the contributors to the wiki and all the previous posts related to MAX and Lua

Best regards, Umberto

Re: ELV Max! Heating control system

Posted: Saturday 06 October 2018 9:54
by mvzut
Umberto wrote: Saturday 06 October 2018 9:11 Hi all,

Just to add my piece to the MAX scripting. I used the many lua scripts I have found on the forum to enhance it a bit (at least in my opinion) and wanted it to share it with you all.
Wow, you took the Lua script quite a bit further than any of us ever have, impressive work! You found a good way to circumvent the DID device create&update method which doesn't work anymore for a while. I was planning to do something similar myself for a long time, but in the end I decided to spend that time on a Python plugin, of which you have probably seen the result. Turned out to be less work than I thought, I found a good Max API and the plugin architecture makes certain tasks much easier compared to (external) Lua.

Anyway, very good that there is an improved (external) Lua version available now. Because that's the beauty of Domoticz: there is always more than one way to achieve something!

Re: ELV Max! Heating control system

Posted: Saturday 06 October 2018 15:11
by Umberto
Thx for your feedback. I noticed that the script had some issues lately, therefor I decided to rewrite quite a bit (including sharing the functions which easily create and update a domoticz sensor just based on it's name, thought that would be interesting for someone).

However: I need some help!!

As mentioned: I would like to change the names of the levels I use for the mode and battery switch (can then be reused in the framework). Is there anyway that I can change the level names via JSON (have been searching some time now, couldn't find it). So: PLEASE HELP NEEDED. ;-)

Re: ELV Max! Heating control system

Posted: Saturday 06 October 2018 16:10
by mvzut
Umberto wrote: Saturday 06 October 2018 15:11 Thx for your feedback. I noticed that the script had some issues lately, therefor I decided to rewrite quite a bit (including sharing the functions which easily create and update a domoticz sensor just based on it's name, thought that would be interesting for someone).

However: I need some help!!

As mentioned: I would like to change the names of the levels I use for the mode and battery switch (can then be reused in the framework). Is there anyway that I can change the level names via JSON (have been searching some time now, couldn't find it). So: PLEASE HELP NEEDED. ;-)
Short answer: this is easy in the Python plugin system. But that's not what you wanted to hear I guess ;-)

Ok, I dived into it a bit. The trick is to perform the action of renaming the levels of your selector switch from a Chrome browser, with Developer tools on, and look at the JSON command that appears when you click "save" . After all, the web interface does noting else than send JSON commands to Domoticz when you change settings!

I did a test, and the following command changes the level names to "Auto", "Manual", " Vacation" and "Boost" (I guess that's what you were trying to do right?).

Code: Select all

http://x.x.x.x:8080/json.htm?addjvalue=0&addjvalue2=0&customimage=0&description=&idx=915&name=Test&options=TGV2ZWxOYW1lczpBdXRvfE1hbnVhbHxWYWNhdGlvbnxCb29zdDtMZXZlbEFjdGlvbnM6fHx8O1NlbGVjdG9yU3R5bGU6MDtMZXZlbE9mZkhpZGRlbjpmYWxzZQ%3D%3D&protected=false&strparam1=&strparam2=&switchtype=18&type=setused&used=true
In this case for a device named "Test" with idx 915. The weird looking value for "options" appears to a Base64-encoded string with the level names encoded into it. If you decode it, it reads:

Code: Select all

LevelNames:Auto|Manual|Vacation|Boost;LevelActions:|||;SelectorStyle:0;LevelOffHidden:false
which is the same construct you need to pass to Domoticz in Python when creating a selector switch. You could Base64-encode a string with this format with your desired names, but if all you want to do is giving each selector switch a fixed set of level names, you can just use the same pre-encoded string every time.

Hope this helps!

Re: ELV Max! Heating control system

Posted: Saturday 06 October 2018 16:21
by Umberto
Hi mvzut,

That's what I'm looking for. Thx. Will incorporate it into the lua part somewhere in the next days.

One question: how to encode texts myself? I also want to change the battery level names and have some other scripts that work similar. (if anyone interested: I have a Itho control system build which regulates the humidity of my bathroom.)

Thx in advance.

Re: ELV Max! Heating control system

Posted: Saturday 06 October 2018 16:27
by mvzut
Umberto wrote: Saturday 06 October 2018 16:21 Hi mvzut,

That's what I'm looking for. Thx. Will incorporate it into the lua part somewhere in the next days.

One question: how to encode texts myself? I also want to change the battery level names and have some other scripts that work similar. (if anyone interested: I have a Itho control system build which regulates the humidity of my bathroom.)

Thx in advance.
There are two ways to do this: Good luck!

Re: ELV Max! Heating control system

Posted: Saturday 06 October 2018 16:40
by Umberto
Thx. As one once said 'I'll be back'. :-)

Re: ELV Max! Heating control system

Posted: Sunday 07 October 2018 13:31
by Umberto
Hi,

As mentioned: I'll be back.

In the attachement the newest version of the LUA script. Thanks to mvzut I was able to add the names of the different modes ('Manual', 'Automatic', 'Vacation' and 'Boost') as well as the Battery ('Bat NOK' and 'Bat OK').


Just to add: I don't have a MAX switch, so I wasn't able to test it.

Enjoy.

There is an enhancement to be made (still): the script retrieves very often the complete devices list (at least: depending on the number of MAX items one has). I'm thinking of rebuilding that part and reducing the number of retrievals to a minimum (1?). But... that's for a later moment.

Re: ELV Max! Heating control system

Posted: Monday 22 October 2018 9:58
by haryb
Hi I have some problem with script.
I had configure all component eq-3 MAX! in my home by official app.
I bought Rasperry Pi 3 B+ and installed Domotowicz.
Now I put your script into /home/pi/domoticz/scripts/lua/maxscript.lua, change all variables for my and first I try run manually without cron to check working.
And I got some error:

Code: Select all

pi@RasberryPi:~/domoticz/scripts/lua $ lua maxscript.lua
10/22/18 09:54:20  MAX! Script started...
lua: maxscript.lua:127: bad argument #1 to 'pairs' (table expected, got nil)
stack traceback:
	[C]: in function 'pairs'
	maxscript.lua:127: in function 'get_ID'
	maxscript.lua:713: in main chunk
	[C]: in ?

I try debug this code but I only start learn this languages.
I have one more question, I found one place where id url with hard IP without use top variables:

Code: Select all

http.request('http://192.168.1.21:'..DomoticzPort..'/json.htm?type=command&param=addhardware&htype=15&port=1&name=MAX!&enabled=true')


192.168.1.21 this IP is correct ? I think should be my IP domoticz this same which is write in top variables ?