mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-20 07:46:37 +00:00
Add motion light trace (#8637)
This commit is contained in:
parent
67240e2339
commit
5d2afdd825
246
gallery/src/data/traces/motion-light-trace.ts
Normal file
246
gallery/src/data/traces/motion-light-trace.ts
Normal file
@ -0,0 +1,246 @@
|
|||||||
|
import { DemoTrace } from "./types";
|
||||||
|
|
||||||
|
export const motionLightTrace: DemoTrace = {
|
||||||
|
trace: {
|
||||||
|
last_action: "action/3",
|
||||||
|
last_condition: null,
|
||||||
|
run_id: "1",
|
||||||
|
state: "stopped",
|
||||||
|
timestamp: {
|
||||||
|
start: "2021-03-14T06:07:01.768006+00:00",
|
||||||
|
finish: "2021-03-14T06:07:53.287525+00:00",
|
||||||
|
},
|
||||||
|
trigger: "state of binary_sensor.pauluss_macbook_pro_camera_in_use",
|
||||||
|
unique_id: "1614732497392",
|
||||||
|
action_trace: {
|
||||||
|
"action/0": [
|
||||||
|
{
|
||||||
|
timestamp: "2021-03-14T06:07:01.771038+00:00",
|
||||||
|
changed_variables: {
|
||||||
|
trigger: {
|
||||||
|
platform: "state",
|
||||||
|
entity_id: "binary_sensor.pauluss_macbook_pro_camera_in_use",
|
||||||
|
from_state: {
|
||||||
|
entity_id: "binary_sensor.pauluss_macbook_pro_camera_in_use",
|
||||||
|
state: "off",
|
||||||
|
attributes: {
|
||||||
|
friendly_name: "Paulus’s MacBook Pro Camera In Use",
|
||||||
|
icon: "mdi:camera-off",
|
||||||
|
},
|
||||||
|
last_changed: "2021-03-14T06:06:29.235325+00:00",
|
||||||
|
last_updated: "2021-03-14T06:06:29.235325+00:00",
|
||||||
|
context: {
|
||||||
|
id: "ad4864c5ce957c38a07b50378eeb245d",
|
||||||
|
parent_id: null,
|
||||||
|
user_id: null,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
to_state: {
|
||||||
|
entity_id: "binary_sensor.pauluss_macbook_pro_camera_in_use",
|
||||||
|
state: "on",
|
||||||
|
attributes: {
|
||||||
|
friendly_name: "Paulus’s MacBook Pro Camera In Use",
|
||||||
|
icon: "mdi:camera",
|
||||||
|
},
|
||||||
|
last_changed: "2021-03-14T06:07:01.762009+00:00",
|
||||||
|
last_updated: "2021-03-14T06:07:01.762009+00:00",
|
||||||
|
context: {
|
||||||
|
id: "e22ddfd5f11dc4aad9a52fc10dab613b",
|
||||||
|
parent_id: null,
|
||||||
|
user_id: null,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
for: null,
|
||||||
|
attribute: null,
|
||||||
|
description:
|
||||||
|
"state of binary_sensor.pauluss_macbook_pro_camera_in_use",
|
||||||
|
},
|
||||||
|
context: {
|
||||||
|
id: "43b6ee9293a551c5cc14e8eb60af54ba",
|
||||||
|
parent_id: "e22ddfd5f11dc4aad9a52fc10dab613b",
|
||||||
|
user_id: null,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
"action/1": [
|
||||||
|
{
|
||||||
|
timestamp: "2021-03-14T06:07:01.875316+00:00",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
"action/2": [
|
||||||
|
{
|
||||||
|
timestamp: "2021-03-14T06:07:53.195013+00:00",
|
||||||
|
changed_variables: {
|
||||||
|
wait: {
|
||||||
|
remaining: null,
|
||||||
|
trigger: {
|
||||||
|
platform: "state",
|
||||||
|
entity_id: "binary_sensor.pauluss_macbook_pro_camera_in_use",
|
||||||
|
from_state: {
|
||||||
|
entity_id: "binary_sensor.pauluss_macbook_pro_camera_in_use",
|
||||||
|
state: "on",
|
||||||
|
attributes: {
|
||||||
|
friendly_name: "Paulus’s MacBook Pro Camera In Use",
|
||||||
|
icon: "mdi:camera",
|
||||||
|
},
|
||||||
|
last_changed: "2021-03-14T06:07:01.762009+00:00",
|
||||||
|
last_updated: "2021-03-14T06:07:01.762009+00:00",
|
||||||
|
context: {
|
||||||
|
id: "e22ddfd5f11dc4aad9a52fc10dab613b",
|
||||||
|
parent_id: null,
|
||||||
|
user_id: null,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
to_state: {
|
||||||
|
entity_id: "binary_sensor.pauluss_macbook_pro_camera_in_use",
|
||||||
|
state: "off",
|
||||||
|
attributes: {
|
||||||
|
friendly_name: "Paulus’s MacBook Pro Camera In Use",
|
||||||
|
icon: "mdi:camera-off",
|
||||||
|
},
|
||||||
|
last_changed: "2021-03-14T06:07:53.186755+00:00",
|
||||||
|
last_updated: "2021-03-14T06:07:53.186755+00:00",
|
||||||
|
context: {
|
||||||
|
id: "b2308cc91d509ea8e0c623331ab178d6",
|
||||||
|
parent_id: null,
|
||||||
|
user_id: null,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
for: null,
|
||||||
|
attribute: null,
|
||||||
|
description:
|
||||||
|
"state of binary_sensor.pauluss_macbook_pro_camera_in_use",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
"action/3": [
|
||||||
|
{
|
||||||
|
timestamp: "2021-03-14T06:07:53.196014+00:00",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
condition_trace: {},
|
||||||
|
config: {
|
||||||
|
mode: "restart",
|
||||||
|
max_exceeded: "silent",
|
||||||
|
trigger: [
|
||||||
|
{
|
||||||
|
platform: "state",
|
||||||
|
entity_id: "binary_sensor.pauluss_macbook_pro_camera_in_use",
|
||||||
|
from: "off",
|
||||||
|
to: "on",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
action: [
|
||||||
|
{
|
||||||
|
service: "light.turn_on",
|
||||||
|
target: {
|
||||||
|
entity_id: "light.elgato_key_light_air",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
wait_for_trigger: [
|
||||||
|
{
|
||||||
|
platform: "state",
|
||||||
|
entity_id: "binary_sensor.pauluss_macbook_pro_camera_in_use",
|
||||||
|
from: "on",
|
||||||
|
to: "off",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
delay: 0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
service: "light.turn_off",
|
||||||
|
target: {
|
||||||
|
entity_id: "light.elgato_key_light_air",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
id: "1614732497392",
|
||||||
|
alias: "Auto Elgato",
|
||||||
|
description: "",
|
||||||
|
},
|
||||||
|
context: {
|
||||||
|
id: "43b6ee9293a551c5cc14e8eb60af54ba",
|
||||||
|
parent_id: "e22ddfd5f11dc4aad9a52fc10dab613b",
|
||||||
|
user_id: null,
|
||||||
|
},
|
||||||
|
variables: {
|
||||||
|
trigger: {
|
||||||
|
platform: "state",
|
||||||
|
entity_id: "binary_sensor.pauluss_macbook_pro_camera_in_use",
|
||||||
|
from_state: {
|
||||||
|
entity_id: "binary_sensor.pauluss_macbook_pro_camera_in_use",
|
||||||
|
state: "off",
|
||||||
|
attributes: {
|
||||||
|
friendly_name: "Paulus’s MacBook Pro Camera In Use",
|
||||||
|
icon: "mdi:camera-off",
|
||||||
|
},
|
||||||
|
last_changed: "2021-03-14T06:06:29.235325+00:00",
|
||||||
|
last_updated: "2021-03-14T06:06:29.235325+00:00",
|
||||||
|
context: {
|
||||||
|
id: "ad4864c5ce957c38a07b50378eeb245d",
|
||||||
|
parent_id: null,
|
||||||
|
user_id: null,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
to_state: {
|
||||||
|
entity_id: "binary_sensor.pauluss_macbook_pro_camera_in_use",
|
||||||
|
state: "on",
|
||||||
|
attributes: {
|
||||||
|
friendly_name: "Paulus’s MacBook Pro Camera In Use",
|
||||||
|
icon: "mdi:camera",
|
||||||
|
},
|
||||||
|
last_changed: "2021-03-14T06:07:01.762009+00:00",
|
||||||
|
last_updated: "2021-03-14T06:07:01.762009+00:00",
|
||||||
|
context: {
|
||||||
|
id: "e22ddfd5f11dc4aad9a52fc10dab613b",
|
||||||
|
parent_id: null,
|
||||||
|
user_id: null,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
for: null,
|
||||||
|
attribute: null,
|
||||||
|
description: "state of binary_sensor.pauluss_macbook_pro_camera_in_use",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
logbookEntries: [
|
||||||
|
{
|
||||||
|
name: "Auto Elgato",
|
||||||
|
message:
|
||||||
|
"has been triggered by state of binary_sensor.pauluss_macbook_pro_camera_in_use",
|
||||||
|
source: "state of binary_sensor.pauluss_macbook_pro_camera_in_use",
|
||||||
|
entity_id: "automation.auto_elgato",
|
||||||
|
when: "2021-03-14T06:07:01.768492+00:00",
|
||||||
|
domain: "automation",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
when: "2021-03-14T06:07:01.872187+00:00",
|
||||||
|
name: "Elgato Key Light Air",
|
||||||
|
state: "on",
|
||||||
|
entity_id: "light.elgato_key_light_air",
|
||||||
|
context_entity_id: "automation.auto_elgato",
|
||||||
|
context_entity_id_name: "Auto Elgato",
|
||||||
|
context_event_type: "automation_triggered",
|
||||||
|
context_domain: "automation",
|
||||||
|
context_name: "Auto Elgato",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
when: "2021-03-14T06:07:53.284505+00:00",
|
||||||
|
name: "Elgato Key Light Air",
|
||||||
|
state: "off",
|
||||||
|
entity_id: "light.elgato_key_light_air",
|
||||||
|
context_entity_id: "automation.auto_elgato",
|
||||||
|
context_entity_id_name: "Auto Elgato",
|
||||||
|
context_event_type: "automation_triggered",
|
||||||
|
context_domain: "automation",
|
||||||
|
context_name: "Auto Elgato",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
@ -10,10 +10,11 @@ import "../../../src/components/ha-card";
|
|||||||
import "../../../src/components/trace/hat-trace";
|
import "../../../src/components/trace/hat-trace";
|
||||||
import { provideHass } from "../../../src/fake_data/provide_hass";
|
import { provideHass } from "../../../src/fake_data/provide_hass";
|
||||||
import { HomeAssistant } from "../../../src/types";
|
import { HomeAssistant } from "../../../src/types";
|
||||||
import { basicTrace } from "../data/traces/basic_trace";
|
|
||||||
import { DemoTrace } from "../data/traces/types";
|
import { DemoTrace } from "../data/traces/types";
|
||||||
|
import { basicTrace } from "../data/traces/basic_trace";
|
||||||
|
import { motionLightTrace } from "../data/traces/motion-light-trace";
|
||||||
|
|
||||||
const traces: DemoTrace[] = [basicTrace];
|
const traces: DemoTrace[] = [basicTrace, motionLightTrace];
|
||||||
|
|
||||||
@customElement("demo-automation-trace")
|
@customElement("demo-automation-trace")
|
||||||
export class DemoAutomationTrace extends LitElement {
|
export class DemoAutomationTrace extends LitElement {
|
||||||
|
@ -28,6 +28,16 @@ export interface ManualAutomationConfig {
|
|||||||
action: Action[];
|
action: Action[];
|
||||||
mode?: typeof MODES[number];
|
mode?: typeof MODES[number];
|
||||||
max?: number;
|
max?: number;
|
||||||
|
max_exceeded?:
|
||||||
|
| "silent"
|
||||||
|
| "critical"
|
||||||
|
| "fatal"
|
||||||
|
| "error"
|
||||||
|
| "warning"
|
||||||
|
| "warn"
|
||||||
|
| "info"
|
||||||
|
| "debug"
|
||||||
|
| "notset";
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface BlueprintAutomationConfig extends ManualAutomationConfig {
|
export interface BlueprintAutomationConfig extends ManualAutomationConfig {
|
||||||
|
@ -11,7 +11,7 @@ interface TraceVariables extends Record<string, unknown> {
|
|||||||
|
|
||||||
interface BaseTrace {
|
interface BaseTrace {
|
||||||
timestamp: string;
|
timestamp: string;
|
||||||
changed_variables: Record<string, unknown>;
|
changed_variables?: Record<string, unknown>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ConditionTrace extends BaseTrace {
|
export interface ConditionTrace extends BaseTrace {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user