Closed SierraNL closed 6 years ago
It will be fine for some bindings too. For amazon dash button or Xiaomi mi Home, for some things you only have event triggered and you can't associate item to this channel.
On OpenHAB SSE when you see all the bus you have such messages :
event: message data: {"topic":"smarthome/channels/mihome:sensor_switch:xxx:xxx:button/triggered","payload":"{\"event\":\"SHORT_PRESSED\",\"channel\":\"mihome:sensor_switch:xxx:xxx:button\"}","type":"ChannelTriggeredEvent"}
event: message data: {"topic":"smarthome/channels/mihome:sensor_switch:xxx:xxx:button/triggered","payload":"{\"event\":\"DOUBLE_PRESSED\",\"channel\":\"mihome:sensor_switch:xxx:xxx:button\"}","type":"ChannelTriggeredEvent"}
Thanks for the info Fabien! Which url did you use to obtain these events ? Did you find more documentation on OpenHAB SSE ?
I am also very interested in having events in your node. It would allow to have all rules in node-red, which is much more easy to edit. I can help in testing and maybe develop.
I'm using this URL : http://openhab.lan:8080/rest/events?topics=smarthome/channels you can have more information here : https://www.eclipse.org/smarthome/documentation/features/events.html and here : https://www.eclipse.org/smarthome/documentation/features/rest.html
Thanks for the valuable links, Fabien. I will implement a new 'openhab2-events' node for this purpose.
Did you start working on it ? I will have some time to work on it.
I checked a simple version of a new node 'openhab2-events' in in github. It subscribes to all events. Goal is in a future version to offer filtering on event type and entity name/id.
You forgot to update package.json with new version number so I can't update with node-red UI. Just a question, why did you use @joeybaker fork ? The most important part (ie issues with multiple reconnect) are in the original branch (https://github.com/EventSource/eventsource) @joeybaker branch doesn't seem to bu up to date.
I updated the version number to 1.1.0.
And a valid remark regarding the eventsource library. I'll try to switch asap.
NOK on npmjs so it's not possible to update via node-red palette.
Sorry... Only GitHub AST for now. I'll try to release on npm asap.
Sorry... Only GitHub AST for now. I'll try to release on npm asap.
updated in npm ...
ok it works fine.
Within OpenHAB 2 you can also created rules on Status changes to Things, beside Items: http://docs.openhab.org/configuration/rules-dsl.html#thing-based-triggers
I would really like to use this in the node-red rules. For instance I have a lot of Hue White bulbs that go ONLINE or OFFLINE via the normal light switches. And I can use these triggers to start a rule.
Things are their status options: http://docs.openhab.org/concepts/things.html