Jump to content

How to get number of lights on in house, or in folder?


brians

Recommended Posts

Posted

Is there an easy way to do this other than making a program for each light the increments a variable and runs the next  program etc. etc. ?

So far I have done 5 lights as a test and works but wondering if there is a better/easier way I am missing.

 

 

Posted (edited)

Not sure exactly what you are trying to achieve.
Are you trying to turn on a selected number of lights based on a variable quantity? If so how would ISY know which lights you want?

Post your programs so people can get clarification of what you are trying to accomplish.

Edited by larryllix
Posted
6 hours ago, brians said:

Is there an easy way to do this other than making a program for each light the increments a variable and runs the next  program etc. etc. ?

So far I have done 5 lights as a test and works but wondering if there is a better/easier way I am missing.

 

 

If you had the number, what would you do with it?

Posted

I'm really not sure what you're trying to do, but I set the on level of several Insteon dimmers to a variable in a single program:

KitchenLights - [ID 0077][Parent 000A]

If
        $s.KitchenLights is not 1000
 
Then
        Set 'Devices / dirKitchen / sldKitchenSink' On '$s.KitchenLights %'
        Set 'Devices / dirKitchen / sldDining' On '$s.KitchenLights %'
        Set 'Devices / dirKitchen / sldKitchenIslandSouth' On '$s.KitchenLights %'
        Set 'Devices / dirKitchen / sldKitchenIslandNorth' On '$s.KitchenLights %'
        Set 'Devices / dirKitchen / sldTrackLightSouth' On '$s.KitchenLights %'
        Set 'Devices / dirKitchen / sldTrackLightNorth' On '$s.KitchenLights %'
        Set 'Devices / dirKitchen / sldUnderCounter' On '$s.KitchenLights %'
 
Else
   - No Actions - (To add one, press 'Action')
 
This program is used to interface with Alexa, and uses a STATE variable ($s.KitchenLights) to set a brightness value for the lights in the kitchen. 
"Alexa, set the kitchen lights to 50" will set the STATE variable to 50, which causes this program to run.

I also use the "adjust scene" functionality on groups of dimmers that are included in a scene.

Posted (edited)

Oh sorry, all I want to do is display number of lights on in UD Mobile from a variable like a dashboard. Nothing really critical for now it’s just cosmetic. I noticed that HA seems to be able to do this. 

I have programs that do this for five lights so far. I was thinking of adding up each room/folder's lights on so I have those individual values, and then taking sum of each of those.

 

===================================================================================
Count Lights - [ID 00C3][Parent 0072]

Folder Conditions for 'Count Lights'

If
   - No Conditions - (To add one, press 'Schedule' or 'Condition')
 
Then
   Allow the programs in this folder to run.
 



-----------------------------------------------------------------------------------
Count 000 - [ID 00C4][Parent 00C3]

If
   - No Conditions - (To add one, press 'Schedule' or 'Condition')
 
Then
        $Num_Lights_On  = 0
        Run Program 'Count 001' (If)
 
Else
        Run Program 'Count 001' (If)
 



-----------------------------------------------------------------------------------
Count 001 - [ID 00C2][Parent 00C3][Not Enabled]

If
        'Backyard / Deck' Status is not Off
 
Then
        $Num_Lights_On += 1
        Run Program 'Count 002' (If)
 
Else
        Run Program 'Count 002' (If)
 



-----------------------------------------------------------------------------------
Count 002 - [ID 00C5][Parent 00C3][Not Enabled]

If
        'Backyard / Outside Back Door' Status is not Off
 
Then
        $Num_Lights_On += 1
        Run Program 'Count 003' (If)
 
Else
        Run Program 'Count 003' (If)
 



-----------------------------------------------------------------------------------
Count 003 - [ID 00C6][Parent 00C3][Not Enabled]

If
        'Dining Room / Dining Room Ceiling' Status is not Off
 
Then
        $Num_Lights_On += 1
        Run Program 'Count 004' (If)
 
Else
        Run Program 'Count 004' (If)
 



