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.
docker run -d -p 49000:9001 --name oref-alerts dmatik/oref-alerts:latest
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"
LOGGING_LEVEL_COM_DMATIK_OREFALERTS_SERVICE: "INFO"
CURRENT_ALERT_TEST_MODE: "TRUE"
CURRENT_ALERT_TEST_MODE_LOC: "אשדוד"
HISTORY_TEST_MODE: "TRUE"
{
"alert": true,
"current": {
"id": "132944072580000000",
"cat": "1",
"title": "ירי טילים ורקטות",
"data": [
"סעד",
"אשדוד - יא,יב,טו,יז,מרינה"
],
"desc": "היכנסו למרחב המוגן"
}
}
{
"history": [
{
"alertDate": "2024-07-03 18:45:36",
"title": "ירי רקטות וטילים",
"data": "זרעית",
"category": 1
},
{
"alertDate": "2024-07-03 18:38:03",
"title": "ירי רקטות וטילים",
"data": "כפר סאלד",
"category": 1
}
]
}
sensor:
- platform: rest
resource: http://[YOUR_IP]:49000/current
name: redalert
value_template: 'OK'
json_attributes:
- alert
- current
scan_interval: 5
timeout: 30
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_sensor:
- platform: template
sensors:
redalert_all:
friendly_name: "Redalert All"
value_template: >-
{{ state_attr('sensor.redalert', 'alert') == true }}
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'] }}