-
-
Notifications
You must be signed in to change notification settings - Fork 31
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
[items] Item: Add sendIncreaseCommand/sendDecreaseCommand methods #371
[items] Item: Add sendIncreaseCommand/sendDecreaseCommand methods #371
Conversation
@mueller-ma You can download the dist-without-license artifact from https://github.com/openhab/openhab-js/actions/runs/10271819868?pr=371 and put the openhab.js file contained in the ZIP into the $OPENHAB_CONF/automation/js/node_modules folder. WRT to naming: increaseValueTo and decreaseValueTo are short, but not really in line with sendCommand, sendToggleCommand, sendCommandIfDifferent. But sendIncreaseValueToCommand are too long? |
What about sendIncreaseCommand()? |
Sounds good - have you been able to give this PR a try? |
I tested |
I cannot reproduce this issue with basic Dimmer and Number Items (means no metadata, just a Item with a name). If you have changed the dimmer to 100 and sendIncreaseCommand right afterwards, i.e. by having a script that does these two steps after each other, it may be the case that a wrong command is sent because the Item state hasn't been updated yet. This works just fine for me: var item = items.test_dimmer
item.sendCommand(100)
java.lang.Thread.sleep(500)
item.sendIncreaseCommand(10)
java.lang.Thread.sleep(500)
item.sendDecreaseCommand(15)
java.lang.Thread.sleep(500)
item.sendIncreaseCommand(50)
java.lang.Thread.sleep(500)
item.sendIncreaseCommand(10) Note the sleeps to avoid the above mentioned issue. |
You can enable debug logging (just added it) by setting the log level of |
9234ac6
to
fdd8114
Compare
Signed-off-by: Florian Hotze <[email protected]>
… changes Signed-off-by: Florian Hotze <[email protected]>
Signed-off-by: Florian Hotze <[email protected]>
Signed-off-by: Florian Hotze <[email protected]>
Signed-off-by: Florian Hotze <[email protected]>
Signed-off-by: Florian Hotze <[email protected]>
fdd8114
to
7d007ef
Compare
@mueller-ma Let me know when you have been able to test it again. |
Now it seems to work. Maybe I did something wrong with downloading the library the first time. Thank you for this PR 👍 |
Signed-off-by: Florian Hotze <[email protected]>
Signed-off-by: Florian Hotze <[email protected]>
Closes #369.
Also:
Item::getToggleState
method private.Item::getToggleState
/Item::sendToggleCommand
method toItem.type
changes from a previous PRItem::numericState
.