Skip to content

Node.js RESTful API to retrieve Israeli Pikud Ha-Oref so called "Red Color" alerts.

Notifications You must be signed in to change notification settings

dmatik/orefAlerts

Repository files navigation

DEPRECATED

Please use oref-alerts-proxy-ms instead.

orefAlerts

maintenance last-commit

Node.js RESTful API to retrieve Israeli Pikud Ha-Oref so called "Red Color" alerts.
The project deployed on Docker Hub as dmatik/oref-alerts.

Buy Me A Coffee

Usage

Run from hub

docker run from hub

docker run -d -p 49000:3000 --name oref-alerts dmatik/oref-alerts:latest

docker-compose from hub

version: "3.6"
services:
    oref-alerts:
        image: dmatik/oref-alerts:latest
        container_name: oref-alerts
        hostname: oref-alerts
        network_mode: "bridge"
        ports:
          - 49000:3000
        restart: unless-stopped

JSON Response Examples

Example for /current endpoint

{
    "alert": "true",
    "current": {
        "data": [
            "סעד",
            "אשדוד - יא,יב,טו,יז,מרינה"
        ],
        "id": 1621242007417,
        "title": "התרעות פיקוד העורף"
    }
}

Example for /last_day endpoint

{
    "lastDay": [
        {
            "data": "בטחה",
            "date": "17.05.2021",
            "time": "13:31",
            "datetime": "2021-05-17T13:32:00"
        },
        {
            "data": "גילת",
            "date": "17.05.2021",
            "time": "13:31",
            "datetime": "2021-05-17T13:32:00"
        }
    ]
}

Home-Assistant

Sensors

Fetch the current alert
sensor:
  - platform: rest
    resource: http://[YOUR_IP]:49000/current
    name: redalert
    value_template: 'OK'
    json_attributes:
      - alert
      - current
    scan_interval: 5
    timeout: 30
Fetch the last day history alerts

NOTE: This responce is very long, while there is 255 characters limit in HA sensors.
Hence adding it to the attribute, which does not have such limit.

sensor:
  - platform: rest
    resource: http://[YOUR_IP]:49000/last_day
    name: redalert_history
    value_template: 'OK'
    json_attributes:
      - "lastDay"
    scan_interval: 120
    timeout: 30

Binary Sensors

Indicator for all alerts
binary_sensor:
  - platform: template
    sensors:
      redalert_all:
        friendly_name: "Redalert All"
        value_template: >-
          {{ state_attr('sensor.redalert', 'alert') == "true" }}
Indicator for specific alert
binary_sensor:
  - platform: template
    sensors:
      redalert_ashdod:
        friendly_name: "Redalert Ashdod"
        value_template: >-
          {{ state_attr('sensor.redalert', 'alert') == "true" and 
                    'אשדוד - יא,יב,טו,יז,מרינה' in state_attr('sensor.redalert', 'current')['data'] }}

About

Node.js RESTful API to retrieve Israeli Pikud Ha-Oref so called "Red Color" alerts.

Resources

Stars

Watchers

Forks

Packages

No packages published