sensor:
- platform: mqtt
name: "jieqi"
state_topic: "/node-red/jieqi/"
value_template: '{{ value_json.jieqi }}'
- platform: mqtt
name: "cnday"
state_topic: "/node-red/jieqi/"
value_template: "{{ value_json.cnday }}"
- platform: mqtt
name: "suit"
state_topic: "/node-red/jieqi/"
value_template: "{{ value_json.suit }}"
- platform: mqtt
name: "taboo"
state_topic: "/node-red/jieqi/"
value_template: "{{ value_json.taboo }}"
- platform: mqtt
name: "festivallist"
state_topic: "/node-red/jieqi/"
value_template: "{{ value_json.festivalList }}"
- platform: mqtt
name: "animal"
state_topic: "/node-red/jieqi/"
value_template: "{{ value_json.animal }}"
- platform: mqtt
name: "week"
state_topic: "/node-red/jieqi/"
value_template: "{{ value_json.week }}"
- platform: template
sensors:
week2:
friendly_name: '星期'
value_template: >-
{% if is_state('sensor.week', 'Monday') %}
星期一
{% elif is_state('sensor.week', 'Tuesday') %}
星期二
{% elif is_state('sensor.week', 'Wednesday') %}
星期三
{% elif is_state('sensor.week', 'Thursday') %}
星期四
{% elif is_state('sensor.week', 'Friday') %}
星期五
{% elif is_state('sensor.week', 'Saturday') %}
星期六
{% elif is_state('sensor.week', 'Sunday') %}
星期天
{% else %}
failed
{% endif %}
|