Rooms Manager: Smarter Rooms: Personalized home automation with Occupancy

def uri = musicPlayers.trackData.trackUri
musicPlayers.setLevel(vol)
musicPlayers.playText(str)
musicPlayers.playTrack(uri)

clear the logs. use those lines in place of the original 1 line. and turn on use variable volume. :slight_smile:

still errors in sonos logs?

EDIT: i changed lines above.

Will have to do this tomorrow unfortunately, I'll give it some more testing and let you know the results :grin:

1 Like

when you try it replace that entire block with:

	if (musicPlayers)	{
		def currentVolume = musicPlayers.currentLevel
		def muteOn = musicPlayers.currentMute
		def uri = musicPlayers.currentTrackData.trackUri
		def i = 0
		for (def m : musicPlayers)	{
			if (muteOn[i] == 'muted')    m.unmute();
			i = i + 1
		}
		musicPlayers.setLevel(vol)
		musicPlayers.playText(str)
		i = 0
		for (def m : musicPlayers)	{
			m.setLevel(currentVolume[i].toInteger())
			m.playTrack(uri[i])
			if (muteOn[i] == 'muted')    m.mute();
			i = i + 1
		}
	}

then save and try.

1 Like

Forgive the "newbi-ness" of the question but here goes:

I have an office and in my office one can sit at a desk for hours toiling away which tends to lead to no motion.

Occasionally, this causes all the lights to go off which results in a shrug of the shoulders and an aggressive hand waive.

To prevent this my thought would be to treat the room as occupied after motion (so the room becomes 'engaged') AND my laptop has network activity.

So here is the question:

  1. Is there a way in HE to add a network device to HE to track for network activity (ie. wake on LAN) and;

  2. If so, can this be a condition on a room to keep a room engaged.

Other uses for this would include adding streaming devices so a room continues to be occupied if a Roku/Apple TV is moving data, but you are not moving on the couch per se.

Just a thought....

Yes. If you get a power socket/outlet that records on/off state, you can easily do this with your computer. I do this, and have auto power on for my desktop when the power returns (via the socket/outlet). Means I can now turn it on via my phone as I arrive (now via google), and the computer will be on by the time I get to it.

Also, the room will be set to engaged, meaning the lights wont turn off.

Or you could do this with a virtual switch, or a Sonos speaker playing music (equals occupancy).

1 Like

as @mike said the most common way to handle this is to add an outlet with with on/off or better yet with power value in wattage.

like the mac mini in my home office draws over 4 watts when in use. so I have the engaged power value set to 4 which moves the room to engaged and keeps the lights from turning off.

but also the code checks to make the room wasnt vacant when the power value goes up and keeps the room from changing to engaged. because you don’t want the room changing to engaged when the mac may just be backing up or downloading updates in middle night.

I know it's a small issue, but will there be a way to disable the 6 large lines of events in the device log with the various sizes of icons? Or at least be able to mark them as debug messages or something that can be hidden from the event table?

sure. those lines are normally commented in the driver from github. so they will show when published but if you refresh the screen they should not be saved. if you check the local copy of the driver code are lines 42 - 47 commented?

Hi @bangali sorry only got chance to check/ test this.

I now get this error with that change

