Skip to content

Fix Hostname Issue (#25) #33

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 19, 2020
Merged

Fix Hostname Issue (#25) #33

merged 5 commits into from
May 19, 2020

Conversation

brentru
Copy link
Member

@brentru brentru commented May 19, 2020

Fixes #25

  • Broker does not need HTTP/HTTPS URL since MQTT brokers will never start with http:// or https:/
  • Removed try/except block which improperly handles IP address strings
  • Removed of TCP_Mode/TLS_Mode in favor of using the interface's tcp or tls mode.

Examples which need to be update to reflect this change

Copy link
Member

@ladyada ladyada left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

didnt test, but trust ya

@brentru
Copy link
Member Author

brentru commented May 19, 2020

#8d53b31 updates FONA examples to disable SSL, bumps baud rate to 9600 baud default in adafruit_fona

hardware test: minimqtt_adafruitio_cellular, Adafruit CircuitPython 5.3.0 on 2020-04-29; Adafruit Metro M4 Express with samd51j19

Attaching to network...
...
Attached to network!
Connecting to network...
Connecting to network...
Connected to network!
Connecting to Adafruit IO...
Connected to Adafruit IO! Listening for topic changes on brubell/feeds/onoff
Sending photocell value: 0...
Sent!
Sending photocell value: 1...
Sent!
Sending photocell value: 2...
Sent!
Sending photocell value: 3...
Sent!
...
Sending photocell value: 13...
Sent!

@brentru
Copy link
Member Author

brentru commented May 19, 2020

Testing a few configurations with a wifi socket on the Adafruit CircuitPython 5.3.0 on 2020-04-29; Adafruit PyPortal with samd51j20


broker = ip address, is_ssl=False

# Set up a MiniMQTT Client
mqtt_client = MQTT.MQTT(
    broker="52.72.201.158",
    username="SNIP",
    is_ssl=False,
    password="SNIP"
)

Output:

Connecting to Adafruit IO...
Connected to Adafruit IO! Listening for topic changes on brubell/feeds/onoff
Sending photocell value: 0...
Sent!
Sending photocell value: 1...
...
Sending photocell value: 20...

broker = io.adafruit.com, is_ssl=True

# Set up a MiniMQTT Client
mqtt_client = MQTT.MQTT(
    broker="io.adafruit.com",
    username="SNIP",
    is_ssl=False,
    password="SNIP"
)

Output

Connected!
Connecting to Adafruit IO...
Connected to Adafruit IO! Listening for topic changes on brubell/feeds/onoff
Sending photocell value: 0...
Sent!
...
Sending photocell value: 8...
Sent!

broker = test.mosquitto.org, is_ssl=False

# Set up a MiniMQTT Client
mqtt_client = MQTT.MQTT(
    broker="test.mosquitto.org",
    username="SNIP",
    is_ssl=False,
    password="SNIP"
)

Output

Connected!
Sending photocell value: 0...
Sent!
Sending photocell value: 1...
Sent!

@brentru
Copy link
Member Author

brentru commented May 19, 2020

Tested Ethernet socket, commit af5936a sets is_ssl=False since W5K has no native SSL/TLS.

Adafruit CircuitPython 5.3.0 on 2020-04-29; Adafruit Feather M4 Express with samd51j19

Output:

Connected to Adafruit IO! Listening for topic changes on brubell/feeds/onoff
Sending photocell value: 0...
Sent!
Sending photocell value: 1...
Sent!
....
Sending photocell value: 20...
Sent!

@brendanm720
Copy link

Thanks, folks!

adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request May 20, 2020
@brentru brentru deleted the fix-hostname branch May 20, 2020 14:37
rtwfroody pushed a commit to rtwfroody/Adafruit_CircuitPython_MiniMQTT that referenced this pull request Sep 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Broker hostname needs to start with http or https otherwise an error is raised
3 participants