|
发表于 2023-7-27 14:27:30
|
显示全部楼层
sensor:
- platform: rest
name: Beijing Car Number Limits
scan_interval: 18000
# friendly_name: 北京汽车尾号限行
resource: http://yw.jtgl.beijing.gov.cn/jgjxx/services/getRuleWithWeek
headers:
User-Agent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36 Edg/84.0.522.40'
Referer: 'http://jtgl.beijing.gov.cn/'
Accept: 'application/json, text/javascript, */*; q=0.01'
Cache-Control: 'no-cache'
method: POST
value_template: >
{%- if value_json.state=='success' -%}
{%- for item in value_json.result -%}
{%- if strptime(item.limitedTime,'%Y年%m月%d日').day==now().day -%}
{{ item.limitedNumber }}
{%- endif -%}
{%- endfor -%}
{% endif %}
|
|