Giter Site home page Giter Site logo

oref-alerts-proxy-ms's Introduction

oref-alerts-proxy-ms

build maintenance 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": [
        {
            "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/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'] }}

oref-alerts-proxy-ms's People

Contributors

dmatik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

kolobus

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.