OH3 Widget Action: Command multiple items and commands

I have a button in a custom widget, which sends a command to an item.
I was wondering if for the button if i can send multiple commands to multiple items.

This would send a pincode to 1 item. and Disarm to another item.
Is this possible?

A rule would normally be used for that kind of action, offering more control e.g. check PIN before sending DISARM

I have that. But the issue is. Whenever I press a button it adds to vars.pincode
Which is a variable inside the widget only.
I have an item called keypad string and an item called alarm mode.

I would have to pass the variable onto the rule. Is this possible.

You could create a proxy/dummy item that is a string type which you set that from your widget. You would then have a rule to monitor a change on the item and can parse the string retrieved so the Pin can be checked /set before commanding the real item.

1 Like

Yeah. thats basically what i have.
But, when i click disarm, i want it to send

  1. var.pincode to item.keypadstring
  2. OFF to item.currentmode

So as you can see, I want to send two different commands to two different items when pressing one button.

You canā€™t.
You can send what you like to one Item, have a rule decode it if you have packed more than one bit of info into that one command, and then have the rule do as many other actions as you like.

thanks. thats what i wanted to know. can item actions be linked or not.
I guess ill find another way.
Thanks

Weā€™ve told you the way you can do it. Have your widget pack all your info into one string command, send it to a proxy Item, have a rule unpack commands to the proxy and do whatever.

Strictly speaking, you can send UI commands to multiple Items almost simultaneously, by putting them in a Group and commanding the Group Item.
I donā€™t think that helps you, because the same command will be sent to all members.

I appreciate the help. Yes, you have told me ā€˜howā€™ i can do it. But i was asking if i can send multiple commands to multiple items. Im trying to minimise proxy items and rules where possible. So I am just looking for the keycode in the widget itself, if it matches, then i am sending ARM or DISARM commands to my alarm item.

For now this will do.

Thank you

off-topic - There is a security issue there, you need to hold the correct PIN in the UI (where it can be hacked by anyone) or a hacker can just bypass PIN altogether and send DISARM.

Itā€™s part of the reason weā€™re telling you to send the keycode and check the PIN at the host (which we would hope is more secure).

Either way. Its a security issue anyway.
If someone gains access to my system. They can see the keycode in the rule anyway.

Im not sure how i can encript or another way to do this.
Any ideas?

My alarm is run by openhab. I have konnected panels which send door/window/sensor states. And openhab runs the mode either armed or disarmed, if any window/door opens when its sent to armed, it sounds sirens and sends notifications.

All controlled through openhab. How would you suggest i make this more secure?

I would create a single KeyPadEntry item that you populate from the UI when the Arm/Disarm button is. This can then be checked by a Rule before actually setting the Armed / Disarmed state. In addition, I would hold the value for checking the keypad entry to in another item which could be set at startup so that it is not really hard coded into either rule or ui - a shell script could even set this making it a bit more hidden.

Sure, but thatā€™s then on your box within your private network. On a phone, itā€™s out in the wild. Maybe you donā€™t use any off-site access to openHAB so it isnā€™t a problem for you, but it would be a bad thing for most users.

Thatā€™s okay, and certainly better than nothing. We must accept youā€™re not going to able to fully emulate commercial security systems. but there are some precautions that can be taken. If your box accepts no internet connections, all is well.

If they can get past my nginx, and also past my openhab authentication. then they can see the widget with the keycode. Until that, they cannot access it. Am i right?

Not sure if im following too well.

I dunno where your widget is allowed to go, just so long as you are thinking about it.

Me, Iā€™d never have any kind of remotely accessible ā€œalarm disableā€ feature. Though I appreciate that isnā€™t going to work when itā€™s all controlled from some tablet or suchlike, and thereā€™s no dedicated alarm keypad or hardware dongle type affair.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.