-----------------------------------------------------------------------------------
Count 004 - [ID 00C7][Parent 00C3][Not Enabled]

If
        'Dining Room / Dining Room Lamp' Status is not Off
 
Then
        $Num_Lights_On += 1
        Run Program 'Count 005' (If)
 
Else
        Run Program 'Count 005' (If)
 



-----------------------------------------------------------------------------------
Count 005 - [ID 00C8][Parent 00C3][Not Enabled]

If
        'Downstairs / Stairs' Status is not Off
 
Then
        $Num_Lights_On += 1
 
Else
   - No Actions - (To add one, press 'Action')
 


 

Edited by brians
Posted

I don't think you need to run the next program in each case. The statuses will be self triggering each program.

 

Something like this should work.

If
        'Downstairs / Stairs' Status is not Off
 
Then
        $Num_Lights_On += 1
 
Else
        $Num_Lights_On -= 1
  • Like 1
Posted
3 hours ago, larryllix said:

I don't think you need to run the next program in each case. The statuses will be self triggering each program.

 

Something like this should work.

If
        'Downstairs / Stairs' Status is not Off
 
Then
        $Num_Lights_On += 1
 
Else
        $Num_Lights_On -= 1

That may be problematic for dimmers.  Wouldn't going from 50% to 70% trigger the program?

Posted (edited)
21 hours ago, gzahar said:

That may be problematic for dimmers.  Wouldn't going from 50% to 70% trigger the program?

hmmmm...good point. Likely it would be a problem for dimmers. Some testing would be in order to prove that either way. By the words of the logic it should work but from other experience I think you are correct. With all disabled programs, triggered by another event, you can corral the counting to selected time slots.

Possibly using a double condition for the bulbs to test whether it was previously on would work.

My lights are mostly WiFi now and I use variables that determine their current setting requests so the count would be easy. AS an alternative one could use a flag for each bulb and then just count the flags on the fly. That would convert the analogue values of the bulbs to a binary function,.... Off or Not Off.

Edited by larryllix
Posted

Maybe something like this with 2 variables and 2 programs. 

The Folder_count  variable to count the number which are on (status > 0)

The Temp_calc variable is first set to the device status. Then use the Math program to convert status to 1 or 0.

 

This is not disabled as Temp_calc is an int var

Math - [ID 017C][Parent 017B]

If
        $Temp_calc > 0
 
Then
        $Temp_calc  = 1
 
Else
        $Temp_calc  = 0

This example has 2 devices.  You may be able to move the $Folder count += to the program above to eliminate wait actions.

Variable Test - [ID 0084][Parent 017B]

If
        'Devices / Basement / Basement Bathroom' Status is not Off
     Or 'Devices / Basement / Basement Bathroom' Status is Off
     Or 'Devices / Dinning Room / Dining Fan / DiningFan--Light' Status is Off
     Or 'Devices / Dinning Room / Dining Fan / DiningFan--Light' Status is Off
 
Then
        
        // reset folder count
 
        $Folder_count  = 0
        
        // Set variable to status for first device
 
        $Temp_calc  = 'Devices / Basement / Basement Bathroom' Status 
        
        // Convert status to boolean 1 or zero
 
        Run Program 'Math' (If)
        
        // Wait a second to allow 994 to set variable value.  May not be needed for eisy
 
        Wait  1 second
        
        // Add 1 or 0 to folder count
 
        $Folder_count += $Temp_calc
        
        // Set variable to status for second device
 
        $Temp_calc  = 'Devices / Dinning Room / Dining Fan / DiningFan--Light' Status 
        
        // Convert status to boolean 1 or zero
 
        Run Program 'Math' (If)
        
        // Wait a second to allow 994 to set variable value.  May not be needed for eisy
 
        Wait  1 second
        
        // Add 1 or 0 to folder count
 
        $Folder_count += $Temp_calc
 
Else
   - No Actions - (To add one, press 'Action')
 

 

Guest
This topic is now closed to further replies.

×
×
  • Create New...