[ { "id": "Office Door Light", "automation": "- alias: Office Door Light\n description: Automation controlling the 'on-call' light at the office door\n triggers:\n - trigger: state\n entity_id:\n - input_boolean.toggl_task_running\n id: task-running\n to: 'on'\n - trigger: state\n entity_id:\n - input_boolean.toggl_task_running\n to: 'off'\n id: task-stopped\n conditions: []\n actions:\n - if:\n - condition: trigger\n id:\n - task-running\n then:\n - if:\n - condition: state\n entity_id: input_boolean.toggl_task_meeting\n state: 'on'\n then:\n - action: light.turn_on\n metadata: {}\n data:\n rgb_color:\n - 255\n - 38\n - 0\n brightness_pct: 100\n target:\n entity_id: light.atom_matrix_dooralertm5\n alias: Turn M5 Red\n else:\n - action: light.turn_on\n metadata: {}\n data:\n rgb_color:\n - 0\n - 249\n - 0\n brightness_pct: 100\n target:\n entity_id: light.atom_matrix_dooralertm5\n alias: Turn M5 Green\n alias: Turn M5 On with a colour depending on if in a meeting or not\n else:\n - action: light.turn_off\n metadata: {}\n data: {}\n target:\n entity_id: light.atom_matrix_dooralertm5\n mode: single", "config": [ { "name": "toggl task running", "room": "office", "type": "input_boolean", "id": { "entity_id": "input_boolean.toggl_task_running", "device_id": null } }, { "name": "atom matrix door alert m5", "room": "office", "type": "light", "id": { "entity_id": "light.atom_matrix_dooralertm5", "device_id": null } }, { "name": "toggl task meeting", "room": "office", "type": "input_boolean", "id": { "entity_id": "input_boolean.toggl_task_meeting", "device_id": null } } ] }, { "id": "Toggl Webhook Handler", "automation": "- alias: Toggl Webhook Handler\n description: 'Automation for setting input helper state based on toggl webhook events. '\n triggers:\n - trigger: webhook\n allowed_methods:\n - POST\n - PUT\n local_only: false\n webhook_id: toggl-webhook-handler-\n actions:\n - variables:\n payload: '{{ trigger.json.payload }}'\n description: '{{ payload.description | default(''No Description'') }}'\n meeting: '{{ ''meeting'' in payload.tags }}'\n running: '{{ not payload.stop }}'\n duration: '{{ ((as_timestamp(now()) - as_timestamp(payload.start)) if payload.start\n else 0) / 60 | round(1) }}'\n - data:\n entity_id: input_text.toggl_task_name\n value: '{{ description }}'\n action: input_text.set_value\n - data:\n entity_id: input_number.toggl_task_duration_min\n value: '{{ duration }}'\n action: input_number.set_value\n - alias: If Running\n if:\n - condition: template\n value_template: '{{ running }}'\n then:\n - action: input_boolean.turn_on\n metadata: {}\n data: {}\n target:\n entity_id:\n - input_boolean.toggl_task_running\n else:\n - action: input_boolean.turn_off\n metadata: {}\n data: {}\n target:\n entity_id:\n - input_boolean.toggl_task_running\n - if:\n - condition: template\n value_template: '{{ meeting }}'\n then:\n - action: input_boolean.turn_on\n metadata: {}\n data: {}\n target:\n entity_id: input_boolean.toggl_task_meeting\n else:\n - action: input_boolean.turn_off\n metadata: {}\n data: {}\n target:\n entity_id: input_boolean.toggl_task_meeting\n alias: If Meeting", "config": [ { "name": "toggl task running", "room": "office", "type": "input_boolean", "id": { "entity_id": "input_boolean.toggl_task_running", "device_id": null } }, { "name": "toggl task meeting", "room": "office", "type": "input_boolean", "id": { "entity_id": "input_boolean.toggl_task_meeting", "device_id": null } }, { "name": "toggl task name", "room": "office", "type": "input_text", "id": { "entity_id": "input_text.toggl_task_name", "device_id": null } }, { "name": "toggl task duration min", "room": "office", "type": "input_number", "id": { "entity_id": "input_number.toggl_task_duration_min", "device_id": null } } ] } ]