[solved] Most efficient way to get sum of all light states? - Printable Version +- Logic Machine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Visualization (https://forum.logicmachine.net/forumdisplay.php?fid=9) +--- Thread: [solved] Most efficient way to get sum of all light states? (/showthread.php?tid=539) |
[solved] Most efficient way to get sum of all light states? - Habib - 05.01.2017 Hi, at moment I search for a way to get a total sum of all Lights in my house with state on. The same I have for opened windows and it works for me, but I think my way is not much elegenat. I have create one KNX Object for the sum count total. Then I created on each windows object an event which gets the value from the total sum and add or substract the total value (+1 or -1). That works because are only few windows (19) and the action on that is very slow. But if I try to do it for my downlights on the same way it doesn't works. I have 110 Downlights in my house and each of them has its own status object. I have done that, because I use many different scenes and wants to have in all ways the exact visualisiation. In my living room I have 30 downlights and If I do the calculation in that way I described before, It calculates every times wrong. In next step I reverted that and put the calculation in the event script of the event trigger (switch/button) and do the calculation for the whole group (+3 or +24 and so on). But it doesn't work also. In some cases it works, in other combination not... My idea is now to create a functionality to get the status of all tagged objects (maybe tag: "downlight status") on every 2 minutes. but the disadvantage is, that I have much more traffic and CPU/Bus load. What is the best way to do such functionality? Thank you forwards BR Habib RE: Most efficient way to get sum of all light states? - buuuudzik - 05.01.2017 Hi Habib, this is a script for central status calculations from forum with a little update of sum function. output - how many lamps are switched on from tagged counter - how many lamps are tagged for sum This should be Resident script 0s. Code: if not client then RE: Most efficient way to get sum of all light states? - Habib - 05.01.2017 Hi buuuudzik, wow, thx. A ready solution? I will try it at weekend. A resident script with 0s. Produce it not to much CPU load? RE: Most efficient way to get sum of all light states? - buuuudzik - 06.01.2017 No, because there is a variable updatedelay=0,5s(you can change this for more) so the effect is that this script has interval more than 0,5s. But be careful with number of group addresses which are calculated by this script. I think the sum of 100-200 shouldn't be a problem but more and more can produce some weard beahaviour(in your case bad number of lamps which are switched on and number of whole lamps). RE: Most efficient way to get sum of all light states? - Thomas - 06.01.2017 Hi In my project I have > 500 bulbs. My experience is the better way is to use two layers in these calculations. First layer (aka kitchen, bedroom) where every room contains less than 10 lights is calculated in per event based scripts. The second layer is calculated just from the first layer's results as a resident task. I use DALI gateways. I experimented with DALI cumulative feedback but the result was unreliable. The reason was DALI sends not one but few other cumulative feedback according to DALI program and DALI bus state. And from time to time it happened on KNX bus the first telegram outran the second telegram. RE: Most efficient way to get sum of all light states? - rocfusion - 07.01.2017 Hi, I do a similar thing, individual lights are tagged to rooms, the rooms are tagged to a floor or areas, the floors\areas are tagged to the whole house \ apartment. That works great. That way you get a status at all of the levels. Thanks Roger RE: Most efficient way to get sum of all light states? - Habib - 07.01.2017 Hi, @buuuudzik it works great for me. What I don't understand is, why the "OR" logic don't works... AND and AVERAGE works, so I made a simple quick&dirty mod and added a forth object "COUNT" and modified for that the function avarage to get the amount of lights which are in state on. I understand that script in that way, that I can use one script for each room, or sum of windows and so on, for each value I will count. Is that correct? For example I count with Tag "Spots" all my Downlights which I tagged... If I want to count open windows, I take another copy of that script and Tag all my windows status objects with "windows", and I will get a value for opened windows. ... RE: Most efficient way to get sum of all light states? - rocfusion - 07.01.2017 Hi, I have also applied this with temperatures too, the following will average Celsius temps and then convert it to Fahrenheit. Code: -- Temperature AVERAGE value Thanks, Roger RE: [solved] Most efficient way to get sum of all light states? - buuuudzik - 07.01.2017 But event scripts can be not a good solution when there is some change of whole room or much more when there is whole floor change. Then there are a lot of unnecessary serial calculations of every event. With this resident script you can also prepare some layers and I use also such solutions. More on this forum about this task(more about OR calculations but also universal): http://forum.logicmachine.net/showthread.php?tid=220&highlight=central+statuses http://forum.logicmachine.net/showthread.php?tid=275&page=3&highlight=central+statuses RE: [solved] Most efficient way to get sum of all light states? - Habib - 07.01.2017 @buuuudzik did you mean me with your answer? If yes, you missunderstood me. I use multiple resident scripts to count for different groups. I agree with you, taht event based scripts for an global stat is not a good idea. That was the reason for this thread. Thank you very much :-) RE: [solved] Most efficient way to get sum of all light states? - buuuudzik - 07.01.2017 (07.01.2017, 11:32)Habib Wrote: @buuuudzik This was only an exchange of some experience with this complex subject that everybody should have whole background of this subject(Preparing the elegant solution for calculating central statuses). But for this script recommended is to using only 1 with whole groups(Kitchen, Livingroom, 1Floor etc.). I updated this script a few minute ago because I saw that there was no sum function Now there is. Please check. RE: [solved] Most efficient way to get sum of all light states? - Habib - 07.01.2017 that's great :-) I have adopted your new version. I think the functionality should be part of the original installation. RE: [solved] Most efficient way to get sum of all light states? - buuuudzik - 07.01.2017 First version was prepared by Edgars so he can everything. I agree with you but I think it should be not a script but a special app with simple editor. Another think is that this version is simpler to change for suit it to specific solutions. |