『瀚思彼岸』» 智能家居技术论坛

 找回密码
 立即注册
查看: 2841|回复: 2

[基础教程] 找不到实体怎么办?

[复制链接]

2

主题

2

帖子

29

积分

新手上路

Rank: 1

积分
29
金钱
27
HASS币
0
发表于 2020-7-19 20:37:29 | 显示全部楼层 |阅读模式
111.png

configuration.yaml  文件内容
homeassistant:
  # Name of the location where Home Assistant is running
  name: Home
  # Location required to calculate the time the sun rises and sets
  latitude: 23.1000
  longitude: 113.2500
  # Impacts weather/sunrise data (altitude above sea level in meters)
  elevation: 0
  # metric for Metric, imperial for Imperial
  unit_system: imperial
  # Pick yours from here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
  time_zone: America/Los_Angeles
  # Customization file
  #customize: !include customize.yaml

# Show links to resources in log and frontend
introduction:

recorder:
  purge_interval: 1
  purge_keep_days: 5

# Enables the frontend
frontend:

# Enables configuration UI
config:

# Uncomment this if you are using SSL/TLS, running in Docker container, etc.
# http:
#   base_url: example.duckdns.org:8123

# Checks for available updates
# Note: This component will send some information about your system to
# the developers to assist with development of Home Assistant.
# For more information, please see:
# https://home-assistant.io/blog/2016/10/25/explaining-the-updater/
updater:
  # Optional, allows Home Assistant developers to focus on popular components.
  # include_used_components: true

# Discover some devices automatically
discovery:

# Allows you to issue voice commands from the frontend in enabled browsers
conversation:

# Enables support for tracking state changes over time
history:

# View all events in a logbook
logbook:

# Enables a map showing the location of tracked devices
map:

# Track the sun
sun:

# Weather prediction
sensor:
  - platform: yr

# Text to speech
tts:
  - platform: google

# Cloud
cloud:

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
homeassistant:
        packages: !include_dir_named packages

mqtt:
   broker:192.168.1.174
   username:admin
   password:123456

homekit:



packages目录下m1.yaml内容
sensor:
  - platform: mqtt
    name: 'zm1_b0f89324168c_temperature'
    # friendly_name: 温度
    state_topic: 'device/zm1/b0f89324168c/sensor'
    unit_of_measurement: '°C'
    icon: 'mdi:thermometer'
    value_template: '{{ value_json.temperature }}'
  - platform: mqtt
    name: 'zm1_b0f89324168c_humidity'
    # friendly_name: 湿度
    state_topic: 'device/zm1/b0f89324168c/sensor'
    unit_of_measurement: '%'
    icon: mdi:water-percent
    value_template: '{{ value_json.humidity }}'
  - platform: mqtt
    name: 'zm1_b0f89324168c_pm25'
    # friendly_name: PM25
    state_topic: 'device/zm1/b0f89324168c/sensor'
    unit_of_measurement: 'μg/m³'
    icon: mdi:blur
    value_template: '{{ value_json.PM25 }}'
  - platform: mqtt
    name: 'zm1_b0f89324168c_hcho'
    # friendly_name: 甲醛
    state_topic: 'device/zm1/b0f89324168c/sensor'
    unit_of_measurement: 'mg/m³'
    icon: mdi:chemical-weapon
    value_template: '{{ value_json.formaldehyde }}'

light:
  - platform: mqtt
    name: zm1_b0f89324168c_brightness
    schema: template
    command_topic: "device/zm1/b0f89324168c/set"
    state_topic: "device/zm1/b0f89324168c/state"
    command_on_template: >
      {"mac": "b0f89324168c"
      {%- if brightness is defined -%}
      , "brightness": {{ ((brightness-1) / 64 )|int +1 }}
      {%- else -%}
      , "brightness": 4
      {%- endif -%}
      }
    command_off_template: '{"mac": "b0f89324168c", "brightness": 0}'
    state_template: >
      {%- if value_json.brightness == 0 -%}
        off
      {%- else -%}
        on
      {%- endif -%}
    brightness_template: >
      {%- if value_json.brightness is defined -%}
        {{ ( value_json.brightness *64 )|int }}
      {%- endif -%}


homeassistant:
  customize:
    light.zm1_b0f89324168c_brightness:
      friendly_name: 卧室M1亮度
    sensor.zm1_b0f89324168c_temperature:
      friendly_name: 卧室温度
    sensor.zm1_b0f89324168c_humidity:
      friendly_name: 卧室湿度
    sensor.zm1_b0f89324168c_pm25:
      friendly_name: 卧室PM2.5
    sensor.zm1_b0f89324168c_hcho:
      friendly_name: 卧室甲醛



回复

使用道具 举报

0

主题

52

帖子

298

积分

中级会员

Rank: 3Rank: 3

积分
298
金钱
246
HASS币
0
发表于 2020-7-20 19:02:35 | 显示全部楼层
来学习的,但啥也没看出来
回复

使用道具 举报

12

主题

193

帖子

1138

积分

论坛积极会员

积分
1138
金钱
945
HASS币
0
发表于 2020-7-26 21:17:09 | 显示全部楼层
homeassistant:
        packages: !include_dir_named packages

这段代码中多了“homeassistant:”
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-11-26 07:25 , Processed in 0.923729 second(s), 33 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表