home-assistant-neerslag-card icon indicating copy to clipboard operation
home-assistant-neerslag-card copied to clipboard

Command Line YAML configuration has moved

Open bart1604 opened this issue 1 year ago • 3 comments

Please fix this:

1

bart1604 avatar Jun 13 '23 13:06 bart1604

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 
  • Replace <lat-2-decimals> with your latitude. For example: 55.00
  • Replace <lon-2-decimals> with your longitude. For example: 5.00

Voxxie avatar Jun 15 '23 11:06 Voxxie

Great! will do the same.

Thanks for the reply.

Now only the installation guide needs to be editted.

bart1604 avatar Jun 15 '23 11:06 bart1604

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

huizebruin avatar Aug 23 '23 14:08 huizebruin