Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial 'selection' states #29

Closed
d0t101101 opened this issue Jan 11, 2016 · 7 comments
Closed

Initial 'selection' states #29

d0t101101 opened this issue Jan 11, 2016 · 7 comments
Labels
Milestone

Comments

@d0t101101
Copy link

Migrating this issue from G+:

I have a variety of 'scene selectors' which could be considered 'mode's in Rotini terms. This is used for house/lighting/security/IP camera modes. For each selection (using mode widget, backed by a number item and related maps), the widget usually shows up 'blank' initially in Rotini (just a '-'), but works fine in HABDroid consistently. Clicking on the empty widgets immediately crashes Rotini. If I switch to HABDroid and set another state for each, Rotini will works fine going forward.

It seems Rotini should assume the first selection if there is no value for the number/selection state available...

@igorgladkov
Copy link
Owner

Can you post example of sitemap/item config that has the issue?

@d0t101101
Copy link
Author

Sure. Note ALL of my modes that use mappings experience this. For example, here is my item for switching my Onkyo AVR's network services:

Number onkyoNETService "Service" { onkyo="INIT:hometheater:#NSVQST, *:hometheater:#NSV%02X0"}

And corresponding sitemap entry:

Frame label="{widget:mode}" { Selection item=onkyoNETService mappings=[0="Media Server (DLNA)", 1=Favorite, 2=vTuner, 3=SIRIUS, 4=Pandora, 5=Rhapsody, 6="Last.fm", 8=Slacker, 14="TuneIn Radio"] }

@d0t101101
Copy link
Author

A work around for this is to create a rule which sets the states, so they are not undefined:

rule "Initialize Scene states at system startup"
when 
    System started
then        
    postUpdate(Scene_General, 0)
    postUpdate(Scene_Lighting, 0)
    postUpdate(Scene_Security, 0)
    postUpdate(Scene_Security_Cameras, 0)
            postUpdate(onkyoNETService, 4)
end

In any case I think Rotini should be able to handle undefined items without crashing :)

@igorgladkov
Copy link
Owner

Undefined states are handled generally in the app, it's just mode widget has few non-tested things, so it is fragile. So if there are other widgets that brake with undefined states, do let me know.

@d0t101101
Copy link
Author

Got you. So far so good - no other problems incurred.

Another approach is to persist the states and restore them upon start via db4o.persist like so:

//persist scenes     
Scene_General,Scene_Lighting,Scene_Security,Scene_Security_Cameras,onkyoNETService : strategy = everyChange, restoreOnStartup

@igorgladkov
Copy link
Owner

@d0t101101 While crash on tap should be obviously fixed, I don't think it should show first option by default. To me, behavior of openhab is confusing, since it was showing me something which wasn't actually true. If no value selected because it is uninitialized, I would want to know about it, rather than think something is selected.

@igorgladkov igorgladkov added this to the 0.2.19 milestone Jan 14, 2016
@igorgladkov
Copy link
Owner

Fixed 0.2.19

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants