t0mer / Redalert

Ubuntu based image running python script that reads json from Oref Website. and publishes it over MQTT Protocol.
Apache License 2.0
10 stars 8 forks source link

URLs not accessible? #4

Open wildloveil opened 3 years ago

wildloveil commented 3 years ago

Hi Tomer, Thank you for your greet effort on this project, awesome idea!

I tried to understand where can I get the REGION value from and I noticed both URLS (with debug or not) are not accessible from my Chrome broswer, is that OK or the script is not working at the moment?

The URLs I tried to browse to are: https://techblog.co.il/alerts.json (got connection refused) https://www.oref.org.il/WarningMessages/alert/alerts.json (got Access Denied)

Thanks.

t0mer commented 3 years ago

Hi, You can search your area in the following URL: https://www.oref.org.il//12481-he/Pakar.aspx in the bottom of the screen you will be able to search is. you can also write in down like אשקלון or אשדוד and it will work.

wildloveil commented 3 years ago

Thank you for the quick response! I'm afraid it's not working, even with I run with the default region (i.e *)

The logs from the container are: 2021-05-14 23:40:24.894 | INFO | main::24 - Monitoring alert for := *

2021-05-14 23:40:24.895 | INFO | main::74 - Connecting to broker

2021-05-14 23:40:24.897 | INFO | main::79 - In wait loop

2021-05-14 23:40:25.897 | INFO | main::79 - In wait loop

2021-05-14 23:40:25.898 | INFO | main:on_connect:38 - connected OK Returned code=0

2021-05-14 23:40:26.899 | INFO | main::81 - in Main Loop

But the MQTT does not get an "on" when there is red alert.

Any idea what am I missing?

t0mer commented 3 years ago

I have updated the container and included bug fixing and added new futures

wildloveil commented 10 months ago

Thanks for the inputs, it's been a while and I want once again to run this container, started fresh, used the command from the readme: docker run -e MQTT_HOST="127.0.0.1" -e MQTT_PORT="1883" -e MQTT_USER="username" -e MQTT_PASS="password" -e DEBUG_MODE="False" -e REGION="*" --name redalert techblog/redalert:latest Below is the stdout of the container:

2023-10-14 17:40:55.626 | INFO | main::27 - Monitoring alerts for :* 2023-10-14 17:40:55.627 | INFO | main::76 - Connecting to broker 2023-10-14 17:40:55.628 | INFO | main::81 - In wait loop 2023-10-14 17:40:56.629 | INFO | main::81 - In wait loop 2023-10-14 17:40:56.630 | INFO | main:on_connect:41 - connected OK Returned code=0 2023-10-14 17:40:57.630 | INFO | main::83 - in Main Loop 2023-10-14 17:40:57.631 | INFO | main::88 - Setting Apprise Alert 2023-10-14 17:40:57.632 | INFO | main::91 - Adding: = 2023-10-14 17:40:57.773 | ERROR | main:monitor:129 - Unexpected UTF-8 BOM (decode using utf-8-sig): line 1 column 1 (char 0) 2023-10-14 17:40:58.643 | ERROR | main:monitor:129 - Unexpected UTF-8 BOM (decode using utf-8-sig): line 1 column 1 (char 0) 2023-10-14 17:40:59.646 | ERROR | main:monitor:129 - Unexpected UTF-8 BOM (decode using utf-8-sig): line 1 column 1 (char 0) 2023-10-14 17:41:00.644 | ERROR | main:monitor:129 - Unexpected UTF-8 BOM (decode using utf-8-sig): line 1 column 1 (char 0)

And the last line of error keep repeating in a loop every second, What am I doing wrong?

Thanks!

wildloveil commented 10 months ago

So it looks like the binary Docker image is not updated with the code in the repository, once I built the Dockerfile it appears to be working now (fingers cross I will never be able to test it! :))

A small issue in the MQTT structure in the script, The mqtt topic /redalert is updated with "No active alerts" when no alerts, and "on" when there is an alert. But the /redalert/alarm is only updated to "off" on function alarm_off but no reference to it on function alarm_on so it will remains "off" even if alarm is triggered. Thank you so much for your effort!