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

 找回密码
 立即注册
楼主: louis_lee

[经验分享] Deprecated

  [复制链接]

31

主题

531

帖子

2463

积分

金牌会员

Rank: 6Rank: 6

积分
2463
金钱
1927
HASS币
20
发表于 2023-3-30 10:36:55 | 显示全部楼层
louis_lee 发表于 2023-3-30 10:19
看你贴的这个配置,不太对啊,没贴全吧

老大 下面这个是全配置文件,我发现只有第一个户号的带entity的显示数据 第二个户号的就不显示了显示unknow

template:
  - trigger:
      - platform: event
        event_type: "state_changed"
        event_data:
          entity_id: sensor.electricity_charge_balance_12002814788
    sensor:
      - name: electricity_charge_balance_12002814788
        unique_id: electricity_charge_balance_12002814788_entity
        state: "{{ states('sensor.electricity_charge_balance_12002814788') }}"
        state_class: measurement
        unit_of_measurement: "CNY"
  - trigger:
      - platform: event
        event_type: "state_changed"
        event_data:
          entity_id: sensor.last_electricity_usage_12002814788
    sensor:
      - name: last_electricity_usage_12002814788_entity
        unique_id: last_electricity_usage_12002814788_entity
        state: "{{ states('sensor.last_electricity_usage_12002814788) }}"
        state_class: measurement
        unit_of_measurement: "KWH"
  - trigger:
      - platform: event
        event_type: "state_changed"
        event_data:
          entity_id: sensor.yearly_electricity_usage_12002814788
    sensor:
      - name: yearly_electricity_usage_12002814788_entity
        unique_id: yearly_electricity_usage_12002814788_entity
        state: "{{ states('sensor.yearly_electricity_usage_12002814788') }}"
        state_class: measurement
        unit_of_measurement: "KWH"

  - trigger:
      - platform: event
        event_type: "state_changed"
        event_data:
          entity_id: sensor.yearly_electricity_charge_12002814788
    sensor:
      - name: yearly_electricity_charge_12002814788_entity
        unique_id: yearly_electricity_charge_12002814788_entity
        state: "{{ states('sensor.yearly_electricity_charge_12002814788') }}"
        state_class: measurement
        unit_of_measurement: "CNY"
#电费-车位
#template 1:
  - trigger:
      - platform: event
        event_type: "state_changed"
        event_data:
          entity_id: sensor.electricity_charge_balance_12003101098
    sensor:
      - name: electricity_charge_balance_12003101098_entity
        unique_id: electricity_charge_balance_12003101098_entity
        state: "{{ states('sensor.electricity_charge_balance_12003101098') }}"
        state_class: measurement
        unit_of_measurement: "CNY"
  - trigger:
      - platform: event
        event_type: "state_changed"
        event_data:
          entity_id: sensor.last_electricity_usage_12003101098
    sensor:
      - name: last_electricity_usage_12003101098_entity
        unique_id: last_electricity_usage_12003101098_entity
        state: "{{ states('sensor.last_electricity_usage_12003101098') }}"
        state_class: measurement
        unit_of_measurement: "KWH"

  - trigger:
      - platform: event
        event_type: "state_changed"
        event_data:
          entity_id: sensor.yearly_electricity_usage_12003101098
    sensor:
      - name: yearly_electricity_usage_12003101098_entity
        unique_id: yearly_electricity_usage_12003101098_entity
        state: "{{ states('sensor.yearly_electricity_usage_12003101098') }}"
        state_class: measurement
        unit_of_measurement: "KWH"

  - trigger:
      - platform: event
        event_type: "state_changed"
        event_data:
          entity_id: sensor.yearly_electricity_charge_12003101098
    sensor:
      - name: yearly_electricity_charge_12003101098_entity
        unique_id: yearly_electricity_charge_12003101098_entity
        state: "{{ states('sensor.yearly_electricity_charge_12003101098') }}"
        state_class: measurement
        unit_of_measurement: "CNY"
#电费-静海
#template 2:
  - trigger:
      - platform: event
        event_type: "state_changed"
        event_data:
          entity_id: sensor.electricity_charge_balance_12001649156
    sensor:
      - name: electricity_charge_balance_1200164915673_entity
        unique_id: electricity_charge_balance_12001649156_entity
        state: "{{ states('sensor.electricity_charge_balance_12001649156') }}"
        state_class: measurement
        unit_of_measurement: "CNY"
  - trigger:
      - platform: event
        event_type: "state_changed"
        event_data:
          entity_id: sensor.last_electricity_usage_12001649156
    sensor:
      - name: last_electricity_usage_12001649156_entity
        unique_id: last_electricity_usage_12001649156_entity
        state: "{{ states('sensor.last_electricity_usage_12001649156') }}"
        state_class: measurement
        unit_of_measurement: "KWH"

  - trigger:
      - platform: event
        event_type: "state_changed"
        event_data:
          entity_id: sensor.yearly_electricity_usage_12001649156
    sensor:
      - name: yearly_electricity_usage_12001649156_entity
        unique_id: yearly_electricity_usage_12001649156_entity
        state: "{{ states('sensor.yearly_electricity_usage_12001649156') }}"
        state_class: measurement
        unit_of_measurement: "KWH"

  - trigger:
      - platform: event
        event_type: "state_changed"
        event_data:
          entity_id: sensor.yearly_electricity_charge_12001649156
    sensor:
      - name: yearly_electricity_charge_12001649156_entity
        unique_id: yearly_electricity_charge_12001649156_entity
        state: "{{ states('sensor.yearly_electricity_charge_12001649156') }}"
        state_class: measurement
        unit_of_measurement: "CNY"
回复

使用道具 举报

18

主题

587

帖子

4283

积分

元老级技术达人

积分
4283
金钱
3661
HASS币
182
 楼主| 发表于 2023-3-30 13:37:07 | 显示全部楼层
dinglifeng 发表于 2023-3-30 10:36
老大 下面这个是全配置文件,我发现只有第一个户号的带entity的显示数据 第二个户号的就不显示了显示unkn ...

有那么几种可能哈
1 配置中的用电账户配置错误
2 先启动的加载项,然后再添加的配置文件

如果是2的话,可以等待下次数据更新时(明天),数据会同步。
回复

使用道具 举报

6

主题

94

帖子

843

积分

高级会员

Rank: 4

积分
843
金钱
749
HASS币
0
发表于 2023-3-30 13:50:08 | 显示全部楼层
louis_lee 发表于 2023-3-23 10:13
其他加载项能正常使用嘛?比如node-red?

谢谢大佬关心,我把树莓派断电重启后就正常了。之前怎么重启都不行
回复

使用道具 举报

31

主题

531

帖子

2463

积分

金牌会员

Rank: 6Rank: 6

积分
2463
金钱
1927
HASS币
20
发表于 2023-3-31 08:29:01 | 显示全部楼层
louis_lee 发表于 2023-3-30 13:37
有那么几种可能哈
1 配置中的用电账户配置错误
2 先启动的加载项,然后再添加的配置文件

老大 奇怪的是 不带entity后缀的 sensor 可以显示余额的 那是不是就能证明账户配置没问题? 我觉得应该是template 生成的实体取不到值……您帮我看看我写的配置文件有没有问题?
回复

使用道具 举报

18

主题

587

帖子

4283

积分

元老级技术达人

积分
4283
金钱
3661
HASS币
182
 楼主| 发表于 2023-3-31 09:12:03 | 显示全部楼层
dinglifeng 发表于 2023-3-31 08:29
老大 奇怪的是 不带entity后缀的 sensor 可以显示余额的 那是不是就能证明账户配置没问题? 我觉得应该是 ...

取不到指的原因,是因为这个配置是在原值变化的时候才能取到值
回复

使用道具 举报

8

主题

188

帖子

597

积分

高级会员

Rank: 4

积分
597
金钱
409
HASS币
0
发表于 2023-4-8 10:25:07 | 显示全部楼层
没毛病,就是实现这个真的需要再装个容器吗。。。。
回复

使用道具 举报

18

主题

587

帖子

4283

积分

元老级技术达人

积分
4283
金钱
3661
HASS币
182
 楼主| 发表于 2023-4-8 10:46:33 | 显示全部楼层
zzr 发表于 2023-4-8 10:25
没毛病,就是实现这个真的需要再装个容器吗。。。。

已经在1L说明了,主要是依赖兼容问题
有好的解决方案嘛?
回复

使用道具 举报

6

主题

73

帖子

1450

积分

金牌会员

Rank: 6Rank: 6

积分
1450
金钱
1377
HASS币
0
发表于 2023-4-8 22:06:04 | 显示全部楼层
楼主请指教,我这里怎么显示找不到sgcc_electricity
canvas.png
回复

使用道具 举报

6

主题

186

帖子

1230

积分

金牌会员

Rank: 6Rank: 6

积分
1230
金钱
1044
HASS币
0
发表于 2023-5-20 19:42:24 来自手机 | 显示全部楼层
N1 上 用docker 部署的  运行有出现故障
  File "/app/data_fetcher.py", line 23, in __init__,
    self._chromium_version = self._get_chromium_version(),
  File "/app/data_fetcher.py", line 261, in _get_chromium_version,
    result = str(subprocess.check_output(["chromium", "--product-version"])),
  File "/usr/local/lib/python3.8/subprocess.py", line 415, in check_output,
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,,
  File "/usr/local/lib/python3.8/subprocess.py", line 516, in run,
    raise CalledProcessError(retcode, process.args,,
subprocess.CalledProcessError: Command '['chromium', '--product-version']' died with <Signals.SIGSEGV: 11>.,
2023-05-20 19:28:11  [INFO    ] ---- Service start!,
Traceback (most recent call last):,
  File "./main.py", line 80, in <module>,
    main(),
  File "./main.py", line 17, in main,
    fetcher = DataFetcher(args["phone_number"], args["password"]),
  File "/app/data_fetcher.py", line 23, in __init__,
    self._chromium_version = self._get_chromium_version(),
  File "/app/data_fetcher.py", line 261, in _get_chromium_version,
    result = str(subprocess.check_output(["chromium", "--product-version"])),
  File "/usr/local/lib/python3.8/subprocess.py", line 415, in check_output,
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,,
  File "/usr/local/lib/python3.8/subprocess.py", line 516, in run,
    raise CalledProcessError(retcode, process.args,,
subprocess.CalledProcessError: Command '['chromium', '--product-version']' died with <Signals.SIGSEGV: 11>.,
2023-05-20 19:28:20  [INFO    ] ---- Service start!,
Traceback (most recent call last):,
  File "./main.py", line 80, in <module>,
    main(),
  File "./main.py", line 17, in main,
    fetcher = DataFetcher(args["phone_number"], args["password"]),
  File "/app/data_fetcher.py", line 23, in __init__,
    self._chromium_version = self._get_chromium_version(),
  File "/app/data_fetcher.py", line 261, in _get_chromium_version,
    result = str(subprocess.check_output(["chromium", "--product-version"])),
  File "/usr/local/lib/python3.8/subprocess.py", line 415, in check_output,
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,,
  File "/usr/local/lib/python3.8/subprocess.py", line 516, in run,
    raise CalledProcessError(retcode, process.args,,
subprocess.CalledProcessError: Command '['chromium', '--product-version']' died with <Signals.SIGSEGV: 11>.,
2023-05-20 19:28:30  [INFO    ] ---- Service start!,
Traceback (most recent call last):,
  File "./main.py", line 80, in <module>,
    main(),
  File "./main.py", line 17, in main,
    fetcher = DataFetcher(args["phone_number"], args["password"]),
  File "/app/data_fetcher.py", line 23, in __init__,
    self._chromium_version = self._get_chromium_version(),
  File "/app/data_fetcher.py", line 261, in _get_chromium_version,
    result = str(subprocess.check_output(["chromium", "--product-version"])),
  File "/usr/local/lib/python3.8/subprocess.py", line 415, in check_output,
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,,
  File "/usr/local/lib/python3.8/subprocess.py", line 516, in run,
    raise CalledProcessError(retcode, process.args,,
subprocess.CalledProcessError: Command '['chromium', '--product-version']' died with <Signals.SIGSEGV: 11>.,
2023-05-20 19:31:50  [INFO    ] ---- Service start!,
Traceback (most recent call last):,
  File "./main.py", line 80, in <module>,
    main(),
  File "./main.py", line 17, in main,
    fetcher = DataFetcher(args["phone_number"], args["password"]),
  File "/app/data_fetcher.py", line 23, in __init__,
    self._chromium_version = self._get_chromium_version(),
  File "/app/data_fetcher.py", line 261, in _get_chromium_version,
    result = str(subprocess.check_output(["chromium", "--product-version"])),
  File "/usr/local/lib/python3.8/subprocess.py", line 415, in check_output,
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,,
  File "/usr/local/lib/python3.8/subprocess.py", line 516, in run,
    raise CalledProcessError(retcode, process.args,,
subprocess.CalledProcessError: Command '['chromium', '--product-version']' died with <Signals.SIGSEGV: 11>.,
2023-05-20 19:31:57  [INFO    ] ---- Service start!,
Traceback (most recent call last):,
  File "./main.py", line 80, in <module>,
    main(),
  File "./main.py", line 17, in main,
    fetcher = DataFetcher(args["phone_number"], args["password"]),
  File "/app/data_fetcher.py", line 23, in __init__,
    self._chromium_version = self._get_chromium_version(),
  File "/app/data_fetcher.py", line 261, in _get_chromium_version,
    result = str(subprocess.check_output(["chromium", "--product-version"])),
  File "/usr/local/lib/python3.8/subprocess.py", line 415, in check_output,
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,,
  File "/usr/local/lib/python3.8/subprocess.py", line 516, in run,
    raise CalledProcessError(retcode, process.args,,
subprocess.CalledProcessError: Command '['chromium', '--product-version']' died with <Signals.SIGSEGV: 11>.,
2023-05-20 19:32:05  [INFO    ] ---- Service start!,
Traceback (most recent call last):,
  File "./main.py", line 80, in <module>,
    main(),
  File "./main.py", line 17, in main,
    fetcher = DataFetcher(args["phone_number"], args["password"]),
  File "/app/data_fetcher.py", line 23, in __init__,
    self._chromium_version = self._get_chromium_version(),
  File "/app/data_fetcher.py", line 261, in _get_chromium_version,
    result = str(subprocess.check_output(["chromium", "--product-version"])),
  File "/usr/local/lib/python3.8/subprocess.py", line 415, in check_output,
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,,
  File "/usr/local/lib/python3.8/subprocess.py", line 516, in run,
    raise CalledProcessError(retcode, process.args,,
subprocess.CalledProcessError: Command '['chromium', '--product-version']' died with <Signals.SIGSEGV: 11>.,
2023-05-20 19:32:13  [INFO    ] ---- Service start!,

大佬 这是啥问题
回复

使用道具 举报

0

主题

51

帖子

619

积分

高级会员

Rank: 4

积分
619
金钱
568
HASS币
0
发表于 2023-5-29 18:01:36 | 显示全部楼层
谢谢分享     
回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-11-22 19:13 , Processed in 0.071458 second(s), 32 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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