本帖最后由 ghostist 于 2019-5-21 14:16 编辑
解决时间显示为UNIX时间戳的问题,如图PS:在我用HA解决这个问题的同时,土豆哥用NR解决了和我一样的问题 不约而同啊
参考:https://www.home-assistant.io/docs/configuration/templating/#time
sensor:
##1
- platform: mqtt
name: "gps01_nidili"
state_topic: "node-red/gmiot/nidili1"
value_template: "{{ value }}"
- platform: mqtt
name: "gps01_name"
state_topic: "node-red/gmiot/gps1"
value_template: "{{ value_json.name }}"
- platform: mqtt
name: "gps01_dev_type"
state_topic: "node-red/gmiot/gps1"
value_template: "{{ value_json.dev_type }}"
- platform: mqtt
name: "gps01_imei"
state_topic: "node-red/gmiot/gps1"
value_template: "{{ value_json.imei }}"
- platform: mqtt
name: "gps01_power"
state_topic: "node-red/gmiot/gps1"
value_template: "{{ value_json.power }}"
- platform: mqtt
name: "gps01_device_info"
state_topic: "node-red/gmiot/gps1"
value_template: "{{ value_json.device_info }}"
- platform: mqtt
name: "gps01_device_info_new"
state_topic: "node-red/gmiot/gps1"
value_template: "{{ value_json.device_info_new }}"
- platform: mqtt
name: "gps01_seconds"
state_topic: "node-red/gmiot/gps1"
value_template: "{{ value_json.seconds }}"
- platform: mqtt
name: "gps01_gps_time"
state_topic: "node-red/gmiot/gps1"
value_template: "{{ value_json.gps_time | timestamp_local}}"
- platform: mqtt
name: "gps01_sys_time"
state_topic: "node-red/gmiot/gps1"
value_template: "{{ value_json.sys_time | timestamp_local}}"
- platform: mqtt
name: "gps01_heart_time"
state_topic: "node-red/gmiot/gps1"
value_template: "{{ value_json.heart_time | timestamp_local}}"
- platform: mqtt
name: "gps01_server_time"
state_topic: "node-red/gmiot/gps1"
value_template: "{{ value_json.server_time | timestamp_local}}"
- platform: mqtt
name: "gps01_lng"
state_topic: "node-red/gmiot/gps1"
value_template: "{{ value_json.lng }}"
- platform: mqtt
name: "gps01_lat"
state_topic: "node-red/gmiot/gps1"
value_template: "{{ value_json.lat }}"
- platform: mqtt
name: "gps01_course"
state_topic: "node-red/gmiot/gps1"
value_template: "{{ value_json.course }}"
- platform: mqtt
name: "gps01_speed"
state_topic: "node-red/gmiot/gps1"
value_template: "{{ value_json.speed }}"
unit_of_measurement: 'km/h'
- platform: mqtt
name: "gps01_location"
state_topic: "node-red/gmiot/gps1"
value_template: "{{ value_json.location }}"
- platform: mqtt
name: "gps01_group_id"
state_topic: "node-red/gmiot/gps1"
value_template: "{{ value_json.group_id }}"
- platform: mqtt
name: "gps01_status"
state_topic: "node-red/gmiot/gps1"
value_template: "{{ value_json.status }}"
- platform: mqtt
name: "gps01_acc"
state_topic: "node-red/gmiot/gps1"
value_template: "{{ value_json.acc }}"
- platform: mqtt
name: "gps01_acc_seconds"
state_topic: "node-red/gmiot/gps1"
value_template: "{{ value_json.acc_seconds }}"
unit_of_measurement: '秒'
|