Skip to content

Java Spring Boot MS to retrieve Israeli Pikud Ha-Oref so called Red Color alerts.

License

Notifications You must be signed in to change notification settings

dmatik/oref-alerts-proxy-ms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

oref-alerts-proxy-ms

build last-commit
docker-version docker-pulls image-size
quality-gate coverage bugs vulnerabilities

Java Spring Boot MS 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:9001 --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
        restart: unless-stopped
        network_mode: "bridge"
        ports:
          - 49000:9001
        environment:
            TZ: "Asia/Jerusalem"

Optional environment variables

Loger level

LOGGING_LEVEL_COM_DMATIK_OREFALERTS_SERVICE: "INFO"

To run in Test Mode

CURRENT_ALERT_TEST_MODE: "TRUE"
CURRENT_ALERT_TEST_MODE_LOC: "אשדוד"

HISTORY_TEST_MODE: "TRUE"

JSON Response Examples

Example for /current endpoint

{
    "alert": true,
    "current": {
        "id": "132944072580000000",
        "cat": "1",
        "title": "ירי טילים ורקטות",
        "data": [
            "סעד",
            "אשדוד - יא,יב,טו,יז,מרינה"
        ],
        "desc": "היכנסו למרחב המוגן"
    }
}

Example for /history endpoint

{
    "history": [
	{
		"alertDate": "2024-07-03 18:45:36",
		"title": "ירי רקטות וטילים",
		"data": "זרעית",
		"category": 1
	},
	{
		"alertDate": "2024-07-03 18:38:03",
		"title": "ירי רקטות וטילים",
		"data": "כפר סאלד",
		"category": 1
	}
    ]
}

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/history
    name: redalert_history
    value_template: 'OK'
    json_attributes:
      - "history"
    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

Java Spring Boot MS to retrieve Israeli Pikud Ha-Oref so called Red Color alerts.

Resources

License

Stars

Watchers

Forks

Packages

No packages published