Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

Broker connection #2

Open
jferdelyi opened this issue Jul 13, 2023 · 2 comments
Open

Broker connection #2

jferdelyi opened this issue Jul 13, 2023 · 2 comments

Comments

@jferdelyi
Copy link
Member

jferdelyi commented Jul 13, 2023

OK, so I decided to just download 3.5 (and 4.1, which apparently came out last week) so that I could see if that unbreaks some the 3.5 projects I've downloaded and had trouble with in 4.0.3.

I was able to load the sample scene with no errors, but I'm not sure what to do with it from there. If I just open the project and run the debug, I see the interface, but the buttons don't seem to do anything and there is no input fields to put in credentials. It seems like I have to put in my MQTT host address, port, username, password, and MQTT topics somewhere in this code, but I can't figure out where.

I see this bit in GDMosquito.gd

##
# About pw_callback
#var pfunc pw_callback(size: 4, rwflag: int) -> String:
#
#func tls_set(p_cafile: String, p_capath: String, p_certfile: String, p_keyfile: String, p_pw_callback: String) -> int:
#
# The string variable p_pw_callback must be the name of a function with this signature:
# 	- func pw_callback(size: int, rwflag: int) -> String:
# Where:
# 	- size is the size of the password buffer (the password should fit on it)
#	- rwflag is ????????
#	- return the paswword
##

And I'm guessing this has something to do with setting the password but I don't understand what to do with it, if anything. And now that I'm looking at it again, there is also a reference to a certfile, which makes me think this is maybe for setting up a new MQTT broker? Is that necessary if I'm already running a Mosquito Broker through my Home Assistant server on my local network?

Is it possible to subscribe a topic (like /homeassistant) and then receive/print MQTT updates from Mosquitto/Home Assistant within the game environment?

Hope these aren't dumb questions, I appreciate your help!

Originally posted by @SamSmith17 in #1 (comment)

@jferdelyi
Copy link
Member Author

Have you configured the MQTT broker directly on the HomeAssistant? (like this https://www.youtube.com/watch?v=8ol5pO7ZZhk)

If you don't have a username and password or TLS: call broker_connect(broker_address, broker_port, broker_keep_alive)
If you have a username and password: call username_pw_set(username, password) before broker_connect (never tested)
If you use TLS: I'm not sure if this is currently possible with my plugin.

GDPaho is more stable and I recommend to use it instead of GDMosquitto, but there is no possibility to set user and password now, I can do it if necessary.

@jferdelyi
Copy link
Member Author

jferdelyi commented Jul 13, 2023

I have modified GDPaho in order to set username and password (https://github.com/GDWired/GDPaho)
Release : https://github.com/GDWired/GDPaho/releases/tag/V0.1

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant