@ajclarkson/homerun 0.0.1-edge.db0717b → 0.0.1-edge.f1d8985
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -51,7 +51,7 @@ export class ApiServer {
|
|
|
51
51
|
id: a.id,
|
|
52
52
|
location: a.location,
|
|
53
53
|
subsystem: a.subsystem,
|
|
54
|
-
|
|
54
|
+
triggers: a.triggers.map(serializeTrigger),
|
|
55
55
|
}));
|
|
56
56
|
json(res, 200, automations);
|
|
57
57
|
}
|
|
@@ -100,6 +100,12 @@ export class ApiServer {
|
|
|
100
100
|
req.on('close', unsubscribe);
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
|
+
function serializeTrigger(trigger) {
|
|
104
|
+
if (trigger.type === 'state_changed' && trigger.entity instanceof RegExp) {
|
|
105
|
+
return { ...trigger, entity: trigger.entity.toString() };
|
|
106
|
+
}
|
|
107
|
+
return trigger;
|
|
108
|
+
}
|
|
103
109
|
function json(res, status, body) {
|
|
104
110
|
const payload = JSON.stringify(body);
|
|
105
111
|
res.writeHead(status, { 'Content-Type': 'application/json' });
|
package/dist/src/testing.d.ts
CHANGED
package/dist/src/testing.js
CHANGED
|
@@ -9,8 +9,8 @@ export function testAutomation(automation, options) {
|
|
|
9
9
|
entity_id: entityId,
|
|
10
10
|
state: entry.state,
|
|
11
11
|
attributes: entry.attributes ?? {},
|
|
12
|
-
last_changed: '',
|
|
13
|
-
last_updated: '',
|
|
12
|
+
last_changed: entry.last_changed ?? '',
|
|
13
|
+
last_updated: entry.last_updated ?? '',
|
|
14
14
|
};
|
|
15
15
|
};
|
|
16
16
|
const haContext = {
|