Rooms Manager: Smarter Rooms: Personalized home automation with Occupancy

rooms
manager
occupancy
rules
automation

#303

No, it does not load after changing the level to 1% instead.


#304

thanks.

this is a bit nuts. i can create a room and directly go to AL settings even without saving the room or touching any other settings and it works every time.

just to be sure you have updated the DTH to the latest as well?


#305

Yup, installed everything last night for the first time. Deleted and reinstalled all this morning from the latest.


#306

pushed a small fix in that section which should not have anything to do with this. but for sanity would you please update to the latest and give it a try?


#307

if that still does not work please try changing line 416 in the rooms child app to this:

if (autoColorTempearture) {

the old line is: if (autoColorTempearture || state.ruleHasAL) {

save and publish and then try.

sorry cannot update the code here because its too large for the forum.


#308

fresh install from latest. No change. Created and saved Room1, attempted to open AL settings, but was unable. Created rule with AL selected, went back and was able to open AL settings menu.

Changed Line 416. Went to Room1 (created above) and was able to open AL settings. Created Room2, attempted to open AL settings but was unable to. I then created rule with AL settings was unable to open AL Settings menu.

So after changing the code, I was only able to access AL settings menu IF it previously was available. I was not able to work around it like previously.


#309

thanks. what happens if you comment out as following does it show the AL settings page everytime?

	dynamicPage(name: "pageAutoLevelSettings", title: "", install: false, uninstall: false)    {
/*		section("SETTINGS TO USE WHEN LEVEL IN RULES IS SET TO 'AL':", hideable: false)		{
            if (autoColorTempearture || state.ruleHasAL)   {
                input "minLevel", "number", title: "Minimum level?", required: true, multiple: false, defaultValue: 1, range: "1..${maxLevel ?: 100}", submitOnChange: true
                input "maxLevel", "number", title: "Maximum level?", required: true, multiple: false, defaultValue: 100, range: "$minLevel..100", submitOnChange: true
            }
            else    {
                input "minLevel", "number", title: "Minimum Level?", required: false, multiple: false, defaultValue: null, range: "1..${maxLevel ?: 100}", submitOnChange: true
                input "maxLevel", "number", title: "Maximum Level?", required: false, multiple: false, defaultValue: null, range: "$minLevel..100", submitOnChange: true
            }
        }*/

#310

Yes, it loads every-time, new/old/exitisting/rule/no rule. Of course I donā€™t have the light level options, but that was all commented out.


#311

got it what if you move the bottom section above the top section. so flip the section for level wtih the section for color temperature in this same section?

		section("SETTINGS TO USE WHEN LEVEL IN RULES IS SET TO 'AL':", hideable: false)		{
            if (autoColorTempearture || state.ruleHasAL)   {
                input "minLevel", "number", title: "Minimum level?", required: true, multiple: false, defaultValue: 1, range: "1..${maxLevel ?: 100}", submitOnChange: true
                input "maxLevel", "number", title: "Maximum level?", required: true, multiple: false, defaultValue: 100, range: "$minLevel..100", submitOnChange: true
            }
            else    {
                input "minLevel", "number", title: "Minimum Level?", required: false, multiple: false, defaultValue: null, range: "1..${maxLevel ?: 100}", submitOnChange: true
                input "maxLevel", "number", title: "Maximum Level?", required: false, multiple: false, defaultValue: null, range: "$minLevel..100", submitOnChange: true
            }
        }
        section("SETTINGS FOR AUTO COLOR TEMPERATURE:", hideable: false)		{
            input "autoColorTempearture", "bool", title: "Auto set color temperature when using 'AL'?", required: false, multiple: false, defaultValue: false, submitOnChange: true
            if (autoColorTempearture)       {
                input "wakeupTime", "time", title: "Wakeup Time?", required: true, multiple: false, submitOnChange: true
                input "sleepTime", "time", title: "Sleep Time?", required: true, multiple: false, submitOnChange: true
                input "minKelvin", "number", title: "Minimum kelvin?", required: true, multiple: false, defaultValue: 1900, range: "1500..${maxKelvin?:9000}", submitOnChange: true
                input "maxKelvin", "number", title: "Maximum kelvin?", required: true, multiple: false, defaultValue: 6500, range: "$minKelvin..9000", submitOnChange: true
            }
            else    {
                paragraph "Wakeup time?\nenable auto color temperature above to set"
                paragraph "Sleep time?\nenable auto color temperature above to set"
                paragraph "Minimum kelvin?\nenable auto color temperature above to set"
                paragraph "Maximum kelvin?\nenable auto color temperature above to set"
            }
        }

are you on hub v1 or v2?


#312

flipped them, and it was back to not working reliablyā€¦

I tried it flipped with what was 416 changed and as the original.

hub is v2


#313

just pushed a change please update and give it a shot.

from commenting that section seemed like using autocolortemperature before it was defined in the page might have been the issue. lets see ā€¦


#314

stepping out for a bit ā€¦ will be online later to dig further if this does not resolve it for you.

thank you for working thru this with me.


#315

Couple of things, the update did not seem to fix it.

I was able to get it to reliably open from a fresh start if i change the default levels from null to 1/100. The downside is it reliably opens after a single refresh of the ā€œsomethings wrongā€ page. Iā€™m fairly sure this is because the values for autoColorTemperature or state.ruleHasAL are not set until updateRulesToState() is executed at least once. The reload is basically refreshing the page after the initial updateRulesToState() has runā€¦ at least that is my hunch.

	section("SETTINGS FOR AUTO LEVEL WHEN RULE LEVEL IS SET TO 'AL':", hideable: false)		{
        if (autoColorTemperature || state.ruleHasAL)   {
            input "minLevel", "number", title: "Minimum level?", required: true, multiple: false, defaultValue: 1, range: "1..${maxLevel ?: 100}", submitOnChange: true
            input "maxLevel", "number", title: "Maximum level?", required: true, multiple: false, defaultValue: 100, range: "$minLevel..100", submitOnChange: true
        }
        else    {
            input "minLevel", "number", title: "Minimum level?", required: true, multiple: false, defaultValue: 1, range: "1..${maxLevel ?: 100}", submitOnChange: true
            input "maxLevel", "number", title: "Maximum level?", required: true, multiple: false, defaultValue: 100, range: "$minLevel..100", submitOnChange: true
        }
    }

#316

that sort of makes sense.

but i do use defaultvalue: null with numbers input all over the place. whats still bugging me is why is this one being finicky and that too only for you ā€¦ dont like code mysteries :-/

also the updateRulesToState is executed right before the dynamic page definition


#317

please replace the entire function with this and see if that works consistently?

private pageAutoLevelSettings()     {
    ifDebug("pageAutoLevelSettings")
    def wTime
    def sTime
    if (autoColorTemperature && (wakeupTime || sleepTime))     {
        if (!wakeupTime || !sleepTime)
            sendNotification("Invalid time range!", [method: "push"])
        else        {
            wTime = timeToday(wakeupTime, location.timeZone)
            sTime = timeToday(sleepTime, location.timeZone)
            if (wTime > sTime || ((sTime.getTime() - wTime.getTime()) < 18000L))
                sendNotification("Invalid time range!", [method: "push"])
        }
    }
    updateRulesToState()
    def levelRequired = (autoColorTemperature || state.ruleHasAL || minLevel || maxLevel ? true : false)
	dynamicPage(name: "pageAutoLevelSettings", title: "", install: false, uninstall: false)    {
        section("SETTINGS FOR AUTO LEVEL WHEN RULE LEVEL IS SET TO 'AL':", hideable: false)		{
/*            if    {*/
                input "minLevel", "number", title: "Minimum level?", required: levelRequired, multiple: false, defaultValue: (levelRequired ? 1 : null), range: "1..${maxLevel ?: 100}", submitOnChange: true
                input "maxLevel", "number", title: "Maximum level?", required: levelRequired, multiple: false, defaultValue: (levelRequired ? 100 : null), range: "$minLevel..100", submitOnChange: true
/*            }
            else    {
                input "minLevel", "number", title: "Minimum Level?", required: false, multiple: false, defaultValue: null, range: "1..${maxLevel ?: 100}", submitOnChange: true
                input "maxLevel", "number", title: "Maximum Level?", required: false, multiple: false, defaultValue: null, range: "$minLevel..100", submitOnChange: true
            }*/
        }
        section("SETTINGS FOR AUTO COLOR TEMPERATURE WHEN RULE LEVEL IS SET TO 'AL':", hideable: false)		{
            input "autoColorTemperature", "bool", title: "Auto set color temperature when using 'AL'?", required: false, multiple: false, defaultValue: false, submitOnChange: true
            if (autoColorTemperature)       {
                input "wakeupTime", "time", title: "Wakeup Time?", required: true, multiple: false, submitOnChange: true
                input "sleepTime", "time", title: "Sleep Time?", required: true, multiple: false, submitOnChange: true
                input "minKelvin", "number", title: "Minimum kelvin?", required: true, multiple: false, defaultValue: 1900, range: "1500..${maxKelvin?:9000}", submitOnChange: true
                input "maxKelvin", "number", title: "Maximum kelvin?", required: true, multiple: false, defaultValue: 6500, range: "$minKelvin..9000", submitOnChange: true
            }
            else    {
                paragraph "Wakeup time?\nenable auto color temperature above to set"
                paragraph "Sleep time?\nenable auto color temperature above to set"
                paragraph "Minimum kelvin?\nenable auto color temperature above to set"
                paragraph "Maximum kelvin?\nenable auto color temperature above to set"
            }
        }
    }
}

#318

is it possible the required reload wasnā€™t due to updateRulesToState(), but rather $minlevel being set to the default of 1

changing this seems to resolve it all.

range: "${minLevel}ā€¦100"
to
range: ā€œ${minLevel ?: 1}ā€¦100ā€


#319

you solved it! i think. let me give you the code block with that changeā€¦


#320

heres the revised new code:

private pageAutoLevelSettings()     {
    ifDebug("pageAutoLevelSettings")
    def wTime
    def sTime
    if (autoColorTemperature && (wakeupTime || sleepTime))     {
        if (!wakeupTime || !sleepTime)
            sendNotification("Invalid time range!", [method: "push"])
        else        {
            wTime = timeToday(wakeupTime, location.timeZone)
            sTime = timeToday(sleepTime, location.timeZone)
            if (wTime > sTime || ((sTime.getTime() - wTime.getTime()) < 18000L))
                sendNotification("Invalid time range!", [method: "push"])
        }
    }
    updateRulesToState()
    def levelRequired = (autoColorTemperature || state.ruleHasAL || minLevel || maxLevel ? true : false)
	dynamicPage(name: "pageAutoLevelSettings", title: "", install: false, uninstall: false)    {
        section("SETTINGS FOR AUTO LEVEL WHEN RULE LEVEL IS SET TO 'AL':", hideable: false)		{
/*            if    {*/
                input "minLevel", "number", title: "Minimum level?", required: levelRequired, multiple: false, defaultValue: (levelRequired ? 1 : null), range: "1..${maxLevel ?: 100}", submitOnChange: true
                input "maxLevel", "number", title: "Maximum level?", required: levelRequired, multiple: false, defaultValue: (levelRequired ? 100 : null), range: "${minLevel ?: 1}..100", submitOnChange: true
/*            }
            else    {
                input "minLevel", "number", title: "Minimum Level?", required: false, multiple: false, defaultValue: null, range: "1..${maxLevel ?: 100}", submitOnChange: true
                input "maxLevel", "number", title: "Maximum Level?", required: false, multiple: false, defaultValue: null, range: "$minLevel..100", submitOnChange: true
            }*/
        }
        section("SETTINGS FOR AUTO COLOR TEMPERATURE WHEN RULE LEVEL IS SET TO 'AL':", hideable: false)		{
            input "autoColorTemperature", "bool", title: "Auto set color temperature when using 'AL'?", required: false, multiple: false, defaultValue: false, submitOnChange: true
            if (autoColorTemperature)       {
                input "wakeupTime", "time", title: "Wakeup Time?", required: true, multiple: false, submitOnChange: true
                input "sleepTime", "time", title: "Sleep Time?", required: true, multiple: false, submitOnChange: true
                input "minKelvin", "number", title: "Minimum kelvin?", required: true, multiple: false, defaultValue: 1900, range: "1500..${maxKelvin?:9000}", submitOnChange: true
                input "maxKelvin", "number", title: "Maximum kelvin?", required: true, multiple: false, defaultValue: 6500, range: "$minKelvin..9000", submitOnChange: true
            }
            else    {
                paragraph "Wakeup time?\nenable auto color temperature above to set"
                paragraph "Sleep time?\nenable auto color temperature above to set"
                paragraph "Minimum kelvin?\nenable auto color temperature above to set"
                paragraph "Maximum kelvin?\nenable auto color temperature above to set"
            }
        }
    }
}

#321

It works with that change!

This should replace most if not all of my pistonsā€¦ Thanks a ton.

Is it possible to add power as an occupancy trigger? My living room and office pistons depend on if power greater than x remain occupied. Iā€™m watching TV or using the computer, I may not move enough to trigger the motion.


#322

thank you for working thru this with me. :pray:t4:

absolutely. this is going to be useful for other users as well.

that said you could set the tv switch as the engaged switch so no motion is required?