Is it possible to trigger a rule from manually / from the command line?

Hi there,

I have read a lot of documentation and googled but still can’t figure if there is a way to manually trigger a rule that I am working on from the command line or otherwise. The closest one I came to was to set a cron trigger for every 5 minutes, but this is not ideal. Any suggestions?

Thanks!

1 Like

Great question! Not something I had thought of doing, but I can see uses.

Best option or trick I can think of is send an mqtt command from command line and trigger the rule. Or possibly flip a gpio pin if available.

You could create an item that is used for triggering the rule. Then use curl and the REST API to change its state. Or smarthome:send itemname ON from Karaf.

In addition to Scott’s suggestions, you can install the REST API Docs (under the Misc tab in PaperUI) and issue the REST command straight from the docs. That is usually what I do. You will need these docs if you go the curl route anyway.

Hi there, had the same challenge and I have solved it a bit differently.

  • create a switch as a virtual item.
  • add this switch to sitemap
  • include this switch in the script
  • trigger the script from the basic UI or iOS app

Start Karaf console and use smarthome:<cmd> commands (send, update, status) to change the item the rule triggers upon.