Skip to content

Instantly share code, notes, and snippets.

@pedrolamas
Created May 21, 2021 16:36
Show Gist options
  • Save pedrolamas/fb6aa1600fca1be9104600947d143484 to your computer and use it in GitHub Desktop.
Save pedrolamas/fb6aa1600fca1be9104600947d143484 to your computer and use it in GitHub Desktop.

Revisions

  1. pedrolamas created this gist May 21, 2021.
    10 changes: 10 additions & 0 deletions test.yaml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    sensor:
    - platform: command_line
    name: IKEA Tradfri OTA feed
    command: >-
    python3 -c "import hashlib, json, requests; response = requests.get('http://fw.ota.homesmart.ikea.net/feed/version_info.json'); ret = { 'ETag': response.headers.get('ETag'), 'Date': response.headers.get('Date'), 'Hash': hashlib.sha256(response.content).hexdigest() }; print(json.dumps(ret))"
    value_template: '{{ value_json.Hash }}'
    json_attributes:
    - Date
    - ETag
    scan_interval: 10800