前几天跟着yinjiong大的帖子:https://bbs.hassbian.com/forum.p ... d=4952&highlight=M1,来把客厅的一个M1,加入到HA中,但是yinjiong大的py,老是报如下错误。。
2019-01-28 15:28:58 ERROR (Thread-2) [custom_components.sensor.aircat] Exception: Traceback (most recent call last):
File "/config/custom_components/sensor/aircat.py", line 51, in update
self.handle(fd)
File "/config/custom_components/sensor/aircat.py", line 92, in handle
if len(mac) > 0 and len(self._macs.get(mac)):
TypeError: object of type 'NoneType' has no len()
而killadm大的离线版本就可以正常使用:https://bbs.hassbian.com/forum.p ... d=4601&highlight=m1
唯一的区别就是,yinjiong大的有自动化屏幕亮度,由于对py的一知半解无法修改其py,只能通过自动化下手,通过改变亮度的值,从而达到亮度自动化。通过学习了南柯醉一梦丶的自动化帖子:https://bbs.hassbian.com/thread-460-1-2.html,试着动手添加自动化内容:
- alias: auto swith screen brightness of m1 part A
hide_entity: True
trigger:
platform: time
at: '9:00:00'
action:
service: input_number.set_value
data:
entity_id: input_number.phicomm_m1_led
value: '25'
- alias: auto swith screen brightness of m1 part B
hide_entity: True
trigger:
platform: time
at: '22:00:00'
action:
service: input_number.set_value
data:
entity_id: input_number.phicomm_m1_led
value: '0'