openhab / org.openhab.ui.habmin

HABmin - a graphical user interface for openHAB 2
231 stars 91 forks source link

recent build changed the value returned from action buttons #142

Closed marcelrv closed 8 years ago

marcelrv commented 8 years ago

Hi Chris,

seems like the latest habmin is changing the returned value from a action button from 0 to the default value. That's bit tricky as now it is hard to see if a value is changed esp as paperUI still is sending all the values as changed.

Sofar I was testing if the update was not the default value (as than the updates comes from paperUI) and run the action. Now I don't know how to distinguish anymore between a true trigger (as from Habmin) and a update all (as from PaperUI)

cdjackson commented 8 years ago

What I ended up doing in zwave to avoid unknown values, and allow change to be detected is to send a known value (i.e. the default) and then to test that this is the received value in the binding. In ZWave, when I receive the value, I set it to an empty string. I’ve not tested against PaperUI, but then PaperUI should show an empty string, and unless you type in the default value, it shouldn’t trigger.

I wanted to send a known value, and as I couldn’t think of another way to be sure the binding had control over this value, I used the default. Ultimately, as discussed elsewhere with Kai, this needs to be better defined as it’s a bit of a hack at the moment.

marcelrv commented 8 years ago

But unless a user is changing the property, it's initial value will be the default value. Hence the first time the user would use paperUI to make an update it would seem that the button is pushed, as that is what paperUI would be sending (paperUI sends all the config parameters as updates). ​This is esp dangerous as the buttons do 'special stuff' like deleting the configuration....

I would think you want to send any value but the default value cuz that would be already there.

I agree the action buttons need to be better defined, as than it can be consistent across UI's.

cdjackson commented 8 years ago

In Zwave I avoid the default value, however I'm happy to change. We can use any value I guess - it just should be known, and not 0...

Shall we assume these are integers and I'll just make up a number, or do you have a number you'd like ;)

Sent from my iPhone

On 20 Mar 2016, at 14:34, Marcel notifications@github.com wrote:

But unless a user is changing the property, it's initial value will be the default value. Hence the first time the user would use paperUI to make an update it would seem that the button is pushed, as that is what paperUI would be sending (paperUI sends all the config parameters as updates). ​This is esp dangerous as the buttons do 'special stuff' like deleting the configuration....

I would think you want to send any value but the default value cuz that would be already there.

I agree the action buttons need to be better defined, as than it can be consistent across UI's. — You are receiving this because you commented. Reply to this email directly or view it on GitHub

marcelrv commented 8 years ago

Great. indeed let's treat them as integers, suggest to make it a +1

2016-03-21 8:30 GMT+01:00 Chris Jackson notifications@github.com:

In Zwave I avoid the default value, however I'm happy to change. We can use any value I guess - it just should be known, and not 0...

Shall we assume these are integers and I'll just make up a number, or do you have a number you'd like ;)

Sent from my iPhone

On 20 Mar 2016, at 14:34, Marcel notifications@github.com wrote:

But unless a user is changing the property, it's initial value will be the default value. Hence the first time the user would use paperUI to make an update it would seem that the button is pushed, as that is what paperUI would be sending (paperUI sends all the config parameters as updates). ​This is esp dangerous as the buttons do 'special stuff' like deleting the configuration....

I would think you want to send any value but the default value cuz that would be already there.

I agree the action buttons need to be better defined, as than it can be consistent across UI's. — You are receiving this because you commented.

Reply to this email directly or view it on GitHub

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/cdjackson/HABmin2/issues/142#issuecomment-199156610

cdjackson commented 8 years ago

You mean use 1 as the value? I’d probably prefer to make it a longer number - just to really try and avoid errors. Maybe 1234? Easy to remember, easy to type, but you can’t hit it accidentally in PaperUI.

On 21 Mar 2016, at 09:40, Marcel notifications@github.com wrote:

Great. indeed let's treat them as integers, suggest to make it a +1

2016-03-21 8:30 GMT+01:00 Chris Jackson notifications@github.com:

In Zwave I avoid the default value, however I'm happy to change. We can use any value I guess - it just should be known, and not 0...

Shall we assume these are integers and I'll just make up a number, or do you have a number you'd like ;)

Sent from my iPhone

On 20 Mar 2016, at 14:34, Marcel notifications@github.com wrote:

But unless a user is changing the property, it's initial value will be the default value. Hence the first time the user would use paperUI to make an update it would seem that the button is pushed, as that is what paperUI would be sending (paperUI sends all the config parameters as updates). ​This is esp dangerous as the buttons do 'special stuff' like deleting the configuration....

I would think you want to send any value but the default value cuz that would be already there.

I agree the action buttons need to be better defined, as than it can be consistent across UI's. — You are receiving this because you commented.

Reply to this email directly or view it on GitHub

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/cdjackson/HABmin2/issues/142#issuecomment-199156610

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/cdjackson/HABmin2/issues/142#issuecomment-199177117

marcelrv commented 8 years ago

that's fine as well :)

2016-03-21 12:40 GMT+01:00 Chris Jackson notifications@github.com:

You mean use 1 as the value? I’d probably prefer to make it a longer number - just to really try and avoid errors. Maybe 1234? Easy to remember, easy to type, but you can’t hit it accidentally in PaperUI.

On 21 Mar 2016, at 09:40, Marcel notifications@github.com wrote:

Great. indeed let's treat them as integers, suggest to make it a +1

2016-03-21 8:30 GMT+01:00 Chris Jackson notifications@github.com:

In Zwave I avoid the default value, however I'm happy to change. We can use any value I guess - it just should be known, and not 0...

Shall we assume these are integers and I'll just make up a number, or do you have a number you'd like ;)

Sent from my iPhone

On 20 Mar 2016, at 14:34, Marcel notifications@github.com wrote:

But unless a user is changing the property, it's initial value will be the default value. Hence the first time the user would use paperUI to make an update it would seem that the button is pushed, as that is what paperUI would be sending (paperUI sends all the config parameters as updates). ​This is esp dangerous as the buttons do 'special stuff' like deleting the configuration....

I would think you want to send any value but the default value cuz that would be already there.

I agree the action buttons need to be better defined, as than it can be consistent across UI's. — You are receiving this because you commented.

Reply to this email directly or view it on GitHub

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub < https://github.com/cdjackson/HABmin2/issues/142#issuecomment-199156610>

— You are receiving this because you commented. Reply to this email directly or view it on GitHub < https://github.com/cdjackson/HABmin2/issues/142#issuecomment-199177117>

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/cdjackson/HABmin2/issues/142#issuecomment-199236209

marcelrv commented 8 years ago

Hi Chris, Was thinking about alternative solution as 1234 is not very 'elegant'. Maybe a possibility is to have in the config a specific option value e.g. execute containing the value to be send when the button is clicked. That way we can also render it nicely in paperUI (user can change to execute) and it feels bit less as a hack.

e.g <option value="EXECUTE">1234</option>

cdjackson commented 8 years ago

Agreed - this is more elegant.

cdjackson commented 8 years ago

I've modified HABmin to send the first option...