[app:8](http://192.168.1.78/logs#app8)2018-11-03 23:45:28.297:errorgroovy.lang.MissingPropertyException: Exception evaluating property 'trackUri' for java.util.ArrayList, Reason: groovy.lang.MissingPropertyException: No such property: trackUri for class: java.lang.String on line 798 (contactClosedEventHandler)

no worries. let log the data to see whats there … use this code with the logging line included:

if (musicPlayers)	{
	def currentVolume = musicPlayers.currentLevel
	def muteOn = musicPlayers.currentMute
    log.debug musicPlayers.currentTrackData
	def uri = musicPlayers.currentTrackData.trackUri
	def i = 0
	for (def m : musicPlayers)	{
		if (muteOn[i] == 'muted')    m.unmute();
		i = i + 1
	}
	musicPlayers.setLevel(vol)
	musicPlayers.playText(str)
	i = 0
	for (def m : musicPlayers)	{
		m.setLevel(currentVolume[i].toInteger())
		m.playTrack(uri[i])
		if (muteOn[i] == 'muted')    m.mute();
		i = i + 1
	}
}

think i have a fix. but it changes the core time handler. so letting it run for a bit before putting up on github.

1 Like
[app:8](http://192.168.1.78/logs#app8)2018-11-04 08:55:45.651:errorgroovy.lang.MissingPropertyException: Exception evaluating property 'trackUri' for java.util.ArrayList, Reason: groovy.lang.MissingPropertyException: No such property: trackUri for class: java.lang.String on line 799 (contactClosedEventHandler)

[app:8](http://192.168.1.78/logs#app8)2018-11-04 08:55:45.635:debug[{"audioSource":"Hubitat","station":null,"name":"There are no open windows or doors","artist":"Hubitat","album":"TTS","trackNumber":null,"status":"stopped","level":"65","mute":"unmuted","uri":"http://192.168.1.78:8080/tts/9e4b752ce7db8d2624e2d05eddb52ebd.mp3","trackUri":"http://192.168.1.78:8080/tts/9e4b752ce7db8d2624e2d05eddb52ebd.mp3","transportUri":"http://192.168.1.78:8080/tts/9e4b752ce7db8d2624e2d05eddb52ebd.mp3","enqueuedUri":"http://192.168.1.78:8080/tts/9e4b752ce7db8d2624e2d05eddb52ebd.mp3","metaData":"http://192.168.1.78:8080/tts/9e4b752ce7db8d2624e2d05eddb52ebd.mp3There are no open windows or doorsHubitatTTSobject.item.audioItem.musicTrack","trackMetaData":"http://192.168.1.78:8080/tts/9e4b752ce7db8d2624e2d05eddb52ebd.mp3There are no open windows or doorsHubitatTTSobject.item.audioItem.musicTrack"}]

Or radio

[app:8](http://192.168.1.78/logs#app8)2018-11-04 09:00:00.085:debugperf scheduleNext: 38 ms

[app:8](http://192.168.1.78/logs#app8)2018-11-04 08:59:56.309:errorgroovy.lang.MissingPropertyException: Exception evaluating property 'trackUri' for java.util.ArrayList, Reason: groovy.lang.MissingPropertyException: No such property: trackUri for class: java.lang.String on line 799 (contactClosedEventHandler)

[app:8](http://192.168.1.78/logs#app8)2018-11-04 08:59:56.293:debug[{"audioSource":"Unknown","station":null,"name":null,"artist":null,"album":null,"trackNumber":"1","status":"playing","level":"29","mute":"unmuted","uri":"x-sonosapi-stream:s24939?sid=254&flags=8224&sn=0","trackUri":"hls-radio://http://a.files.bbci.co.uk/media/live/manifesto/audio/simulcast/hls/uk/sbr_high/llnw/bbc_radio_one.m3u8","transportUri":"x-sonosapi-stream:s24939?sid=254&flags=8224&sn=0","enqueuedUri":"x-sonosapi-stream:s24939?sid=254&flags=8224&sn=0","metaData":"BBC Radio 1object.item.audioItem.audioBroadcastSA_RINCON65031_","trackMetaData":"x-sonosapi-stream:s24939?sid=254&flags=8224&sn=0/getaa?s=1&u=x-sonosapi-stream%3as24939%3fsid%3d254%26flags%3d8224%26sn%3d0x-sonosapi-stream:s24939?sid=254&flags=8224&sn=0object.item"}]

@mike.maxwell device.currentTrackData is not returning a map. may be returning a list with strings?

off course if it was a map it would look like this when logged:

[[audioSource:Unknown, station:null, name:null, artist:null, album:null, trackNumber:1, status:playing, level:29, mute:unmuted, uri:x-sonosapi-stream:s24939?sid=254&flags=8224&sn=0, trackUri:hls-radio://http://a.files.bbci.co.uk/media/live/manifesto/audio/simulcast/hls/uk/sbr_high/llnw/bbc_radio_one.m3u8, transportUri:x-sonosapi-stream:s24939?sid=254&flags=8224&sn=0, enqueuedUri:x-sonosapi-stream:s24939?sid=254&flags=8224&sn=0, metaData:BBC Radio 1object.item.audioItem.audioBroadcastSA_RINCON65031_, trackMetaData:x-sonosapi-stream:s24939?sid=254&flags=8224&sn=0/getaa?s=1&u=x-sonosapi-stream%3as24939%3fsid%3d254%26flags%3d8224%26sn%3d0x-sonosapi-stream:s24939?sid=254&flags=8224&sn=0object.item]]

thank you.

its JSON, so you have to parse it as such

1 Like

sigh. and here i kept thinking … looking at the debug log posted … why doesnt it look like a map. duh.

thanks.

updated to github with the following changes:

Version: 0.96.0

DONE: 10/31/2018

  1. updated code for time handling to fix issue with midnight changes for sunrise and sunset rules.
  2. moved rooms vacation mode code from rooms manager to its own child app.
    • REQUIRES SAVING ROOMS VACATION CODE AS A NEW APP. REMEMBER TO ALSO SAVE SETTINGS FOR BOTH ROOMS MANAGER AND ROOMS VACATION.
  3. updated spoken announcements code in rooms manager because HE does not support all of the same commands that ST does.
    • PROBABLY NEED TO DO THE SAME FOR ROOMS CHILD APP AS WELL. BUT WANT TO LET THIS CHANGE BAKE IN REAL WORLD A BIT BEFORE I DO THAT.
  4. added setting for exception states for only on state change settings.
  5. added 15% and 25% to light level setting.
  6. added option to select 24 hours for announcement.
  7. cleaning up settings text etc.

After updating i'm getting alot of problems with the hub. I contacted support and they said the following: "Sorry for the troubles. I was able to pull your logs and unfortunately, the behavior you have described is similar to other customers running Room Manager. I do see a number of errors with that app, as well as a few others. I suggest temporarily removing the Rooms Manager to see if performance improves. Also, I see you are running version 1.1.7, you may want to update to most recent release (version 2.0.0.102)."

not sure if anyone else is having troubles but i sometimes can't even open the webpage of the hub or even change anything. Sometimes it works normaly but most of the times it's stuck or slow.

support mentioned this to another user recently who then got in touch with me. when I got in touch with support I was told:

  • asking users to delete an app is not a solution but a temporary step in their triage process
  • support is still trying to figure out whats causing these errors
  • support will share the errors with me “if there is anything actionable”

even after asking a couple more times after that i still have not “seen” any of these errors.

so the open questions are:

  1. what exactly are these errors that are in the platform logs?
  2. what is causing these errors - platform or app?
  3. what are these few other errors that are referred to?

it would be good to see Hubitat transparently share any issue so its possible to determine what needs to be fixed - in the app or the platform.

thanks for raising this issue.

EDIT: also unfortunately I am not seeing these issues with my own install. when this happens if there is any jquery errors in the logs please share them here. they might give an hint of what’s on with the platform.

EDIT2: also when using hubitat on chrome websockets seem to have memory leaks so when the same tab is open for a while that seems to cause “waiting for socket” or “waiting for cache” timeout on the browser.

Well i also asked for the error logs but didnt get an answer. I looked in my own logging but didnt see any error myself. After updating the firmware and leaving the hub alone for a few hours it seems to be back as normal. Not sure what was going on.....

1 Like

with that data not being shared … my current theory is that these are platform issues which the app is helping surface and then they are getting fixed with new platform releases.

thats a good thing. just more transparency and less finger pointing would be nice.

happy to be proven wrong with data.

2 Likes