Skip to content
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

Format of MQTT server #7

Open
LukeMondy opened this issue Oct 26, 2022 · 7 comments
Open

Format of MQTT server #7

LukeMondy opened this issue Oct 26, 2022 · 7 comments

Comments

@LukeMondy
Copy link

- <img src="https://github.com/gumslone/tehybug/blob/master/tehybug_co2_firmware/images/config.png?raw=true">

Does the MQTT server need to have a port specified?

e.g., will mqtt.home.com work, or would it need to be: mqtt.home.com:1883

Could you also specify some more details about what topics it will publish?
I'm having trouble getting it to talk to my mqtt server, but I'm not sure what to look for.

@gumslone
Copy link
Owner

Hi,

you have to provide only the tld like mqtt.home.com or the IP address, without a port.

Port 1883 will be used for the MQTT communication, there is no way to define a custom port with current firmware.

Thanks

@gumslone
Copy link
Owner

the sensor data is located inside the homeassistant topic,
you can browse the topic with a MQTT Explorerr App

@LukeMondy
Copy link
Author

Great, thanks!

I've done a packet capture, and I can see the device talking to my MQTT server - but unfortunately, now it's saying that the "Connection Refused: not authorized"

I simply copied and pasted the mqtt password from my password manager to the wifi configure screen, and it works OK on Tasmota devices (for example).

The password is quite long though: it's 64 characters (I think that was what was generated by Home Assistant). Is there is a limit for the TeHyBug?


Actually, I just checked my packet capture, and it has the MQTT connect command. Notably it says:

User Name Length: 0
User Name :
Password Length: 24
Password: (the first 24 chars of the mqtt password)

Not sure why the username is 0 length, but yes, the password is missing 40 chars too.

@LukeMondy
Copy link
Author

Ah, I see 😅

char password[24] = "";

@gumslone
Copy link
Owner

Hi, I have increased the password size to 65 charactes

@LukeMondy
Copy link
Author

LukeMondy commented Nov 1, 2022

Hey, thanks,

I've updated the firmware, but for some reason the bug is not letting me reset the wifi settings.

When I hold the mode button for 15 seconds, the LED goes blue, but then after a little while (20 seconds), it goes back to green, and no wifi from the bug shows up. It also comes back on to the network, so I can reach it for the /update page or other functions.

But since I can't reset the wifi details, I can't test if I can put in a longer password for the mqtt server.

If I look at the serial output when I do a wifi reset, I get:

long click                                                                                                        
                                                                                                                  
reset wifi                                                                                                        
                                                                                                                  
                                                                                                                  
 ets Jan  8 2013,rst cause:2, boot mode:(3,7)                                                                     
                                                                                                                  
load 0x4010f000, len 3460, room 16                                                                                
tail 4                                                                                                            
chksum 0xcc                                                                                                       
load 0x3fff20b8, len 40, room 4                                                                                   
tail 4                                                                                                            
chksum 0xc9                                                                                                       
csum 0xc9                                                                                                         
v0006e360                                                                                                         
~ld                                                                                                               
Scanning...                                                                                                       
I2C device found at address 0x38  !                                                                               
I2C device found at address 0x62  !                                                                               
I2C device found at address 0x77  !                                                                               
done                                                                                                              
                                                                                                                  
                                                                                                                  
Sensor type: BMP280     

Button Demo                                                                                                       
 Longpress Time: 1000ms                                                                                           
 DoubleClick Time: 400ms                  +-----------------------------+                                         
 Longpress Time: 1000ms                   |                             |                                         
 DoubleClick Time: 400ms                  |  Cannot open /dev/ttyUSB0!  |                                         
 Longpress Time: 15000ms                  |                             |                                         
 DoubleClick Time: 400ms                  +-----------------------------+                                         
                                                                                                                  
                                                                                                                  
Hello from esp8266-tehybug-co2-sensor                                                                             
Core Version: 3.0.2                                                                                               
                   Boot Version: 31                                                                               
                                   Boot Mode: 1                                                                   
                                               CPU Frequency: 80 MHz                                              
                                                                    Reset reason: Software/System restart         
                                                                                                         HostnameA
                                                                                                                 7
                                                                                                                 e
                                                                                                                 C
Pressure:    969 hPa                                                                                              
Altitude:    482.95 m                                                                                             
                                                                                                                  
humidity: 34%    temperature: 24.2                                                                                
                                                                                                                  
CO2(ppm):670    Temperature(C):36.2     Humidity(%RH):19.5                                                        
Temperature: 25.10 C                                                                                              
Pressure:    969 hPa                                                                                              
Altitude:    482.95 m                                 

(don't worry about the Cannot open /dev/ttyUSB0!, that's just from the program I'm using)

I got the latest firmware from today: https://github.com/gumslone/tehybug/blob/f0ead97b1b2bafae8d778b305eb4ba2f8d2ac7f6/tehybug_co2_firmware/tehybug_co2_firmware.ino.esp8285.bin

@LukeMondy
Copy link
Author

Latest firmware fixes it! It shows up in Home Assistant now - great, thanks!

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

2 participants