Logic Machine Forum
Status feedback from script in LUA [SOLVED] - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Status feedback from script in LUA [SOLVED] (/showthread.php?tid=2364)



Status feedback from script in LUA [SOLVED] - stemic01 - 26.11.2019

Hi. 
Just started looking into LUA and it seems very powerfull. As I am quite a beginner to this, I must admit that I am not sure what is "best practices" for LUA, but I have tested some simple Programming and enjoy it. 

Just made 4 basic "scenes" controlling DALI lights, Hue lights, Floor heating, Power sockets etc. Later also controlling AC, ventilation, Weather station, Water guard and other features.  These  scripts can now be controlled from push buttons and through "Wiser Touch" Visual user Interface when sending the Group addresses to the KNX-bus. 
So far all good. 

It would be great to actual get a feedback in "Touch" app and see the status of the "scene" activated and display this. Preferably in the  "Wiser Touch app", Maybe also in the push button (Schneider Multitouch Pro). I understand that this is not a "scene" by legitime KNX means, but more like a script that activates a series of functions and logic. I see this can be very powerfull.  

I am guessing there is a way of either setting/Writing a global variable or Write a status  in LUA to the Wiser (Logic Machine) which later can be read/retrieved in the "Touch".  Either as a active scene number" or directly as a text string. I am not sure what is best practice here, and where to start.   

I would Guess something like this
1. Write function from within the "scene" script (Either to Storage, database or global variable?)
2. Read function which can be displayed in the "Wiser Touch" user interface

Anyone who can help me in the right direction here? It would be great with script examples explaning the basics. 

Thanks.


RE: Status feedback from script in LUA - Daniel - 26.11.2019

Hi
Two problems:
1. Scene widget doesn't have any feedback status. You could make a custom widget to solve this.
2. You need to make some script which will be monitoring status of all objects to check if a scene is active. Bit of work but can be done.
BR


RE: Status feedback from script in LUA - stemic01 - 26.11.2019

(26.11.2019, 12:03)Daniel. Wrote: Hi
Two problems:
1. Scene widget doesn't have any feedback status. You could make a custom widget to solve this.
2. You need to make some script which will be monitoring status of all objects to check if a scene is active.  Bit of work but can be done.
BR
 

Thanx Daniel. 
--> Is there a better way of doing this?
--> Have anyone done this  and have a example script to get me started?


RE: Status feedback from script in LUA - stemic01 - 08.12.2019

A quick update on the matter. Maybe other members of the community having similar request….

I have just played a bit around with scripting after the excellent input from LM team and I know found a solution to my quest. I am not 100% sure if I did this by the book, but it seems to work pretty well during my testing.

SCOPE - WHAT I WANTED TO ACHIEVE:
- Rise Morning temperature:
When mode/scene is set to "night", rise the temperature 2 degrees at a given time in the morning (Scheduled script. Not IF in "away", "travel" or "home" mode).

- Lower Night temperature:
When mode/scene is set to "home" or "away" lower the night temperature (Not while in "night" or "travel" mode as the temperature is already set low in these modes)

- Visual scene detection
i also wanted a text in "Touch" which show which "mode/scene" is activated in the house. Very nice to actualy see the feedback on a screen or when operated remotely.

Other:
Later I can integrate other systems that can behave according to status of the house. Dimmed lights at bathroom at night. alarms, ventilation system etc.


HOW:
1. Dedicated Group addresses for "status"
First I made a New Group address for each of my per now 4-scenes/modes (Travel, away, home, night) and set these to be bolean (false/true)
I also made a New Group address for text ASCII-14 for a text Version of the status.
In total 5 New Group addresses

2. Change values (Event based script)
In each scene I have a script write a New value (false/true) to each of my 4 modes (grp.write).
And also set a text to the ascii Group address (Home, Away, Travel, Night) as text.
Everytime this script (home, away, travel, night) for the scene is triggered - the values are updated accordingly from the script in each scene.

3. Scheduled script
In the scheduled scripts I made a New scheduled script for "morning temp" and one for "night temp" at a give time.
Script is checking status of the "scene/mode" and setting the correct morning/night temperature if the certain criteria is met (IF than grp.write, value).

4. Touch:
And in touch I set up a widget showing the text and using status to show which scene is active.


As said - so far it is working well. Not 100% sure if it is by the book. Good Learning process and not too complicated.

Feel free to ask if you need any script examples.


HEATING:
The heating are A) Electrical floor heating for some rooms and a B) Panasonic CS-Z35 heat pump (AC) Connected to my Wiser through KNX Gateway from Intesisbox.