Open bart1604 opened 1 year ago
Hi @bart1604,
I changed it to:
command_line:
- sensor:
name: Neerslag_Buienalarm_Regen_Data
command: python3 -c "import requests; import json; import random; dataRequest = requests.get('https://cdn-secure.buienalarm.nl/api/3.4/forecast.php?lat=<lat-2-decimals>&lon=<lon-2-decimals>®ion=nl&unit=mm%2Fu&c='+str(random.randint(0,999999999999999)) ).text; dataRequest = dataRequest.replace('\r\n',' '); data = '{\"data\":'+dataRequest+'}'; print(data);"
json_attributes:
- data
value_template: "last_changed: {{states.sensor.neerslag_buienalarm_regen_data.last_changed}}"
scan_interval: 240
- sensor:
name: Neerslag_Buienradar_Regen_Data
command: python3 -c "import requests; import json; import random; dataRequest = requests.get('https://gpsgadget.buienradar.nl/data/raintext?lat=<lat-2-decimals>&lon=<lon-2-decimals>&c='+str(random.randint(0,999999999999999)) ).text; dataRequest = dataRequest.replace('\r\n',' '); data = '{\"data\":\"'+dataRequest+'\"}'; print(data);"
json_attributes:
- data
value_template: "last_changed: {{states.sensor.neerslag_buienradar_regen_data.last_changed}}"
scan_interval: 240
<lat-2-decimals>
with your latitude. For example: 55.00
<lon-2-decimals>
with your longitude. For example: 5.00
Great! will do the same.
Thanks for the reply.
Now only the installation guide needs to be editted.
And the other for home zone .
command_line:
- sensor:
name: Neerslag_Buienalarm_Regen_Data
command: python3 -c "import requests; import json; import random; dataRequest = requests.get('https://cdn-secure.buienalarm.nl/api/3.4/forecast.php?lat={{state_attr("zone.home", "latitude") | round(3, default="not available")}}&lon={{state_attr("zone.home", "longitude") | round(3, default="not available")}}®ion=nl&unit=mm%2Fu&c='+str(random.randint(0,999999999999999)) ).text; dataRequest = dataRequest.replace('\r\n',' '); data = '{\"data\":'+dataRequest+'}'; print(data);"
json_attributes:
- data
value_template: "last_changed: {{states.sensor.neerslag_buienalarm_regen_data.last_changed}}"
scan_interval: 240
- sensor:
name: Neerslag_Buienradar_Regen_Data
command: python3 -c "import requests; import json; import random; dataRequest = requests.get('https://gpsgadget.buienradar.nl/data/raintext?lat={{state_attr("zone.home", "latitude") | round(2, default="not available")}}&lon={{state_attr("zone.home", "longitude") | round(2, default="not available")}}&c='+str(random.randint(0,999999999999999)) ).text; dataRequest = dataRequest.replace('\r\n',' '); data = '{\"data\":\"'+dataRequest+'\"}'; print(data);"
json_attributes:
- data
value_template: "last_changed: {{states.sensor.neerslag_buienradar_regen_data.last_changed}}"
scan_interval: 240
And i did make a pull request for the update to the readme file. https://github.com/aex351/home-assistant-neerslag-card/pull/40
Please fix this: