Skip to content

AttributeError: 'NoneType' object has no attribute 'write' #908

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

Closed
Ugthak opened this issue Aug 14, 2024 · 0 comments
Closed

AttributeError: 'NoneType' object has no attribute 'write' #908

Ugthak opened this issue Aug 14, 2024 · 0 comments

Comments

@Ugthak
Copy link

Ugthak commented Aug 14, 2024

Hello there,

I'm currently trying to send a message from my Raspberry Pi Pico W to my Node-Red through MQTT.simple with the following snippet of code:

while True:
pin_state = gpio_pin.value()
print(f"Pin state: {pin_state}")
client.publish(MQTT_TOPIC, str(pin_state))
time.sleep(1)

"pin_state" is working as intended so I have no problems collecting the data I wish to but when I run the program I always get the error:
AttributeError: 'NoneType' object has no attribute 'write'

there was a issue previously where someone was suffering from the same issue and the two replies stated that you needed to connect to the broker first, which I have confirmed I am doing, and that it's possible that there isn't a connection to the broker at all; I believe there to be a connection between my Pi and the Broker because no errors are presented and the node within Node-Red does react to the connection.

If any more information is needed to help me, please do ask and I look forward to any help given!

@Ugthak Ugthak closed this as completed Aug 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant