Changeset - 4e6bb9d5589a
[Not reviewed]
default
0 1 0
virii - 6 years ago 2018-12-28 17:17:35

MQTT support added
1 file changed with 7 insertions and 7 deletions:
dash.pl
7
7
0 comments (0 inline, 0 general)
dash.pl
Show inline comments
 
@@ -17,20 +17,20 @@ my ($mqtt, $topic, $message, $mqttuser, 
 

	
 
$status   = "https://spaceapi.c3l.lu/status.json";              # SpaceAPI direct link to status json file
 
$site     = "https://spaceapi.c3l.lu/open";                     # SpaceAPI direct link to change the state
 
$user     = "ledashbutton";                                     # SpaceAPI user
 
$pass     = "sohNgei3raiche2choo5";                             # SpaceAPI pass
 
$mqttIP   = "192.168.1.189";                                    # MQTT Server IP
 
$mqttuser = "dashbutton";                                       # MQTT User
 
$mqttpass = "oosahN0a";                                         # MQTT Pass
 
$user     = "";                                                 # SpaceAPI user
 
$pass     = "";                                                 # SpaceAPI pass
 
$mqttIP   = "127.0.0.1";                                        # MQTT Server IP
 
$mqttuser = "";                                                 # MQTT User
 
$mqttpass = "";                                                 # MQTT Pass
 
$mqttonly = "True";                                             # MQTT Only modus active = not changing Space Status by myself
 
$mac      = '78:e1:03:78:4a:0a';                                # MAC of Dash button.
 
$mac      = 'de:ad:be:ef:0a:0a';                                # MAC of Dash button.
 
$timeout  = 60;                                                 # Timeout in seconds.
 

	
 

	
 
$ENV{'MQTT_SIMPLE_ALLOW_INSECURE_LOGIN'} = 1;                   # Needed for the MQTT Login
 

	
 
$mqtt = Net::MQTT::Simple->new($mqttIP);
 
$mqtt->last_will("availability/dashbutton", "offline", 1);
 
$mqtt->last_will("availability/dashbutton", "offline", 1);      # YOu may need to change the Topic
 
$mqtt->login($mqttuser, $mqttpass);
 
$mqtt->retain("availability/dashbutton", "online");
 

	
0 comments (0 inline, 0 general)