Fixed README.md

A part of the code was not working since it did not call to any variable in the mqtt module (on line 385)

Adding "mqtt_" would make it call a viable variable
pull/471/head
Goosneck 2 years ago committed by GitHub
parent b341f4e5fb
commit 147bfd689e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -382,7 +382,7 @@ The next step for our Internet controlled nightlight is for the server code to s
command = { 'led_on' : payload['light'] < 300 } command = { 'led_on' : payload['light'] < 300 }
print("Sending message:", command) print("Sending message:", command)
client.publish(server_command_topic, json.dumps(command)) mqtt_client.publish(server_command_topic, json.dumps(command))
``` ```
This sends a JSON message to the command topic with the value of `led_on` set to true or false depending on if the light is less than 300 or not. If the light is less than 300, true is sent to instruct the device to turn the LED on. This sends a JSON message to the command topic with the value of `led_on` set to true or false depending on if the light is less than 300 or not. If the light is less than 300, true is sent to instruct the device to turn the LED on.

Loading…
Cancel
Save