Trigger an REST API Request (Rule Change) within an widget

Hello everyone,

I am using openHab 3.0 and I am creating a new Widget with:

  • Angular
  • HTML
  • CSS
  • F7 Framework components

But how can I trigger a rule change or create a new rule within a Widget (via REST API requests?)

I know a widget is running on the frontend side and the rest API stuff is on the backend side, but should I trigger a cmd to reach my goal

or

sending POST / GET data of a form is the better way, to fire some Rest API requests out?

Maybe anyone got another approach?

Thx for any hints :slight_smile:

Cheers

Alex

Normally, you’d create an Item like Trigger_my_Rule unlinked to any devices, put a button on your widget that sends ON to that, and have a rule listening for commands to it. The rule can then do whatever.

1 Like

thx for your reply :slight_smile:

Would you suggest this way also for the following scenario:

I want to change my shutter up and down times within a widget like a scheduler.

What you think?

Anything you send from UI has to go to a single Item, so there aren’t that many choices.

Search this forum for “alarm clock” and similar for scheduling UI ideas. Use the Ephemeris feature for more complex working, like different each day.

I’ve got some stuff on a very crude system; an Item holds “minute of day” as an integer, a transform displays this on UI in HH:MM “clock” form, a setpoint widget allows to bump and down in 10 minute intervals, and a rule does the actual scheduling/re-scheduling when the Item gets a command, or at boot time.

thx for your great answer :slight_smile:

you saved my dayyyy :slight_smile: