How to works "Subscription to events"?

  • Platform information:
    • Hardware: Rasberry PI 4
    • OS: openHABian
    • Java Runtime Environment: OpenJDK Java 8
    • openHAB version: 1.5
  • Issue of the topic: Subscription to events

Hi at all!
I need to receive the events generated by a particular thing.

i found this api:

// ThingStatusInfoChangedEvent - The status of a thing changed.
curl "http://{openHAB_IP}:8080/rest/events?topics=smarthome/things/{thingUID}/statuschanged"

i don’t have found other information about this api. How to work?

The output is json?
Where i receive notification ? (is an Observer Pattern ?)


Use SSE subscription. Works very well.

Where do you need this? If you’re not building a binding, just create a rule with a Thing status trigger. Or link an Item to the Channel and trigger the rule on an Item state change.

This would require an OH upgrade :wink:

I need to receive event in an android application.
I’m searching for trigger event form item end receive in android app. For now only solution is an item with a rule with action (SendHttp…) and recive this with Android app.
I can’t using cloud for notify the status change.

Then follow Sebastian’s advice and look into SSE. You’ll find it used in Habdroid.

1 Like