Room Lighting – Driving Me Nuts

If you liked Smart Lighting, the Simple Automation Rules app on Hubitat begin as basically a clone of that SmartApp's functionality (in fact, it used to be called Simple Lighting). I would suggest looking at it if you haven't already.

Motion Lighting has been around since the beginning as a more powerful alternative to what was then Simple Lighting. If Simple Automation Rules is too simple for your needs and Room Lighting too much, I'd suggest looking at that instead. (It is unlikely to receive future development like Room Lighting, but if it works, that shouldn't be a problem.)

I wouldn't suggest anyone do most motion lighting automations in Rule Machine, but that won't stop everyone. :slight_smile: (And historically, Basic Rule is newer than all of these apps except Room Lighting. It will work for lighting automations -- or whatever you can build with it -- too, and is easily imported into Rule Machine, but as much as I'd normally suggest ignoring Simple Automation Rules, its origin with lighting automations in mind might give it a bit of an edge there.)

In order to simplyify, they actually did try removing some of the older apps for new users at one point (existing install that had them were fine), were met with negative feedback, and thus reinstated them for all users -- so at the moment, there are a lot of options because of history. Different ones may meet certain users' preferences better than others.

6 Likes

Was just about to post the same, @bertabcd1234, you beat me to it! :wink:

Another very basic option that is available and might be a good way to go for an action of this size and simplicity is the "All Off" app penned by none other than Bruce, one of the founders of HE. It turns off a group of device and as its description states, rechecks the devices' status to confirm they are off. Screen shot and code below.

definition(
	name: "All Off",
	namespace: "hubitat",
	author: "Bruce Ravenel",
	description: "Turn Devices Off with Recheck",
	category: "Convenience",
	iconUrl: "",
	iconX2Url: ""
)

preferences {
	page(name: "mainPage")
}

Map mainPage() {
	dynamicPage(name: "mainPage", title: "All Off", uninstall: true, install: true) {
		section {
			input "appName", "text", title: "Name this instance of All Off", submitOnChange: true
			if(appName) app.updateLabel(appName)
			input "switches", "capability.switch", title: "Switches to turn off", multiple: true
			paragraph "For the trigger use a Virtual Switch with auto-off enabled, turning it on fires the main off command for the switches above"
			input "trigger", "capability.switch", title: "Trigger switch"
			input "retry", "number", title: "Select retry interval in seconds (default 1 second)", defaultValue: 1, submitOnChange: true, width: 4
			input "maxRetry", "number", title: "Maximum number of retries?", defaultValue: 5, submitOnChange: true, width: 4
			input "meter", "number", title: "Use metering (in milliseconds)", width: 4
		}
	}
}

void updated() {
	unsubscribe()
	initialize()
}

void installed() {
	initialize()
}

void initialize() {
	subscribe(trigger, "switch.off", handler)
	subscribe(switches, "switch.on", onHandler)
	atomicState.someOn = true
}

void handler(evt) {
	atomicState.retry = 0
	turnOff()
}

void turnOff() {
	if(atomicState.someOn) {
		Boolean maybeOn = false
		List whichOff = []
		switches.each{
			if(it.currentSwitch == "on") {
				it.off() 
				maybeOn = true
				whichOff += it
				if(meter) pause(meter)
			}
		}
		atomicState.someOn = maybeOn
		if(maybeOn) {
			log.info "Switches sent off commands: ${"$whichOff" - "[" - "]"}"
			atomicState.retry++
			if(atomicState.retry < maxRetry) runIn(retry, turnOff)
			else log.info "Stopped after $maxRetry attempts: ${"$whichOff" - "[" - "]"} still on"
		} else log.info "All switches reported off"
	}
}

void onHandler(evt) {
	atomicState.someOn = true
}

1 Like

Excellent! This worked perfectly as a basic switch for all lights off (and on for testing). Looks like I will need to create separate child apps for switches vs. dimmers, and on vs. off, during other time periods. My lighting rules are basically aimed at bringing a few select lights on and turning everything else off, 3-4 times a day, cleaning up after everyone's habit of leaving lights on.

I'm not going to mark this thread solved quite yet, as I would like to keep it open until I at least meet the threshold of what I had in ST.

1 Like

This user app may also be of interest.
It is purpose built just for scheduling sprinklers and lights based on times.

2 Likes

I like this. Much appreciated.

1 Like

Never dreamt I would integrate my OpenSprinkler system tonight, let alone accomplish it in 30 minutes... Thanks for this, Jeff. I'll have to see if it meets any of my lighting needs, as well.

2 Likes

Added 'All Off' time to the Switch Scheduler app just now. Switches and Valves.

I'm continuing to have apparent (still unproven by logs) issues as I attempt to now use RL to only TURN ON select lights, 3-4 times a day. What I face is walking into a room and realizing a particular light is not in the state (now, just on) that I expect it to be in. When I open the log for the RL app that should have set the expected state, I'm not finding all the events I anticipate being there, which is why I'm not posting any logs here at the moment.

I think this issue has to do with what RL perceives to be the current state of my devices at the time the automation is activated. I said something about this in post #11 and included screenshots of the same devices from the perspective of 2 different RL apps/automations at the same point in time, yet nobody here responded directly to that concern.

These 2 perspectives from RL are not identical, yet I believe they should be. In both cases I refreshed the browser before taking the screenshot to make sure everything was current. Can someone please prove me wrong or point out why my expectation is unwarranted?

In the meantime I've deleted all my RL child apps and the RL parent app, and then reinstalled the parent app. I will begin trying this from scratch again, carefully following the documentation, and will hopefully be able to post logs that prove what's happening. Better still, would be everything now works as expected.

I’ve already run into an issue as I’m just starting to set up the first RL automation after reinstalling RL. I have not yet saved this first automation. Here’s my steps:

  1. Selected my 9 Devices to Automate.
  2. In the Device Table, as expected, all devices were initially in the OFF state (true to actual state).
  3. I next decided to turn all devices ON from the Device Control column and to walk the house to see if all responded to the ON state. But, I never got that far:
  • When I selected Countertop Lights at the top of the list, they came on in the Device Table and also illuminated in actuality.
  • However, turning on the Countertop Lights from the Device Table also caused the Kitchen Light to come ON in the Device Table, but the Kitchen Light remained off in actuality.
  • The log shows the Countertop Lights set to Level 75 and there is no log entry for the Kitchen Light.

I realize the first thought here might be that these lights are associated to each other, but remember that in actuality the Kitchen Light didn't turn on. Only the red radio button came on in RL. Even so, I am certain there is no relationship between the lights because the Countertop Lights are a pair of Sylvania Zigbee CT bulbs on a dumb switch and the Kitchen Light is dumb LEDs in a fixture connected to a Zooz ZEN21 Z-Wave switch. Furthermore, they are installed on separate HE hubs:
- Room Lighting is running on my C8 Pro.
- Countertop Lights = Sylvania Zigbee CT bulbs are running on a C7 and are combined in a Group Dimmer, which is shared to my C8 Pro by Hub Mesh.
- Kitchen Light = Zooz ZEN21 Z-wave running directly on C8 Pro.
- No devices on the C8 Pro are shared with the C7.

To make this even messier, Im also going to also post a screenshot of the log from RL. You will see that it includes End Table Lamps (the 2nd device on the list). I saw the Kitchen Lights come on in the Device Table at the same time I clicked Countertop Lights, but I had already selected End Table Lights before that sunk into my brain. Wanting to keep this simple, I went ahead and deselected the End Table Lights before I took the screenshot. This did turn the End Table Lights back off, both in the Device Table and in actuality. However, I now see that the RL log does not include that last action (about 1 minute later) of deselecting the End Table Lights, even though it showed up both in the Device Table (radio button went back off) and in actuality (lights went off).

Herein lies my gripe with RL. If I cannot count on these simple steps to create the expected outcome (in actuality, in the Device Table, and in the Log) how can I count on anything further?

1 Like

FYI, not sure if you saw this, but attempt to fix the Force option 2.3.8.122 didn't actually fix it. Bruce has said that he has identified the issue and the force option will be fixed in the next release (.123 or whatever).

So using the Forice option now for devices that may not be reporting state accurately won't help.

Also, you probably realize this but just in case, when you're using logging to track an issue, turn on debug logging for the app and the device(s).

1 Like

Okay. I will try to recreate this again by removing all traces of RL and reinstalling, and setting up debug for everything. Thanks.

FYI, not using Force at this point in my testing.

Will reboot the hubs with database rebuild as well.

.....On reboot with database rebuild, the C8 Pro came back up and allowed me to reinstall RL, but during setting the Means to Activate by a time, the hub became unresponsive but green light remained on. I need to set at least one simple automation in order to turn on debug.

I've now tried power cycling and I'm left with a blue light...
Looking into next steps.

Access the hub via the diagnostic tool (hubIPaddress:8081) and use the Reboot option there to reboot the hub. Assuming the hub boots up normally to the main UI, then do another reboot from the Settings menu and choose the option to rebuild database.

Your issues are very likely device related. You note that you are using smart bulbs with dumb switches. If you are turning the lights on/off via the switches that is a good way of confusing Hubitat. I suggest you focus on a RL instance with the smallest number of devices necessary to not work as expected. Look at both RL and device logs.

Finally back up and running. Hub skipped across 3 ip addresses in the process and darned if I can get UniFi to reserve the DHCP.

UniFi gives me the message: "Your DHCP reservation has been made, but this IP can only be obtained by connecting to its respective network." I really don't get what it's saying.

I set my DHCP reservations on my EdgeRouter so haven't seen messages on my Unif APs...

But assuming your reservation was 192.168.2.50, sounds like they may just be saying that the device needs to be connected that subnet to get the IP reservation...some info from UI site:

Okay, thanks for that. I just discovered what's going on. When you initially select the UniFi checkbox for Fixed IP Address, the address that is prepopulated is not necessarily the same as the current IP address. No wonder it made my hub skip addresses, since on reboot it handed out the reserved address, which was not what I thought it was.

1 Like

Damn devices keep doing what they say they are going to do rather than what we assume they are going to do. So annoying... :wink:

1 Like

I know, and doing this publicly is only asking for humiliation... :roll_eyes:

3 Likes

Welcome to the team. :smiley:

2 Likes

Evening On RL automation created around 12:30 PM and I had been dinking around UniFi IP reservation when I noticed no lights came on 12:40, the time I initially set. I couldn’t remember if I had hit Update, so I set activation for 1:05 PM and hit Update at 12:56 PM. I also decided to hit Done and I think it initialized again at 1:00 PM.

At 1:05 PM I have the following outcome with no lights having been turned on at all. So please, can someone tell me what the issue is? Is it me? Am I this clueless that I can't make sense of it?