c# based windows service that reads json from Oref Website and publishes it over MQTT Protocol and/or Telegram Bot.
In order to install the service download the code and compile it. than move the binary files as listed below in to a new folder under Program Files:
- RedAlert.exe
- RedAlert.exe.config
- Newtonsoft.Json.dll
- M2Mqtt.Net.dll And run the following command from Command line (Make sure to run as admin):
c:\Windows\Microsoft.NET\Framework64\v4.0.30319 "c:\Program Files\RedAlert\RedAlert.exe"
In order to use this service, some configuration need to be done. Open RedAlert.exe.config in any text editor and edit the required settings as follows:
<appSettings>
<!--General Settings-->
<add key="IsDebugMode" value="false"/>
<!--Select Alert Region or * for any-->
<add key="City" value=""/>
<!--Telegrem Bot Settings-->
<add key="IsTelegramEnabled" value="true"/>
<add key="telegramApi" value=""/>
<add key="channelId" value="orefredalert"/>
<add key="telegramApiUrl" value="https://api.telegram.org/bot{0}/sendMessage?chat_id={1}&text={2}"/>
<!--Mqtt Settings-->
<add key="IsMqttEnabled" value="true"/>
<add key="MqttHost" value=""/>
<add key="MqttUser" value=""/>
<add key="MqttPass" value=""/>
<!--UDP Settings-->
<add key="IsUdpEnabled" value=""/>
<add key="UdpAddress" value=""/>
<add key="UdpPort" value=""/>
</appSettings>
- platform: mqtt
name: "Red Alert"
state_topic: "/redalert/"
# unit_of_measurement: '%'
icon: fas:broadcast-tower
value_template: "{{ value_json }}"
qos: 1
- platform: mqtt
name: "Red Alert"
state_topic: "/redalert/"
# unit_of_measurement: '%'
icon: fas:broadcast-tower
value_template: "{{ value_json.data }}"
qos: 1