Minor Edit

This commit is contained in:
ccostan 2018-03-16 01:23:42 -04:00
parent adb22d4c07
commit 412fab9528
1 changed files with 66 additions and 66 deletions

View File

@ -48,69 +48,69 @@ automation:
] %}
{{ pictures|random }}
- service: script.notify_engine
data_template:
value1: 'Check the MQTT Dump'
value2: '/dump/{{ trigger.platform }}'
who: 'carlo'
- service: mqtt.publish
data_template:
topic: '/dump/{{ trigger.platform }}'
retain: false
payload: >-
{%- macro dumpState(statePrefix, stateObj) -%}
{{statePrefix ~ ": "}} {{- stateObj.state }}{{- "\n" -}}
{{statePrefix ~ ".entity_id: "}} {{- stateObj.entity_id }}{{- "\n" -}}
{{statePrefix ~ ".domain: "}} {{- stateObj.domain }}{{- "\n" -}}
{{statePrefix ~ ".object_id: "}} {{- stateObj.object_id }}{{- "\n" -}}
{{statePrefix ~ ".name: "}} {{- stateObj.name }}{{- "\n" -}}
{{statePrefix ~ ".last_updated: "}} {{- stateObj.last_updated }}{{- "\n" -}}
{{statePrefix ~ ".last_changed: "}} {{- stateObj.last_changed }}{{- "\n" -}}
{%- for attrib in stateObj.attributes | sort() %}
{%- if attrib is defined -%}
{{- statePrefix ~ ".attributes." ~ attrib ~ ": " -}} {{- stateObj.attributes[attrib] -}}
{{- "\n" -}}
{%- endif -%}
{%- endfor -%}
{%- endmacro -%}
{% set p = trigger.platform %}
{{"trigger.platform: "}} {{ p }}{{- "\n" -}}
{%- if p == "mqtt" -%}
{{"trigger.topic: "}} {{ trigger.topic }}{{- "\n" -}}
{{"trigger.payload: "}} {{ trigger.payload }}{{- "\n" -}}
{{"trigger.payload_json: "}} {{ trigger.payload_json }}{{- "\n" -}}
{{"trigger.qos: "}} {{ trigger.qos }}{{- "\n" -}}
{%- endif -%}
{%- if p == "event" or p == "sun" or p == "zone" -%}
{{"trigger.event: "}} {{ trigger.event }}{{- "\n" -}}
{%- endif -%}
{%- if p == "numeric_state" -%}
{{"trigger.above: "}} {{ trigger.above }}{{- "\n" -}}
{{"trigger.below: "}} {{trigger.below }}{{- "\n" -}}
{%- endif -%}
{%- if p == "state" -%}
{{"trigger.for: "}} {{ trigger.for }}{{- "\n" -}}
{%- endif -%}
{%- if p == "time" -%}
{{"trigger.now: "}} {{ trigger.now }}{{- "\n" -}}
{%- endif -%}
{%- if p == "zone" -%}
{{"trigger.zone: "}} {{ trigger.zone }}{{- "\n" -}}
{%- endif -%}
{%- if p == "state" or p == "numeric_state" or p == "template" or p == "zone" -%}
{{"trigger.entity_id: "}} {{ trigger.entity_id }}{{- "\n" -}}{{- "\n" -}}
{{"trigger.from_state: "}} {{- "\n" -}}
-------------------{{- "\n" -}}
{{ dumpState("trigger.from_state", trigger.from_state) }} {{- "\n" -}}
trigger.to_state:{{- "\n" -}}
-----------------{{- "\n" -}}
{{ dumpState("trigger.to_state", trigger.to_state) }}
{%- endif -%}
# - service: script.notify_engine
# data_template:
# value1: 'Check the MQTT Dump'
# value2: '/dump/{{ trigger.platform }}'
# who: 'carlo'
# - service: mqtt.publish
# data_template:
# topic: '/dump/{{ trigger.platform }}'
# retain: false
# payload: >-
# {%- macro dumpState(statePrefix, stateObj) -%}
# {{statePrefix ~ ": "}} {{- stateObj.state }}{{- "\n" -}}
# {{statePrefix ~ ".entity_id: "}} {{- stateObj.entity_id }}{{- "\n" -}}
# {{statePrefix ~ ".domain: "}} {{- stateObj.domain }}{{- "\n" -}}
# {{statePrefix ~ ".object_id: "}} {{- stateObj.object_id }}{{- "\n" -}}
# {{statePrefix ~ ".name: "}} {{- stateObj.name }}{{- "\n" -}}
# {{statePrefix ~ ".last_updated: "}} {{- stateObj.last_updated }}{{- "\n" -}}
# {{statePrefix ~ ".last_changed: "}} {{- stateObj.last_changed }}{{- "\n" -}}
# {%- for attrib in stateObj.attributes | sort() %}
# {%- if attrib is defined -%}
# {{- statePrefix ~ ".attributes." ~ attrib ~ ": " -}} {{- stateObj.attributes[attrib] -}}
# {{- "\n" -}}
# {%- endif -%}
# {%- endfor -%}
# {%- endmacro -%}
#
# {% set p = trigger.platform %}
# {{"trigger.platform: "}} {{ p }}{{- "\n" -}}
#
# {%- if p == "mqtt" -%}
# {{"trigger.topic: "}} {{ trigger.topic }}{{- "\n" -}}
# {{"trigger.payload: "}} {{ trigger.payload }}{{- "\n" -}}
# {{"trigger.payload_json: "}} {{ trigger.payload_json }}{{- "\n" -}}
# {{"trigger.qos: "}} {{ trigger.qos }}{{- "\n" -}}
# {%- endif -%}
#
# {%- if p == "event" or p == "sun" or p == "zone" -%}
# {{"trigger.event: "}} {{ trigger.event }}{{- "\n" -}}
# {%- endif -%}
#
# {%- if p == "numeric_state" -%}
# {{"trigger.above: "}} {{ trigger.above }}{{- "\n" -}}
# {{"trigger.below: "}} {{trigger.below }}{{- "\n" -}}
# {%- endif -%}
#
# {%- if p == "state" -%}
# {{"trigger.for: "}} {{ trigger.for }}{{- "\n" -}}
# {%- endif -%}
#
# {%- if p == "time" -%}
# {{"trigger.now: "}} {{ trigger.now }}{{- "\n" -}}
# {%- endif -%}
#
# {%- if p == "zone" -%}
# {{"trigger.zone: "}} {{ trigger.zone }}{{- "\n" -}}
# {%- endif -%}
#
# {%- if p == "state" or p == "numeric_state" or p == "template" or p == "zone" -%}
# {{"trigger.entity_id: "}} {{ trigger.entity_id }}{{- "\n" -}}{{- "\n" -}}
# {{"trigger.from_state: "}} {{- "\n" -}}
# -------------------{{- "\n" -}}
# {{ dumpState("trigger.from_state", trigger.from_state) }} {{- "\n" -}}
# trigger.to_state:{{- "\n" -}}
# -----------------{{- "\n" -}}
# {{ dumpState("trigger.to_state", trigger.to_state) }}
# {%- endif -%}