Hello,
Since OH5.1.1 the following inline script rule not longer works. (was running fine in OH5.0.2)
configuration: {}
triggers:
- id: "1"
label: A Thing Changes Status
description: Triggers when any Thing changes status
configuration:
topic: openhab/things/**
types: ThingStatusInfoChangedEvent
source: ""
payload: ""
type: core.GenericEventTrigger
conditions: []
actions:
- inputs: {}
id: "2"
configuration:
type: application/javascript
script: >
console.info(">DBUG INFO");
console.info(">event.topic " + event.topic);
console.info(">event.source " + event.source);
console.info(">event.eventName " + event.eventName);
console.info(">event.payload" + event.payload);
var thingId = event.topic.split('/')[2];
var thingState = JSON.parse(event.payload)[0].status;
var thingStateDetail = JSON.parse(event.payload)[0].statusDetail;
var thingStateDescr = JSON.parse(event.payload)[0].description;
console.info(">DBUG INFO " + thingId + " " + thingState + " " +
thingStateDetail + " " + thingStateDescr);
type: script.ScriptAction
The following is shown in the console:
11:57:10.407 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing ‘evohome:heatingzone:home:5371702’ changed from INITIALIZING to OFFLINE (COMMUNICATION_ERROR): TempZoneActuatorLowBattery
11:57:10.407 [INFO ] [ation.jsscripting.rule.Temp_thingrule] - >DBUG INFO
11:57:10.408 [INFO ] [ation.jsscripting.rule.Temp_thingrule] - >event.topic undefined
11:57:10.408 [INFO ] [ation.jsscripting.rule.Temp_thingrule] - >event.source undefined
11:57:10.408 [INFO ] [ation.jsscripting.rule.Temp_thingrule] - >event.eventName ThingStatusInfoChangedEvent
11:57:10.409 [INFO ] [ation.jsscripting.rule.Temp_thingrule] - >event.payload[object Object],[object Object]
So the event.topic and event.payload are not being returned.
5.1 release notes mention:
JavaScript Automation
- The event object in UI-based environments has been aligned with the file-based event object. Properties are now pure JavaScript types and property names have changed. Blockly users need to resave their scripts.
Where can I find more details on the above changes (JavaScript types and property names)?
Any help would be appreciated. ![]()