Thanks for taking a look. I appreciate it.
Here is the items
Group:Switch:OR(ON,OFF) lights "Indoor Lights [(%d)]" <light> (christmas)
Group:Switch:OR(ON,OFF) christmas "Christmas Lights [(%d)]" <christmas> (christmas)
Switch living_f_lamp "Living Room Floor Lamp" <light> (lights) ["Switchable"] {channel="tplinksmarthome:hs105:living_f_lamp:switch"}
Switch living_lamp "Living Room Lamp" <light> (lights) ["Switchable"] {channel="tplinksmarthome:hs105:living_lamp:switch"}
Switch dining_lamp "Dining Room Lamp" <light> (lights) ["Switchable"] {channel="tplinksmarthome:hs103:dining_lamp:switch"}
Switch front_c_lights "Front Room Christmas Lights" <christmas> (christmas) ["Switchable"] {channel="tplinksmarthome:hs103:front_c_lights:switch"}
Switch boys_c_lights "Boys Room Christmas Lights" <christmas> (christmas) ["Switchable"] {channel="tplinksmarthome:hs103:boys_c_lights:switch"}
Switch master_c_lights "Master Bedroom Christmas Lights" <christmas> (christmas) ["Switchable"] {channel="tplinksmarthome:hs103:master_c_lights:switch"}
Switch outdoor_c_lights_1 "Outdoor 1 Christmas Lights" <christmas> (christmas) ["Switchable"] {channel="tplinksmarthome:kp400:outdoor_c_lights:outlet1#switch"}
Switch outdoor_c_lights_2 "Outdoor 2 Christmas Lights" <christmas> (christmas) ["Switchable"] {channel="tplinksmarthome:kp400:outdoor_c_lights:outlet2#switch"}
//a scene that we set at night that turns on two lights
Switch tv_time "TV Time" <light> ["Switchable"]
Switch roku_home "Roku Home" ["Switchable"]
Switch roku_playPause "Roku PlayPause" ["Switchable"]
Dimmer tv_volume "Volume" <speaker> ["Switchable"] {channel="samsungtv:tv:living_tv:volume"}
Switch tv_mute "Mute" <speaker> ["Switchable"] {channel="samsungtv:tv:living_tv:mute"}
Switch tv_power "Power" <screen> ["Switchable"] {channel="samsungtv:tv:living_tv:power"}
Number weather_temp "Temperature [%.1f °F]" {weather="locationId=home, type=temperature, property=current"}
Number weather_clouds "Clouds [%.0f %%]" {weather="locationId=home, type=clouds, property=percent"}
String time_of_day "Time of day [MAP(weather.map):%s]" <tod>
DateTime morning_time "Morning [%1$tH:%1$tM]" <morning>
DateTime sunrise_time "Sunrise [%1$tH:%1$tM]" <sunrise> (astro) { channel="astro:sun:home:rise#end" }
DateTime sunset_time "Sunset [%1$tH:%1$tM]" <sunset> (astro) { channel="astro:sun:minus90:set#start" }
DateTime evening_time "Sunset [%1$tH:%1$tM]" <evening> (astro) { channel="astro:sun:home:set#start" }
DateTime night_time "Night [%1$tH:%1$tM]" <night>
Here is the things
Thing tplinksmarthome:hs103:dining_lamp "Dining Room Lamp" @ "First Floor" [ ipAddress="192.168.1.157" ]
Thing tplinksmarthome:hs105:living_f_lamp "Living Room Floor Lamp" @ "First Floor" [ ipAddress="192.168.1.154" ]
Thing tplinksmarthome:hs105:living_lamp "Living Room Lamp" @ "First Floor" [ ipAddress="192.168.1.155" ]
Thing tplinksmarthome:hs103:front_c_lights "Front Room Christmas Lights" @ "Decor" [ ipAddress="192.168.1.156" ]
Thing tplinksmarthome:hs103:boys_c_lights "Boys Room Christmas Lights" @ "Decor" [ ipAddress="192.168.1.158" ]
Thing tplinksmarthome:hs103:master_c_lights "Master Bedroom Christmas Lights" @ "Decor" [ ipAddress="192.168.1.159" ]
Thing tplinksmarthome:kp400:outdoor_c_lights "Outdoor Christmas Lights" @ "Decor" [ deviceId="8006D0F73EAF3DB0A8BFACEEB8DD802B1B29B21B", ipAddress="192.168.1.160" ]
Thing samsungtv:tv:living_tv "Living Room TV" @ "Living Room" [ hostName="192.168.1.110", refreshInterval=1000 ]
Thing exec:command:tv_input [ command="/usr/bin/samsungctl --host 192.168.1.110 --id banshee %2$s", interval=0, autorun=false ]
Thing astro:sun:home [ geolocation="39.121083,-76.759417,50", interval=30 ]
Thing astro:sun:minus90 [ geolocation="39.121083,-76.759417,50", interval=30 ] {
Channels:
Type rangeEvent : set#start [
offset=-90
]
Type rangeEvent : set#event [
offset=-90
]
}
Thing astro:sun:minus30 [ geolocation="39.121083,-76.759417,50", interval=30 ] {
Channels:
Type rangeEvent : set#start [
offset=-30
]
Type rangeEvent : set#event [
offset=-30
]
}
here is the sitemap (the custom icons exist in the folder and work fine)
sitemap home label="Home" {
Frame label="Astro & Weather" {
Text item=time_of_day icon=clock
Text item=evening_time icon=c_sunset
Text item=sunrise_time icon=c_sunrise
Text item=weather_temp icon=temperature
Text item=weather_clouds icon=clouds
}
Frame label="Quick Light Controls" {
Switch item=lights label="All Lights" icon=light
Switch item=tv_time label="TV Time" icon=light
Group item=lights label="Light Controls"
}
Frame label="Specialty" {
Switch item=christmas label="Christmas Lights"
Group item=christmas label="Christmas Lights"
}
Frame label="Living Room" {
Switch item=tv_power
Switch item=tv_mute icon="soundvolume_mute"
Setpoint item=tv_volume icon="soundvolume" label="TV Volume" minValue=1 maxValue=30 step=1
}
}
And lastly, here are the rules
//———————————————
// Daytime/Nighttime Automation
//———————————————
val logName = "Time Of Day"
val day_time = ""
rule "Time of Day state"
when
System started or
Channel 'astro:sun:home:rise#event' triggered START or
Channel 'astro:sun:home:set#event' triggered START or
Channel 'astro:sun:minus90:set#event' triggered START or
Time cron "0 0 5 * * ? *" or
Time cron "0 0 8 * * ? *" or
Time cron "0 0 21 * * ? *"
then
logInfo(logName, "Calculating time of day...")
//Morning starts at 0500
val morning_start = now.withTimeAtStartOfDay.plusDays(1).minusHours(19)
morning_time.postUpdate(morning_start.toString)
//Day and evening are based on the astro cycle
val day_start = new DateTime(sunrise_time.state.toString)
val sunset_start = new DateTime(sunset_time.state.toString)
val evening_start = new DateTime(evening_time.state.toString)
//Night starts at 2100
val night_start = now.withTimeAtStartOfDay.plusDays(1).minusHours(3)
night_time.postUpdate(night_start.toString)
var curState = "UNKNOWN"
switch now {
case now.isAfter(morning_start) && now.isBefore(day_start): curState = "MORNING"
case now.isAfter(day_start) && now.isBefore(sunset_start): curState = "DAY"
case now.isAfter(sunset_start) && now.isBefore(evening_start): curState = "SUNSET"
case now.isAfter(evening_start) && now.isBefore(night_start): curState = "EVENING"
case now.isAfter(night_start): curState = "NIGHT"
}
logInfo(logName, "Current state of day is " + curState)
time_of_day.sendCommand(curState)
day_time = time_of_day.state.toString
end
//-—————————————————
// Rules
//-—————————————————
//morning time rule, if the TV comes on, then turn on one lamp
rule "TV Morning Light On"
when
Item tv_power changed from OFF to ON
then
if ( day_time.contains("MORNING") ) {
dining_lamp.sendCommand(ON)
}
end
//define the scene of "tv time" so that the dining
//room lamp and the living lamp come on
rule "TV Time"
when
Item tv_time received command ON
then
dining_lamp.sendCommand(ON)
living_f_lamp.sendCommand(OFF)
living_lamp.sendCommand(ON)
end
//when it becomes evening, turn on the "tv time" lights
rule "Sunset Lighting"
when
Item time_of_day changed to "SUNSET"
then
dining_lamp.sendCommand(ON)
living_lamp.sendCommand(ON)
end
rule "Christmas Lighting"
when
Item time_of_day changed to "EVENING"
then
christmas.sendCommand(ON)
end
//When the TV is turned off, turn off the lights
rule "Lights Off TV"
when
Item tv_power changed from ON to OFF
then
Thread::sleep(45000)
if ( tv_power.state == OFF ) {
dining_lamp.sendCommand(OFF)
dining_f_lamp.sendCommand(OFF)
living_lamp.sendCommand(OFF)
living_f_lamp.sendCommand(OFF)
}
end
//—————————————————
// TV Controls
//—————————————————
rule "Roku On"
when
Item roku_home received command ON
then
executeCommandLine("curl -d '' http://192.168.1.111:8060/keypress/Home")
end
rule "Roku PlayPause"
when
Item roku_playPause received command ON
then
executeCommandLine("curl -d '' http://192.168.1.111:8060/keypress/play")
end
rule "Roku Plex"
when
Item roku_plex received command ON
then
executeCommandLine("curl -d '' http://192.168.1.111:8060/launch/13535")
end
Of course, any other recommendations are completely welcome, but as of now, all of the lights seem to be grouped under the Christmas lights… (the non-Christmas lights are another nested group within Christmas lights).
What I would like (but I don’t think is possible) is that when I tell google to “turn off the lights”, then she will turn off the internal lights only and when I say “turn off the Christmas lights” then she turns off the Christmas lights.
Everything else seems to work as expected, just the light grouping is not right.
Thanks again. I really appreciate the help.
Will