Uhhh, this sounds cool. You probably used multiple prompts and combined the generated script snippets manually, right? I mean it wasn’t like “make me script doing this and that” and chatGPT is like “sure, here it is…” and it just works?
It is ‘interesting’ persuading chatgpt to do what you want. It makes pretty accurate guesses to start with, but in the detail, it seems to get bogged down into some sort of loop. However, it is pretty good at tidying up code. My knowledge of python is marginally better than the French language - I can read it and get a vague understanding of what it is saying, but no way can I write it.
The original enquiry I made for the text to speech program was
“using python, write the code for text to speech conversion. Need a gui with field for entering text, bit rate, name of file to be saved(mp3). It needs to be able to speak the text at the selected bit rate. bit rate default to 64k, unless overwritten in gui field. I want it to be able to run with script in any file location. It will need field for directory entry, and others for mp3 file name, text and bit rate. I want it all to take place within python, not google tts.”
It made a good stab at it, my second request was
“it needs to speak the text before saving. Please amend code and show complete code”
There were a few hiccups along the way, mainly due to my not having set up the paths correctly.
This is the free version, at https://chatgpt.com/ It is at the stage of being useful, if you have patience, and realise it is not much more than a glorified search engine.
So I’ve got mqtt to work following your instruction, I’ve subscribed to the report topic, and the printer sends info, but mostly just temperature and wifi signal strength.
I see a lot of HA integration that also use mqtt, but they can get video stream, file name… Etc
Is there another topic I need to subscribe to to get this info?
And side question, is Bambu cloud different from mqttt? Or the same thing, just on Bambu servers?
printer sends a brief report every couple of seconds and a full report twice in a minute or so. There is probably also a command which initiates sending of full report, but I’m not sure which one. File name is reported by the printer once it starts printung. Video stream is probably not a part of mqtt, but I have never tried to figure it out.
is there a way to start new prints? or repeat a print that just finished?
Read here: MQTT for A1 - #25 by Dill
on my p1s, I have to go to it to remove the completed print. I can then use the screen and buttons, reprint the print (on any that are on the sd card) using those controls. If you have an a1 mini, but don’t want to go to the printer, then maybe - https://www.youtube.com/watch?v=lE6dNeJoFbg
yes that works, sorry I guess I didn’t read that well enough before.
as that requires lan mode, I will lose access to being able to see the camera correct?
is there a way you know of to still do this but leave all the cloud functionality? I have already updated my firmware to the latest release.
Yes, there is a way, as I know. You need to generate access credentials using some kind of preliminary API service on bambu cloud. These stay valid for 3 month or so… Unfortunately I can not provide you any further info on how to do that.
I managed to get most of the mqtt commands working but couldn’t get the one to start a print from the sd card to work for some reason.
where did you find these commands or how did you figure them out?
there are different sources, mostly from home assist forum.
Can you send other commands like home or execute gcode lines? Did it work?
If yes, I can imagine that you have used wrong file direction in your command. Sometimes printers store sent 3mf fils in subfolders like “cache” so you need to I clude it into your file path.
Best source of info I’ve found on relevant APIs (HTTP, FTP and MQTT) are documented on GitHub (OpenBambuAPI)
Not tested on an A1, but my P1S will only accept a print.project_file command on the local MQTT server when in LAN only mode. The Cloud MQTT server will accept it tho
how do I connect to cloud mqtt, the api you referenced shows this
" Username: u_{USER_ID}
, where the user id can be grabbed by cracking your own {ACCESS_TOKEN}
(which is a JWT) and reading its preferred_username
field."
how do I get the information its referencing, is the access token the same as the access code or is it talking about something completely different?
edit: I think I got my acess token, but im not sure how to decode it now, I got a message that looks like this(some letter and numbers changed):
{
“accessToken”: “AAAZY-UOOJ7cqfiN-SKER6AatS7oc5ZM8CP8fX6Qzun8nGPHnnNMYBjXaHSpJZScgAk06BZZKDGcneN982LhB4vSVGNXk4H8xdCc1adM9Dutq7_Yc7XmKQEY9dH7h5mnETLznQe6WVOdQB7v”,
“refreshToken”: “AAAZY-UOOJ7cqfiN-SKER6AatS7oc5ZM8CP8fX6Qzun8nGPHnnNMYBjXaHSpJZScgAk06BZZKDGcneN982LhB4vSVGNXk4H8xdCc1adM9Dutq7_Yc7XmKQEY9dH7h5mnETLznQe6WVOdQB7v”,
“expiresIn”: 7776000,
“refreshExpiresIn”: 7776000,
“tfaKey”: “”,
“accessMethod”: “”,
“loginType”: “”
}
I’ve ended up getting the user-id from the projects endpoint.
thank you, I ended up figuring it out yesterday anyways and im pretty sure that’s how I got the user id also.
I’m surprised how difficult it was for me to find all the information needed.
Yeah, Bambu aren’t exactly advertising their APIs. Things change from time to time too. Still trying to work out how to get my P1S to accept an http URL to start a print
yeh, hopefully things don’t change too soon and break the code im working on.
Do you happen to know of a way to get an image from the camera on the p1s either through mqtt or over the api?
I’ve been digging through the ha-bambulab repo but I’m having a hard time deciphering it and finding out exactly how it gets an image from the camera.
I haven’t tried to do this myself, but the ha-bambulab code looks as tho it is doing it with their ChamberImageThread class (bambu_client.py). They create a TSL connection directly to the printer (local IP address I think) and authenticate with what looks like the same credentials as you would do with the local MQTT server. Then read bytes until they reach the expected image size
Just for people reading this later. For my X1 I can control it using local mqtt even when connected to the cloud but for the A1 mini it has to be in lan mode to control things via mqtt. They both will send status messages regardless but control of the A1 mini only works in LAN mode with the latest firmware as of 12/15/24.
There is a way of get information about the remaining time? I cange the the current percent but, I dont see any event that shows the remaining time