Code Monkey home page Code Monkey logo

redalert's Introduction

Red Alert Docker


Ubuntu based image running python script that reads json from Oref Website.
and publishes it over MQTT Protocol.

Base Image

From ubuntu:18.04 described here.

18/05/2021 Major update

Thanks to the amazing work of @caronc on the apprise you can now send notification using variety of notification channels, like:

And much musch more. you can find it all on the project Wiki.

This update also contains:

  • Reducing the length of the data sends over the Mqtt prorocol, it is now contains regions only.
  • Added detaild log.
  • Fixed the bug that causing sendind multiple alerts.

Image configuration

Enviroment variables

  • MQTT_HOST
    used for setting the MQTT Broker address, default value is 127.0.0.1.
  • MQTT_PORT
    used for setting the MQTT Broker Port, default value is 1883.
  • MQTT_USER
    used for setting the MQTT Broker Username, default value is user.
  • MQTT_PASS
    used for setting the MQTT Broker Password, default value is password.
  • DEBUG_MODE
    used for setting the script to run in test mode wich will read json from test url.
  • INCLUDE_TEST_ALERTS
    used to show pikud ha oref tests, default is False.
  • REGION
    used for setting the region for monitoring. default is * (any)
  • NOTIFIERS
    use apprise notification. you can use multiple notifiers separated by space python for example:
    tgram://bottoken/ChatID hassio://user@hostname/accesstoken slack://TokenA/TokenB/TokenC/Channel
  • MQTT_TOPIC
    Custom MQTT Topic. default value is /redalert

Usage

Run from hub

docker run from hub

docker run  -e MQTT_HOST="broker ip / fqdn" -e MQTT_PORT="1883" -e MQTT_USER="username" -e MQTT_PASS="password" -e DEBUG_MODE="False" -e REGION="*" --name redalert techblog/redalert:latest

docker-compose from hub

version: "3.6"
services:
  redalert:
    image: techblog/redalert
    container_name: redalert
    restart: always
    environment:
      - MQTT_HOST=[Broker Address]
      - MQTT_USER=[Broker Username]
      - MQTT_PASS=[Broker Password]
      - DEBUG_MODE=False
      - REGION=[* for any or region name)
      - NOTIFIERS=[Apprise notifiers]
      - INCLUDE_TEST_ALERTS=[False|True]
      - GREEN_API_INSTANCE = #GREEN_API_INSTANCE
      - GREEN_API_TOKEN = #GREEN_API_TOKEN
      - WHATSAPP_NUMBER = #WHATSAPP_NUMBER
    restart: unless-stopped

Adding Sensor in Home-Assistant

Get full json (including date and id)

  - platform: mqtt
    name: "Red Alert"
    state_topic: "/redalert/"
    # unit_of_measurement: '%'
    icon: fas:broadcast-tower
    value_template: "{{ value_json }}"
    qos: 1

Get json with alert areas only

  - platform: mqtt
    name: "Red Alert"
    state_topic: "/redalert/"
    # unit_of_measurement: '%'
    icon: fas:broadcast-tower
    value_template: "{{ value_json.data }}"
    qos: 1

Alaram state (Value will be on/off)

  - platform: mqtt
    name: "Red Alert"
    state_topic: "/redalert/alarm"
    icon: fas:broadcast-tower
    value_template: "{{ value_json }}"
    qos: 1

redalert's People

Contributors

dimagoltsman avatar guykh avatar t0mer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

redalert's Issues

/usr/bin/python3: no such file or directory

Tried running with the image in the dockerhub and i recive this error

docker run -e MQTT_HOST="192.168.3.100" -e MQTT_PORT="1883" -e MQTT_USER="username" -e MQTT_PASS="password" -e DEBUG_MODE="True" --rm techblog/redalert:latest

docker: Error response from daemon: OCI runtime create failed: container_linux.go:346: starting container process caused "exec: "/usr/bin/python3": stat /usr/bin/python3: no such file or directory": unknown.

thnx

MQTT /redalert/alarm is always off

Hi, I use this service on docker, but even when I set the region to *, and even though I see the alert in the container logs, the /redalert/alarm topic always return off, and /redalert topic return "No active alerts" (when there is alarm).
What could be the reason for this?

fix typing error

hi,
on the docker-compose from hub example in the readme

  • MQTT_HOST=[Broker Address] needs one more space
    took me sometime to realize why it's not working for me.

thank you for the great work you are doing...

Homebridge compatibility

amazing idea!
but could you please make it available as homebridge plugin?
should be very similar to that one.

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.