aex351 / home-assistant-neerslag-card

Display Buienalarm and/or Buienradar data in a graph for Home Assistant.
29 stars 3 forks source link

Command Line YAML configuration has moved #38

Open bart1604 opened 1 year ago

bart1604 commented 1 year ago

Please fix this:

1

Voxxie commented 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>&region=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 
bart1604 commented 1 year ago

Great! will do the same.

Thanks for the reply.

Now only the installation guide needs to be editted.

huizebruin commented 10 months ago

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")}}&region=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