I made an add-on for exposing Flashforge Finder 3D printers as API endpoints to consume as RESTful sensors. Right now I’m using it to get extruder temperature and build progress data.
A hass.io add-on for exposing data from Flashforge Finder(s) as API endpoints for consumption as HA REST sensors. This project is more or less a wrapper around 01F0’s work here: https://github.com/01F0/flashforge-finder-api.
Usage
Install the addon and configure the port that the API will be served on. Default is 5000.
Start the addon. Information about your printer will be available at
http://{homeassistant_ip}:{fff-api_port}/{printer_ip}/{info|head-location|temp|progress|status}
Thanks. This looks very promising, by I haven’t yet gotten it to work with my Finder running firmware v.2.7.2.366 F18 20191224. For example:
http://192.168.86.111:5001/192.168.86.32/status
results in error 500:
Internal Server Error
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.
I also tried with Flask v1.04
Here’s the error from the log:
[2020-04-04 12:40:29,889] ERROR in app: Exception on /192.168.86.32/status [GET]
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/flask/app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "/usr/lib/python2.7/site-packages/flask/app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/lib/python2.7/site-packages/flask_cors/extension.py", line 161, in wrapped_function
return cors_after_request(app.make_response(f(*args, **kwargs)))
File "/usr/lib/python2.7/site-packages/flask/app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/lib/python2.7/site-packages/flask/app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/lib/python2.7/site-packages/flask/app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/fff-api/api/webapi.py", line 59, in status
printer_info = get_status({'ip': ip_address, 'port': PORT})
File "/fff-api/api/protocol.py", line 83, in get_status
send_and_receive(printer_address, request_control_message)
File "/fff-api/api/socket_handler.py", line 14, in send_and_receive
data = printer_socket.recv(BUFFER_SIZE)
timeout: timed out
192.168.86.92 - - [04/Apr/2020 12:40:29] "GET /192.168.86.32/status HTTP/1.1" 500 -
Is the request formatted correctly? Any other tips?
I had the chance to try this again. It was my mistake. Another add-on was assigned to port 5000. I changed the port to 5013, and it now works. For example:
The API is apparently not accessible when FlashPrint is actively connected to the printer, either by WiFi or USB. Calls return 500 Internal Server Error. So, remember to disconnect the printer in FlashPrint or close FlashPrint after sending the GX code.
The other JSON pair returned is by the API call is PercentageCompleted. Its value is always 0 for some reason, but you can make a template sensor to calculate the percentage: