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

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

[插件集成] 用爬虫的方式实现国内油价查询

[复制链接]

2

主题

40

帖子

399

积分

论坛技术达人

积分
399
金钱
359
HASS币
0
QQ
 楼主| 发表于 2018-9-13 20:59:25 | 显示全部楼层
情非殇 发表于 2018-9-12 11:24
感谢楼主,实测可行
[code]
#分享非插件城市汉化方法

不错不错,
回复

使用道具 举报

16

主题

234

帖子

1465

积分

金牌会员

Rank: 6Rank: 6

积分
1465
金钱
1231
HASS币
0
发表于 2018-9-14 20:01:41 | 显示全部楼层
感谢分享,学习了……
回复

使用道具 举报

6

主题

60

帖子

444

积分

中级会员

Rank: 3Rank: 3

积分
444
金钱
379
HASS币
20
发表于 2018-9-15 13:55:10 | 显示全部楼层
2018-09-15 13:50:15 WARNING (MainThread) [homeassistant.components.sensor.template] Could not render template 0#柴油, the state is unknown.
2018-09-15 13:50:15 WARNING (MainThread) [homeassistant.components.sensor.template] Could not render template 更新时间, the state is unknown.
2018-09-15 13:50:15 WARNING (MainThread) [homeassistant.components.sensor.template] Could not render template 92#汽油, the state is unknown.
2018-09-15 13:50:15 WARNING (MainThread) [homeassistant.components.sensor.template] Could not render template 95#汽油, the state is unknown.
2018-09-15 13:50:15 WARNING (MainThread) [homeassistant.components.sensor.template] Could not render template 原油价格, the state is unknown.
2018-09-15 13:50:15 WARNING (MainThread) [homeassistant.components.sensor.template] Could not render template 98#汽油, the state is unknown.
2018-09-15 13:50:15 WARNING (MainThread) [homeassistant.components.sensor.template] Could not render template 原油价更新时间, the state is unknown.
2018-09-15 13:50:15 WARNING (MainThread) [homeassistant.components.sensor.template] Could not render template 城市, the state is unknown.
这是怎么回事?
回复

使用道具 举报

2

主题

40

帖子

399

积分

论坛技术达人

积分
399
金钱
359
HASS币
0
QQ
 楼主| 发表于 2018-9-15 20:55:40 | 显示全部楼层
ilikehassbian 发表于 2018-9-15 13:55
2018-09-15 13:50:15 WARNING (MainThread) [homeassistant.components.sensor.template] Could not render ...

你用的是后面修改的包还是原来那个?
你现在的情况是爬虫没有运行成功。
回复

使用道具 举报

6

主题

289

帖子

987

积分

高级会员

Rank: 4

积分
987
金钱
698
HASS币
0
发表于 2018-9-15 23:59:37 | 显示全部楼层
用后来的那个不知道啥原因我的也没爬成功。
回复

使用道具 举报

6

主题

289

帖子

987

积分

高级会员

Rank: 4

积分
987
金钱
698
HASS币
0
发表于 2018-9-16 00:01:09 | 显示全部楼层
sistant.components.sensor.template] Could not render template 98#汽油, the state is unknown.
2018-09-15 23:54:49 WARNING (MainThread) [homeassistant.components.sensor.template] Could not render template 0#柴油, the state is unknown.
2018-09-15 23:54:49 WARNING (MainThread) [homeassistant.components.sensor.template] Could not render template 爬虫时间, the state is unknown.
2018-09-15 23:54:49 WARNING (MainThread) [homeassistant.components.sensor.template] Could not render template 原油价格, the state is unknown.
2018-09-15 23:54:49 WARNING (MainThread) [homeassistant.components.sensor.template] Could not render template 城市, the state is unknown.
2018-09-15 23:54:49 WARNING (MainThread) [homeassistant.components.sensor.template] Could not render template 原油价更新时间, the state is unknown.
2018-09-15 23:54:49 WARNING (MainThread) [homeassistant.components.sensor.template] Could not render template 92#汽油, the state is unknown.
2018-09-15 23:54:49 WARNING (MainThread) [homeassistant.components.sensor.template] Could not render template 95#汽油, the state is unknown.
回复

使用道具 举报

2

主题

40

帖子

399

积分

论坛技术达人

积分
399
金钱
359
HASS币
0
QQ
 楼主| 发表于 2018-9-17 12:06:48 | 显示全部楼层
mly1314 发表于 2018-9-16 00:01
sistant.components.sensor.template] Could not render template 98#汽油, the state is unknown.
2018-09 ...

你把整个log,发上来,这样好判断,你这个错误信息,看不出什么的
回复

使用道具 举报

65

主题

853

帖子

3038

积分

论坛元老

Rank: 8Rank: 8

积分
3038
金钱
2180
HASS币
40
发表于 2018-9-20 09:17:12 | 显示全部楼层
汉化也可以这样写:
可以少调用一个sensor
  - platform: template
    sensors:
      youjia_city:
        friendly_name: "所在城市"
        value_template: '{% if states.sensor.youjia.attributes.city == "hubei" %}湖北{% else %}{{states.sensor.youjia.attributes.city}}{% endif %}'


  
回复

使用道具 举报

4

主题

339

帖子

3208

积分

论坛元老

Rank: 8Rank: 8

积分
3208
金钱
2869
HASS币
0
发表于 2018-10-11 10:53:25 | 显示全部楼层
顶部badge内的油价,怎么自定义为92#的价格,而不是原油价格,我现在显示的是原油价格

4@EL~Y0(%$QR3AATFV3(E2T.png

回复

使用道具 举报

2

主题

40

帖子

399

积分

论坛技术达人

积分
399
金钱
359
HASS币
0
QQ
 楼主| 发表于 2018-10-15 22:46:17 | 显示全部楼层
georgewu57 发表于 2018-10-11 10:53
顶部badge内的油价,怎么自定义为92#的价格,而不是原油价格,我现在显示的是原油价格

...

你进行group分组
回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-4-29 15:14 , Processed in 0.078315 second(s), 33 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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