本帖最后由 缥缈的孤鸿 于 2019-7-14 11:08 编辑
我发的就是package啊....mqtt这个,你node-red里怎么发送的数据就怎么写呗,我的NR里发送的topic是/node-red/jieqi/
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: "cnmonth"
state_topic: "/node-red/jieqi/"
value_template: "{{ value_json.cnmonth }}"
- 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 %}
homeassistant:
customize:
sensor.jieqi:
friendly_name: 节气
icon: mdi:cloud-question
sensor.cnday:
friendly_name: 农历
icon: mdi:calendar-range
sensor.cnmonth:
friendly_name: 月
icon: mdi:islam
sensor.suit:
friendly_name: 宜
icon: mdi:check
sensor.taboo:
friendly_name: 忌
icon: mdi:close
sensor.festivallist:
friendly_name: 节假日
icon: mdi:balloon
sensor.animal:
friendly_name: 属相
icon: mdi:pig
sensor.week2:
friendly_name: 星期
icon: mdi:calendar-week
|