Merge pull request #71 from hjelev/dev
add payload_press configuration to make mqtt message differ
This commit is contained in:
@@ -320,6 +320,7 @@ def config_json(what_config):
|
|||||||
data["icon"] = "mdi:restart"
|
data["icon"] = "mdi:restart"
|
||||||
data["name"] = "System Restart"
|
data["name"] = "System Restart"
|
||||||
data["command_topic"] = "homeassistant/update/" + hostname + "/command"
|
data["command_topic"] = "homeassistant/update/" + hostname + "/command"
|
||||||
|
data["payload_press"] = "restart"
|
||||||
else:
|
else:
|
||||||
return ""
|
return ""
|
||||||
# Return our built discovery config
|
# Return our built discovery config
|
||||||
@@ -587,7 +588,7 @@ def on_message(client, userdata, msg):
|
|||||||
thread1.join() # Wait for thread1 to finish
|
thread1.join() # Wait for thread1 to finish
|
||||||
thread2.join() # Wait for thread2 to finish
|
thread2.join() # Wait for thread2 to finish
|
||||||
sys.exit(0) # Exit the script
|
sys.exit(0) # Exit the script
|
||||||
elif msg.payload.decode() == "PRESS":
|
elif msg.payload.decode() == "restart":
|
||||||
print("Restarting the application...")
|
print("Restarting the application...")
|
||||||
# restart the system
|
# restart the system
|
||||||
print("Restarting the system...")
|
print("Restarting the system...")
|
||||||
|
|||||||
Reference in New Issue
Block a user