Will the mqtt_server = b'secrets.MQTTSERVER' work? Using secrets.py for my internet/pass connection but sending in binary will that work as b'secrets.MQTTSERVER'?Code:
import secretswifi_ssid = secrets.SSIDwifi_password = secrets.PASSWORDmqtt_server = b'secrets.MQTTSERVER'#mqtt_server = b'MQTT_BROKER_URL'mqtt_username = b'BROKER_USERNAME'mqtt_password = b'BROKER_PASSWORD'
No. That will return the literal string b'secrets.MQTTSERVER'. You can see that by running the following:
Code:
foo = b'baz'bar = b'foo'print(foo, bar)You may want to look at the python docs for bytes.decode() and str.edcode().
Edited to fix link tags
Statistics: Posted by thagrol — Sun Feb 09, 2025 11:02 pm





