samuel-0-0 / phicomm_dc1-esphome Goto Github PK
View Code? Open in Web Editor NEW斐讯DC1插座自制固件方式接入开源智能家居平台
斐讯DC1插座自制固件方式接入开源智能家居平台
`sensor:
将name的值改为中文后,WebServer中name对应的state对应不上,比如:uptime的state变成了239V
怎么修改WIFI名字? 还要OTA刷机吗?
dc1刷了固件,断电后再通电 dc1可以被ha控制开关,但是插座是不通电的,需要把dc1主开关 关一编再打开就正常了通电了。
root@iZwz9dm568mc3jd27qjlkmZ:~/esphome# esphome dc1_homeassistant_mqtt.yaml compile
INFO Reading configuration dc1_homeassistant_mqtt.yaml...
WARNING ESP8266: Pin 6 (6-11) might already be used by the flash interface. Be warned.
WARNING ESP8266: Pin 7 (6-11) might already be used by the flash interface. Be warned.
Failed config
cat9554:
Component not found: cat9554.
id: cat9554_hub
address: 32
irq_pin: GPIO4
binary_sensor.gpio: [source dc1_homeassistant_mqtt.yaml:215]
platform: gpio
name: phicomm_dc1_1 key1
internal: True
pin: [source dc1_homeassistant_mqtt.yaml:221]
[cat9554] is an invalid option for [pin]. Please check the indentation.
cat9554: cat9554_hub [source dc1_homeassistant_mqtt.yaml:221]
number: 0
mode: INPUT
filters:
[cat9554] is an invalid option for [pin]. Please check the indentation.
cat9554: cat9554_hub [source dc1_homeassistant_mqtt.yaml:240]
number: 1
mode: INPUT
filters:
现在都显示在最上面的圆圈里了
用api版本的配置文件编译固件,刷DC1后。wifi灯一直在闪烁。
其他都一样,就是型号这里不同
本地编译,总是是下载失败。想上传到guge的vps编译,但是下载的esphome文件夹中,并没有setup.py文件。如何执行python setup.py build
选择1 提示no module named esphome,
选择3 下载完esphome-dc1.zip后提示:
Traceback (most recent call last):
File "setup.py", line 3, in
from setuptools import setup, find_packages
ImportError: No module named setuptools
�[32mINFO Reading configuration dc1.yaml...�[0m
�[33mWARNING ESP8266: Pin 6 (6-11) might already be used by the flash interface. Be warned.�[0m
�[33mWARNING ESP8266: Pin 7 (6-11) might already be used by the flash interface. Be warned.�[0m
Failed config
cat9554: [source dc1.yaml:88]
Component not found: cat9554.
id: cat9554_hub
irq_pin: GPIO4
binary_sensor.gpio: [source dc1.yaml:130]
platform: gpio
name: phicomm_dc1_api key1
internal: True
pin: [source dc1.yaml:136]
[cat9554] is an invalid option for [pin]. Please check the indentation.
cat9554: cat9554_hub [source dc1.yaml:136]
number: 0
mode: INPUT
filters:
- invert: {}
- delayed_on: 50ms
- delayed_off: 50ms
on_click:
- min_length: 50ms
max_length: 500ms
then:
- switch.toggle: switch1
binary_sensor.gpio: [source dc1.yaml:149]
platform: gpio
name: phicomm_dc1_api key2
internal: True
pin: [source dc1.yaml:155]
[cat9554] is an invalid option for [pin]. Please check the indentation.
cat9554: cat9554_hub [source dc1.yaml:155]
number: 1
mode: INPUT
filters:
- invert: {}
- delayed_on: 50ms
- delayed_off: 50ms
on_click:
- min_length: 50ms
max_length: 500ms
then:
- switch.toggle: switch2
binary_sensor.gpio: [source dc1.yaml:168]
platform: gpio
name: phicomm_dc1_api key3
internal: True
pin: [source dc1.yaml:174]
[cat9554] is an invalid option for [pin]. Please check the indentation.
cat9554: cat9554_hub [source dc1.yaml:174]
number: 2
mode: INPUT
filters:
- invert: {}
- delayed_on: 50ms
- delayed_off: 50ms
on_click:
- min_length: 50ms
max_length: 500ms
then:
- switch.toggle: switch3
output.gpio: [source dc1.yaml:241]
platform: gpio
id: realy3
setup_priority: 900
pin: [source dc1.yaml:247]
[cat9554] is an invalid option for [pin]. Please check the indentation.
cat9554: cat9554_hub [source dc1.yaml:247]
number: 4
mode: OUTPUT
inverted: False
output.gpio: [source dc1.yaml:252]
platform: gpio
id: realy2
setup_priority: 900
pin: [source dc1.yaml:257]
[cat9554] is an invalid option for [pin]. Please check the indentation.
cat9554: cat9554_hub [source dc1.yaml:257]
number: 5
mode: OUTPUT
inverted: False
output.gpio: [source dc1.yaml:262]
platform: gpio
id: realy1
setup_priority: 900
pin: [source dc1.yaml:267]
[cat9554] is an invalid option for [pin]. Please check the indentation.
cat9554: cat9554_hub [source dc1.yaml:267]
number: 6
mode: OUTPUT
inverted: False
output.gpio: [source dc1.yaml:272]
platform: gpio
id: realy0
setup_priority: 900
pin: [source dc1.yaml:277]
[cat9554] is an invalid option for [pin]. Please check the indentation.
cat9554: cat9554_hub [source dc1.yaml:277]
number: 7
mode: OUTPUT
inverted: False
如果能用dns劫持方式劫持到自己的服务器,使用原厂ota方式升级,那就避免了拆外壳等一系列动作,省事多了。我尝试了将原厂bin升级到一块nodemcu中,想看下串口信息,试了几个常用波特率,全是乱码,感觉串口在不停输出。
不知道有人抓过原厂ota或者了解这个串口调试的人是否可以贡献点信息,如果能破解原厂ota,那后续升级就好办多了
模块型号:csm64f02
固件:dc1_homeassistant
路由器:斐讯k2p A2 官改固件
固件编译环境:win10 1803
问题描述:
未接入HA平台状态下, wifi指示灯一直闪烁,连接上wifi后还是闪烁,并且连接上wifi之后路由器后台在线设备列表里没有DC1插排,300S后自动重启。
定时重启能关闭,但是WIFI-LED灯光一直闪烁,路由器后台不显示是怎么回事呢,请问固件就是这么设计的,接入HA平台才算在线,其他状态算离线,还是bug,或者是操作不对?
因为看见大佬已经在esphome主线上添加了相关组件,但是yaml文件中还是指定了esphome-core作为核心仓库,所以特此问一下现存的dc1的yaml配置文件是否被esphome所支持,谢谢。
yaml配置文件里边只用填写插座名称的头部,比如我的是dc1,最终编译后的设备名称大概为dc1_AABBCCDD,这里的AABBCCDD是mac地址后六位。这样,配置最终配置文件比较通用。
我家里有8个dc1插座,需要维护的配置文件就有8个
是否可以协同一起完成?
ERROR Error while reading config: Invalid YAML syntax. Please see YAML syntax reference or use an online YAML syntax validator:
Error reading file secrets.yaml: [Errno 2] No such file or directory: 'secrets.yaml'
就算 直接下载你的yaml文件什么都不改都会出这样的错 改了下wifi名和密码 也是同样的错误
INFO Reading configuration...
Failed config
cat9554: [source config/999.yaml:146]
'irq' is a required option for [cat9554].
[source config/999.yaml:146]
id: cat9554_hub
address: 32
[irq_pin] is an invalid option for [cat9554]. Did you mean [irq]?
irq_pin: GPIO4
你们有没有遇到“[W][i2c:080]: Received NACK on transmit of data for address 0x20 esphome”这样的报错??
错误发生在操作开关开启或者关闭时,出现这个错误会导致其他的开关断电,虽然1秒后会复位,但是会造成很大的麻烦。特别是常供电的设备
我看了下貌似是cat9554的问题??
有没有避免的方法?
esphome:
name: $device_name
platform: ESP8266
board: $board_model
#状态恢复保持
esp8266_restore_from_flash: yes
#--------------指定esphome_core来源------------------
esphome_core_version:
#指定本地来源
#local: path/to/esphome-core
#指定外部来源
repository: https://github.com/Samuel-0-0/esphome-core.git
#指定分支
branch: dc1
#----------------------------------------------------
#指定编译临时文件存放位置
build_path: build\$device_name
#指定arduino版本
arduino_version: 2.5.0
#-----------------platform相关设置-------------------
platformio_options:
#指定platform-espressif8266来源
platform: https://github.com/Samuel-0-0/platform-espressif8266.git#dc1
#----------------------------------------------------
#--------------------- 只需要改这下面的内容 ---------------------
substitutions:
#WiFi芯片版本,型号中带B的为csm64f02_b,不带B的为csm64f02
board_model: csm64f02_b
#设备名称(多个dc1改成不一样的)
device_name: dc4
#WiFi_SSID名称
wifi_ssid: '****'
#WiFi密码
wifi_password: '****'
#如果SSID是隐藏的,设置为true
wifi_fast_connect: 'false'
#WiFi离线多久后重启设备,秒s/分钟min/小时h,不需要此功能设置为0s
wifi_reboot_timeout: 0s
mqtt_reboot_timeout: 0s
#OTA密码
ota_password: '12345'
#与客户端(如Home Assistant)失去连接多久后重启设备,秒s/分钟min/小时h,不需要此功能设置为0s
#api_reboot_timeout: 600s
#电量统计的数据更新时间,秒s/分钟min/小时h
cse7766_update_interval: 30s
#--------------------- 只需要改这上面的内容 ---------------------
wifi:
ssid: $wifi_ssid
password: $wifi_password
#----------需要设置静态地址的改下面的配置------------
# manual_ip:
# static_ip: 192.168.178.230
# gateway: 192.168.178.1
# subnet: 255.255.255.0
# dns1: 1.1.1.1
# dns2: 1.2.2.1
#----------------------------------------------------
domain: .local
reboot_timeout: $wifi_reboot_timeout
power_save_mode: light
fast_connect: $wifi_fast_connect
#---------不使用api与设备连接的话删除api配置---------
# api:
# reboot_timeout: $api_reboot_timeout
#----------------------------------------------------
mqtt:
broker: mqtt # mqtt服务器ip/域名
#username: mosquitto # 账号
#password: 123 # 密码
#-------------------------------#
#birth_message: # 连接通知,设备发起
#topic: phicomm_dc1/state # 默认{TOPIC_PREFIX}/status
# payload: online # 默认通知online状态
#will_message: # 离线通知,由mqtt服务器发起
# topic: phicomm_dc1/state # 默认{TOPIC_PREFIX}/status
#payload: offline # 默认通知offline状态
# 如果不设置,默认就是如上配置;如果birth_message、will_message的topic为空或不一样,则不生效。
#-------------------------------#
topic_prefix: "${device_name}" #不设置默认{NodeName}
discovery: True # 发现标记设置(全局)
discovery_prefix: homeassistant # 配置数据topic,默认homeassistant,要与Home Assistant的mqtt组件设置保持一直(默认也是homeassistant)
reboot_timeout: $mqtt_reboot_timeout
ota:
safe_mode: true
password: $ota_password
# port: 3286
#----------------------WEB后台----------------------
web_server:
port: 80
css_url: https://esphome.io/_static/webserver-v1.min.css
js_url: https://esphome.io/_static/webserver-v1.min.js
#----------------------------------------------------
#----------------------深度睡眠----------------------
#deep_sleep:
# run_duration: 20s
# sleep_duration: 50s
#----------------------------------------------------
i2c:
sda: GPIO3
scl: GPIO12
scan: false
frequency: 20kHz
cat9554:
- id: cat9554_hub
address: 0x20
irq: GPIO4
uart:
rx_pin: GPIO13
baud_rate: 4800
#debug:
logger:
# hardware_uart: UART1
# level: DEBUG
level: info
sensor:
- platform: cse7766
voltage:
name: "${device_name} voltage"
current:
name: "${device_name} current"
power:
name: "${device_name} power"
update_interval: $cse7766_update_interval
# - platform: uptime
# name: "${device_name} uptime"
# - platform: wifi_signal
# name: "${device_name} wifi_signal"
binary_sensor:
- platform: status
#设备状态
name: "${device_name} status"
#是否对外隐藏(true/false)
internal: false
- platform: gpio
#第一个按钮(内部引用,对外隐藏)
name: "${device_name} key1"
#是否对外隐藏(true/false)
internal: true
pin:
cat9554: cat9554_hub
# Use pin number 0
number: 0
mode: INPUT
filters:
- invert:
- delayed_on: 40ms
- delayed_off: 40ms
on_click:
- min_length: 50ms
max_length: 350ms
then:
- switch.toggle: switch1
- platform: gpio
#第二个按钮(内部引用,对外隐藏)
name: "${device_name} key2"
#是否对外隐藏(true/false)
internal: true
pin:
cat9554: cat9554_hub
# Use pin number 1
number: 1
mode: INPUT
filters:
- invert:
- delayed_on: 40ms
- delayed_off: 40ms
on_click:
- min_length: 50ms
max_length: 350ms
then:
- switch.toggle: switch2
- platform: gpio
#第三个按钮(内部引用,对外隐藏)
name: "${device_name} key3"
#是否对外隐藏(true/false)
internal: true
pin:
cat9554: cat9554_hub
# Use pin number 2
number: 2
mode: INPUT
filters:
- invert:
- delayed_on: 40ms
- delayed_off: 40ms
on_click:
- min_length: 50ms
max_length: 350ms
then:
- switch.toggle: switch3
- platform: gpio
#总开关(内部引用,对外隐藏)
name: "${device_name} key0"
#是否对外隐藏(true/false)
id: key0
internal: true
pin:
number: GPIO16
mode: INPUT_PULLDOWN_16
filters:
- invert:
- delayed_on: 40ms
- delayed_off: 40ms
on_click:
- min_length: 50ms
max_length: 350ms
then:
- switch.toggle: switch0
#影子
- platform: template
name: "shadow1"
id: shadow1
internal: true
- platform: template
name: "shadow2"
id: shadow2
internal: true
- platform: template
name: "shadow3"
id: shadow3
internal: true
#WiFi状态灯
status_led:
pin: GPIO0
# text_sensor:
# - platform: template
# #配置文件版本
# name: "${device_name} config_version"
# lambda: |-
# return {"v2019.03.28.002"};
# - platform: version
# #esphome版本
# name: "${device_name} esphome_version"
# icon: mdi:information-outline
# - platform: wifi_info
# ip_address:
# name: "${device_name} IP Address"
# ssid:
# name: "${device_name} Connected SSID"
# bssid:
# name: "${device_name} Connected BSSID"
output:
- platform: gpio
#继电器3(内部引用,对外隐藏)
id: realy3
pin:
cat9554: cat9554_hub
# Use pin number 4
number: 4
mode: OUTPUT
inverted: false
- platform: gpio
#继电器2(内部引用,对外隐藏)
id: realy2
pin:
cat9554: cat9554_hub
# Use pin number 5
number: 5
mode: OUTPUT
inverted: false
- platform: gpio
#继电器1(内部引用,对外隐藏)
id: realy1
pin:
cat9554: cat9554_hub
# Use pin number 6
number: 6
mode: OUTPUT
inverted: false
- platform: gpio
#总继电器(内部引用,对外隐藏)
id: realy0
pin:
cat9554: cat9554_hub
# Use pin number 7
number: 7
mode: OUTPUT
inverted: false
switch:
- platform: output
#总开关(显示为一个开关)
name: "${device_name} switch0"
output: realy0
id: switch0
on_turn_on:
#- switch.turn_on: LOGO_light
- lambda: |-
if (id(shadow1).state) {
id(switch1).turn_on();
id(shadow1).publish_state(false);
}
if (id(shadow2).state) {
id(switch2).turn_on();
id(shadow2).publish_state(false);
}
if (id(shadow3).state) {
id(switch3).turn_on();
id(shadow3).publish_state(false);
}
on_turn_off:
#- switch.turn_off: LOGO_light
- lambda: |-
if (id(switch1).state) {
id(switch1).turn_off();
id(shadow1).publish_state(true);
}
if (id(switch2).state) {
id(switch2).turn_off();
id(shadow2).publish_state(true);
}
if (id(switch3).state) {
id(switch3).turn_off();
id(shadow3).publish_state(true);
}
- platform: output
#开关1(显示为一个开关)
name: "${device_name} switch1"
output: realy1
id: switch1
on_turn_on:
- lambda: |-
if (!id(switch0).state) {
id(switch0).turn_on();
}
- platform: output
#开关2(显示为一个开关)
name: "${device_name} switch2"
output: realy2
id: switch2
on_turn_on:
- lambda: |-
if (!id(switch0).state) {
id(switch0).turn_on();
}
- platform: output
#开关3(显示为一个开关)
name: "${device_name} switch3"
output: realy3
id: switch3
on_turn_on:
- lambda: |-
if (!id(switch0).state) {
id(switch0).turn_on();
}
- platform: gpio
pin: GPIO14
#LOGO灯
name: "${device_name} LOGO_light"
id: LOGO_light
internal: false
inverted: true
使用最新的版本 (2719167) 编译时报错
dc1_homeassistant.yaml
只改了wifi 和密码
tet@ubuntu ~/Templates $ esphome dc1_homeassistant.yaml compile
INFO Reading configuration...
Failed config
cat9554: [source dc1_homeassistant.yaml:79]
'irq' is a required option for [cat9554].
- [source dc1_homeassistant.yaml:79]
id: cat9554_hub
address: 32
https://github.com/iotdevice/phicomm_dc1#%E8%87%B4%E8%B0%A2
支持设备配网和发现设备,支持纯内网访问和外网访问
报错, 问下需要怎么设置
yaml
dc1_homeassistant.yaml.txt
chenny@ubuntu ~/Templates $ esphome dc1_homeassistant.yaml upload
INFO Reading configuration dc1_homeassistant.yaml...
INFO Resolving IP address of phicomm_dc1_35132.local
INFO -> 192.168.31.138
INFO Uploading build/phicomm_dc1_35132/.pioenvs/phicomm_dc1_35132/firmware.bin (401808 bytes)
ERROR Error binary size: Error: ESP has been flashed with wrong flash size. Please choose the correct 'board' option (esp01_1m always works) and then flash over USB.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.