modrzew / hass-flashforge-adventurer-3

Home Assistant integration providing support for the FlashForge Adventurer 3 3D printer.
20 stars 10 forks source link

Flashforge Adventurer 4, 5M, 5M Pro support #17

Open f00d4tehg0dz opened 5 months ago

f00d4tehg0dz commented 5 months ago

-- Need Testing --

Screenshots

configuration-card

card

nozzle-attributes

progress-attributes

state-attributes

gelimelech commented 5 months ago

How do i install this update? πŸ™πŸΎ

f00d4tehg0dz commented 5 months ago

How do i install this update? πŸ™πŸΎ

The normal method won't be available as @modrzew needs to review, ask for changes if necessary and approve the PR, and merge.

For now you can simple download the .zip here:

My card YAML for reference. I'm using the mushroom-entity-card template however.

type: vertical-stack
cards:
  - show_state: false
    show_name: false
    camera_view: auto
    type: picture-entity
    entity: camera.flashforge_adventurer_5m_pro_camera
    camera_image: camera.flashforge_adventurer_5m_pro_camera
    name: Camera
    hold_action:
      action: more-info
  - type: gauge
    entity: sensor.flashforge_adventurer_5m_pro_progress
    name: Progress
  - type: custom:mushroom-entity-card
    entity: sensor.flashforge_adventurer_5m_pro_state
    name: State
  - type: entities
    entities:
      - entity: sensor.flashforge_adventurer_5m_pro_nozzle_temperature
        secondary_info: none
        name: Nozzle
    show_header_toggle: false
gelimelech commented 5 months ago

How do i install this update? πŸ™πŸΎ

How do i install this update? πŸ™πŸΎ

The normal method won't be available as @modrzew needs to review, ask for changes if necessary and approve the PR, and merge.

For now you can simple download the .zip here:

* https://github.com/f00d4tehg0dz/hass-flashforge-adventurer-3/archive/refs/heads/feature/flashforge-adventurer-5m-pro.zip

* Extract the `flashforge_adventurer_3` folder (which is inside the `custom_components` folder)

* Copy the folder to your Home Assistant HACS `custom_components` directory. That could look like /config/home-assistant/custom_components/flashforge_adventurer_3

* Restart Home Assistant

* Add Integration

* Add Flashforge Adventurer 3

* Input your 3D Printers IP and select the model you have

* Add the respective cards to your Home Assistant Dashboard

My card YAML for reference. I'm using the mushroom-entity-card template however.

type: vertical-stack
cards:
  - show_state: false
    show_name: false
    camera_view: auto
    type: picture-entity
    entity: camera.flashforge_adventurer_5m_pro_camera
    camera_image: camera.flashforge_adventurer_5m_pro_camera
    name: Camera
    hold_action:
      action: more-info
  - type: gauge
    entity: sensor.flashforge_adventurer_5m_pro_progress
    name: Progress
  - type: custom:mushroom-entity-card
    entity: sensor.flashforge_adventurer_5m_pro_state
    name: State
  - type: entities
    entities:
      - entity: sensor.flashforge_adventurer_5m_pro_nozzle_temperature
        secondary_info: none
        name: Nozzle
    show_header_toggle: false

Thank you very much! it wotks 😁

mistraller commented 5 months ago
  • Added support for Adventurer 4, 5M and 5M Pro
  • Added selector system for configuration to choose your Flashforge Added regex for additional Adventurer 4 attributes
  • Added support for Flashforge Finder. Same regex as Adventurer 3

-- Need Testing --

  • Flashforge Adventurer 5M
  • Flashforge Adventurer 4

Running your code. Adventurer 5M pro. All seems fine. I had to figure out how to show the attributes in Lovelace though. But it works.

mistraller commented 5 months ago

@f00d4tehg0dz Saw these in logs. (Printer is powered off btw) Logger: homeassistant.helpers.integration_platform Bron: helpers/integration_platform.py:52 First occurred: 00:24:38 (9 gebeurtenissen) Laatst gelogd: 00:26:44

Unexpected error importing FlashForge_adventurer_3/logbook.py Unexpected error importing FlashForge_adventurer_3/system_health.py Unexpected error importing FlashForge_adventurer_3/cast.py Unexpected error importing FlashForge_adventurer_3/energy.py Unexpected error importing FlashForge_adventurer_3/hardware.py Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/integration_platform.py", line 52, in _get_platform return integration.get_platform(platform_name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/loader.py", line 1010, in get_platform return self._load_platform(platform_name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/loader.py", line 1025, in _load_platform cache[full_name] = self._import_platform(platform_name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/loader.py", line 1058, in _import_platform return importlib.import_module(f"{self.pkg_path}.{platform_name}") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/importlib/init.py", line 90, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "", line 1387, in _gcd_import File "", line 1360, in _find_and_load File "", line 1324, in _find_and_load_unlocked ModuleNotFoundError: No module named 'custom_components.flashforge_adventurer_3.diagnostics'

Geoffery10 commented 4 months ago

I tested it on my Flashforge Adventure 5 and it works without issue. πŸ‘

f00d4tehg0dz commented 4 months ago

Can you tell me which printers you've tested these changes on? Sadly I no longer have my Adventurer 3, so we'll need to work around that with testing πŸ˜…

Hey! No problem. Unfortunately, I don't have Adventurer 3 either. I have Flashforge Finder and Flashforge 5M Pro. I made an assumption that the Flashforge 5M would be the same as Flashforge 5M Pro. However, I'm happy to remove that model as it's not best practice to assume. Based on other comments, Adventurer 4 worked as well. I was debating making a specific exception for Flashforge Finder to disable the camera as that model never had one πŸ˜‰

I will go through and revert some of the changes and adjust accordingly based on your comments. Thanks so much for replying back! ❀️

modrzew commented 4 months ago

As I don't have my Adventurer 3 anymore, it's hard for me to verify the changes anymore anyway. So maybe let's leave the 5M under the assumption that it works simialrly to 5M Pro, and in case something goes wrong we can always fix it later πŸ™‚

mistraller commented 4 months ago

As I don't have my Adventurer 3 anymore, it's hard for me to verify the changes anymore anyway. So maybe let's leave the 5M under the assumption that it works simialrly to 5M Pro, and in case something goes wrong we can always fix it later πŸ™‚

Main difference between 5m and 5mpro is camera. Did you test already with the new flashforge firmware? There are many complaints about camera on 5m pro after installing the new 2.6.5 firmware.

f00d4tehg0dz commented 4 months ago

As I don't have my Adventurer 3 anymore, it's hard for me to verify the changes anymore anyway. So maybe let's leave the 5M under the assumption that it works simialrly to 5M Pro, and in case something goes wrong we can always fix it later πŸ™‚

Main difference between 5m and 5mpro is camera. Did you test already with the new flashforge firmware? There are many complaints about camera on 5m pro after installing the new 2.6.5 firmware.

No issues with the camera for 5M Pro. I just installed the new firmware and tested. Works just fine.

I plan on having all the changes submitted by EOW. I'll keep you all posted. Thanks!

timnolte commented 3 months ago

I have just received a 5M, not Pro, so I'd be happy to test and confirm it if needed. Looking forward to having this integration available.

f00d4tehg0dz commented 3 months ago

I have just received a 5M, not Pro, so I'd be happy to test and confirm it if needed. Looking forward to having this integration available.

I'd love for you to test. I just submitted changes in this PR. Feel free to grab the PR and test it out on your HA.

samjones108 commented 3 months ago

Just a ping regarding the adventurer 4,

Progress bar doesn't update when printing stays on 0%. Camera works fine no issues there. state works fine changes between printing/idle.

Not sure if you can pull temperature status on the adventure 4 as that's not showing either.

f00d4tehg0dz commented 3 months ago

Just a ping regarding the adventurer 4,

Progress bar doesn't update when printing stays on 0%. Camera works fine no issues there. state works fine changes between printing/idle.

Not sure if you can pull temperature status on the adventure 4 as that's not showing either.

Was it working before prior to this PR today?

samjones108 commented 3 months ago

Unsure, Just found the addon today. the progress was working with the published version using the adventurer 3 settings but not on the above zip version.

f00d4tehg0dz commented 3 months ago

Unsure, Just found the addon today. the progress was working with the published version using the adventurer 3 settings but not on the above zip version.

Got it. Thanks for clarifying. Let me see if I made a mistake that affected you somewhere.

f00d4tehg0dz commented 3 months ago

Unsure, Just found the addon today. the progress was working with the published version using the adventurer 3 settings but not on the above zip version.

Give this version a shot if you'd like. Progress bar should work now. Regarding the temperature not working, I'm not sure what I'm missing there. I went through @modrzew codebase and it appeared to be similar to mine.

https://github.com/f00d4tehg0dz/hass-flashforge-adventurer-3/archive/refs/tags/v1.0.5.zip

timnolte commented 3 months ago

@f00d4tehg0dz something seems off. I downloaded the 1.0.6 versions from here: https://github.com/f00d4tehg0dz/hass-flashforge-adventurer-3/archive/refs/tags/v1.0.6.zip but when I installed it and restarted HA I get no prompt for selecting my Adventurer model.

timnolte commented 3 months ago

@f00d4tehg0dz something seems off. I downloaded the 1.0.6 versions from here: https://github.com/f00d4tehg0dz/hass-flashforge-adventurer-3/archive/refs/tags/v1.0.6.zip but when I installed it and restarted HA I get no prompt for selecting my Adventurer model.

I'm going to try the v1.0.5.zip to see if it's any different.

f00d4tehg0dz commented 3 months ago

@f00d4tehg0dz something seems off. I downloaded the 1.0.6 versions from here: https://github.com/f00d4tehg0dz/hass-flashforge-adventurer-3/archive/refs/tags/v1.0.6.zip but when I installed it and restarted HA I get no prompt for selecting my Adventurer model.

I'm going to try the v1.0.5.zip to see if it's any different.

aww, dang, that's concerning... When I'm off work, I'll play around and try a fresh install and see.

Did you, by chance, restart HA entirely? Or a refresh? ( I realize you said restart, but just in case...)

timnolte commented 3 months ago

@f00d4tehg0dz something seems off. I downloaded the 1.0.6 versions from here: https://github.com/f00d4tehg0dz/hass-flashforge-adventurer-3/archive/refs/tags/v1.0.6.zip but when I installed it and restarted HA I get no prompt for selecting my Adventurer model.

I'm going to try the v1.0.5.zip to see if it's any different.

aww, dang, that's concerning... When I'm off work, I'll play around and try a fresh install and see.

Did you, by chance, restart HA entirely? Or a refresh? ( I realize you said restart, but just in case...)

So, I'm not sure what's going on, the v1.0.5.zip is also not working. Yes, I did a full HA restart. I never had the integration installed and I can see that it's not present before a restart but is afterwards. I'm going to try the zip archive of your branch instead of the tags. Oh, wait a minute. So yeah, your tags in your repo both v1.0.5 and v1.0.6 are of the same commit.

image

And looking at the source of that commit and you aren't actually tagging your commits.

image

f00d4tehg0dz commented 3 months ago

@f00d4tehg0dz something seems off. I downloaded the 1.0.6 versions from here: https://github.com/f00d4tehg0dz/hass-flashforge-adventurer-3/archive/refs/tags/v1.0.6.zip but when I installed it and restarted HA I get no prompt for selecting my Adventurer model.

So, I'm not sure what's going on, the v1.0.5.zip is also not working. Yes, I did a full HA restart. I never had the integration installed and I can see that it's not present before a restart but is afterwards. I'm going to try the zip archive of your branch instead of the tags. Oh, wait a minute. So yeah, your tags in your repo both v1.0.5 and v1.0.6 are of the same commit.

And looking at the source of that commit and you aren't actually tagging your commits.

Holy cow. You're right. https://github.com/f00d4tehg0dz/hass-flashforge-adventurer-3/releases/tag/v1.0.7 Now it's tagged correctly. Yikes. Thank you for catching this!

mistraller commented 3 months ago

Thinking about layers-to-print and layers done; is that not just the way how the progress is calculated? My AD5M shows it progress the same way; if the last layers are less work (and that is most of the time unless I'm printing a cube ;) ), the precentage will go much quicker.

timnolte commented 3 months ago

So I just happened to take a look at the state when my print job was finished and there are a bunch of attributes that are already available. If you want to display them you could easily create some custom sensors to display those values in a dedicated way.

Screenshot_20240528-181743.png

timnolte commented 3 months ago

Something that is interesting with those values is that the print job is complete at 100% but it says it printing layer 401 with all layers being 411. πŸ€”

f00d4tehg0dz commented 3 months ago

So I just happened to take a look at the state when my print job was finished and there are a bunch of attributes that are already available. If you want to display them you could easily create some custom sensors to display those values in a dedicated way.

Correct, that is intentional. You can use an Entity card to split out each attribute. I just took a screenshot of a current print. I originally had included one of the attributes as a sensor. However, during the PR review, it was requested to remove that sensor and leave all as attributes. image

f00d4tehg0dz commented 3 months ago

Something that is interesting with those values is that the print job is complete at 100% but it says it printing layer 401 with all layers being 411. πŸ€”

That is interesting. I'll do some debugging on that. I had increased the update interval to 30 seconds from 60 seconds. However, the layers shouldn't have been off that much...

timnolte commented 3 months ago

Something that is interesting with those values is that the print job is complete at 100% but it says it printing layer 401 with all layers being 411. πŸ€”

That is interesting. I'll do some debugging on that. I had increased the update interval to 30 seconds from 60 seconds. However, the layers shouldn't have been off that much...

So here is something equally strange. The total layers is showing as the same value as the current layer during printing.

Screenshot_20240529-191334.png

f00d4tehg0dz commented 3 months ago

Something that is interesting with those values is that the print job is complete at 100% but it says it printing layer 401 with all layers being 411. πŸ€”

That is interesting. I'll do some debugging on that. I had increased the update interval to 30 seconds from 60 seconds. However, the layers shouldn't have been off that much...

So here is something equally strange. The total layers is showing as the same value as the current layer during printing.

I may limit the total layer to Adventurer 4 and 5M Pro, as they appear to be working there. I highly doubt the 5M would be any different, though.

timnolte commented 3 months ago

Something that is interesting with those values is that the print job is complete at 100% but it says it printing layer 401 with all layers being 411. πŸ€”

That is interesting. I'll do some debugging on that. I had increased the update interval to 30 seconds from 60 seconds. However, the layers shouldn't have been off that much...

So here is something equally strange. The total layers is showing as the same value as the current layer during printing.

I may limit the total layer to Adventurer 4 and 5M Pro, as they appear to be working there. I highly doubt the 5M would be any different, though.

To a degree, other than the prebuilt enclosure and hardware (the camera and the air filtration system), I thought that the 5M Pro software was essentially the same as the 5M.

timnolte commented 3 months ago

I'll be honest that I really feel like this integration should be providing an actual Adventurer device that encompasses the entities and that all of these attributes should actually just be sensors of that device with a small set of them enabled by default with the rest not enabled. Being forced to create all of the sensors manually or setup custom cards to display attributes is a pain. Not to mention that without custom sensors you can't capture graphs of say temperature changes over time or things like the actual printing state over time. I still can't get my HA notifications to work right with this setup to notify me when the printing is finished.

f00d4tehg0dz commented 3 months ago

I'll be honest that I really feel like this integration should be providing an actual Adventurer device that encompasses the entities and that all of these attributes should actually just be sensors of that device with a small set of them enabled by default with the rest not enabled. Being forced to create all of the sensors manually or setup custom cards to display attributes is a pain. Not to mention that without custom sensors you can't capture graphs of say temperature changes over time or things like the actual printing state over time. I still can't get my HA notifications to work right with this setup to notify me when the printing is finished.

Noted. And I don't disagree with you. Creating the sensors is certainly doable, I could continue this project with a sensor variant on a separate repo.

f00d4tehg0dz commented 3 months ago

gree with you. Creating the sensors is certainly doable, I could continue this project with a sensor variant on a separate repo.

@modrzew, what's your opinion on this? I don't want to create a bunch of sensors if you disagree. FWIW, I just installed the Klipper mod to my 5MP (easily reversible) to build out the Rabbit feeder mod (8 or more color filament automation) to support Klipper on HA for 5MP. I'll need to modify your source code to further support a Klipper variant. At which point it might make sense to fork and go on my own path. However, I want to hear your thoughts and concerns!

timnolte commented 3 months ago

gree with you. Creating the sensors is certainly doable, I could continue this project with a sensor variant on a separate repo.

@modrzew, what's your opinion on this? I don't want to create a bunch of sensors if you disagree. FWIW, I just installed the Klipper mod to my 5MP (easily reversible) to build out the Rabbit feeder mod (8 or more color filament automation) to support Klipper on HA for 5MP. I'll need to modify your source code to further support a Klipper variant. At which point it might make sense to fork and go on my own path. However, I want to hear your thoughts and concerns!

@f00d4tehg0dz & @modrzew just to be clear I'm not advocating the creation of a device and more sensors in this branch. I'd actually say let's push that to a new set of work so as not to delay a baseline of 4 & 5M/5MP support.

f00d4tehg0dz commented 3 months ago

gree with you. Creating the sensors is certainly doable, I could continue this project with a sensor variant on a separate repo.

@modrzew, what's your opinion on this? I don't want to create a bunch of sensors if you disagree. FWIW, I just installed the Klipper mod to my 5MP (easily reversible) to build out the Rabbit feeder mod (8 or more color filament automation) to support Klipper on HA for 5MP. I'll need to modify your source code to further support a Klipper variant. At which point it might make sense to fork and go on my own path. However, I want to hear your thoughts and concerns!

@f00d4tehg0dz & @modrzew just to be clear I'm not advocating the creation of a device and more sensors in this branch. I'd actually say let's push that to a new set of work so as not to delay a baseline of 4 & 5M/5MP support.

Ah sorry. I misunderstood your previous comments on this. Thanks for clarifying!

modrzew commented 3 months ago

Hey both, thank you for your input so far! I don't mind this integration having more sensors. I didn't have any grand vision when I put things like temperatures in the attributes, rather than creating separate sensors for them β€”Β it was purely driven by what I needed in my dashboard at the time, and I simply thought "I don't need to track these, let's chuck them in attributes" πŸ˜„ also +1 to doing this work outside of this branch β€”Β let's keep this one about supporting more printers.

Moreover, I'm less invested in this integration right now as I parted ways with my Adventurer 3 a few months ago β€” I'm not using it anymore, and I can't even test the changes.

@f00d4tehg0dz I think it might be best for you to continue the development in your fork, if you're keen. Once you're happy with it we can swap the reference in HACS to point to it rather than to this repo, and I can archive this one. WDYT?

(This might also be an opportunity to rename the repo/integration, since it's no longer just Adventurer 3 πŸ™‚)

timnolte commented 3 months ago

So not sure where things stand. For the most part I'm generally having good success with the Adventurer 5M support. I even setup my own dedicated 3D Printing monitoring dashboard in HA.

Screenshot_20240602-235707.png

I use a Tapo smart security camera for my monitoring so haven't tested the built-in camera support functionality. I also have print finished notifications working through HA. Since I also have my printer plugged into a smart plug, and smart LED lights, I've setup an "auto-off" after print completion functionality that turns everything off which is also working great.

rsnodgrass commented 2 months ago

Thanks for adding more sensors! I was just looking into doing similar, but saw this PR was open.

One additional sensor I was considering adding was a device_class 'running' binary_sensor that is true when the printer is printing. I found basing automations off *_progress going to 0 was more problematic than just having a binary_sensor helper.

Here is my example helper:

template:                                                                                               
  - binary_sensor:                                                                                      
      # NOTE: Need a special binary_sensor to track printer running state
      # since the resolution of checking the FlashForge 3 progress sensor
      # sometimes goes from 97/98 percent to 0 (instead of 99/100).
      - name: FlashForge Adventure 3 Running
        device_class: running
        state: >
          {{ states('sensor.flashforge_adventurer_3_progress') > 0 }}

This *_running binary_sensor probably should just be exposed by default through the integration.

@modrzew Look forward to this being merged!

rsnodgrass commented 2 months ago

@modrzew Just saw your note about not having a FF printer anymore and you don't have time for this anymore. Maybe adding permissions for @f00d4tehg0dz to approve merges/update this repo eases the transition until HACS is update. Then the community has an "owner" that is actively maintaining this in the interim. THANK YOU FOR CREATING THIS!

f00d4tehg0dz commented 2 months ago

Great @rsnodgrass I can go ahead and add that!

@modrzew, whatever you decide, I'm okay with it. You're also welcome to DM me on Discord if you want to go over any specifics or concerns f00d4tehg0dz

One thing to note for everyone: I moved from Flashforge stock to Klipper firmware to support the ERCF and am finishing the build. However, switching between Stock and Klipper is super easy, so I can maintain this repo just fine. I plan on adding a Klipper toggle for the AD5M series to bring in the same data :)

modrzew commented 1 month ago

@f00d4tehg0dz do you want to merge this PR instead to the master branch of your fork (https://github.com/f00d4tehg0dz/hass-flashforge-adventurer-3)? Once that's done we can swap the integration link in HACS by changing the reference here: https://github.com/hacs/default/blob/master/integration#L632, and you can then fully take over. I'll also then archive this repo.

timnolte commented 1 month ago

@modrzew & @f00d4tehg0dz something you may want to consider is moving the repository to an Organization. As an OSS maintainer myself this has been the easiest way to make transitions between maintainers instead of having to deal with future path changes and ensuring that everyone using the software is able to successfully make the switch.

rsnodgrass commented 1 month ago

@modrzew & @f00d4tehg0dz something you may want to consider is moving the repository to an Organization. As an OSS maintainer myself this has been the easiest way to make transitions between maintainers instead of having to deal with future path changes and ensuring that everyone using the software is able to successfully make the switch.

Interesting, what project did you do this for? Would love to see how this worked out. Was it one Organization per project?

timnolte commented 1 month ago

@rsnodgrass yes, in the case of a couple of my projects each had their own Organization, this has made it easy to manage maintainers without the need to change repositories. This wasn't for HA add-on but for WordPress plugins but the same concept applies.

f00d4tehg0dz commented 1 month ago

@f00d4tehg0dz do you want to merge this PR instead to the master branch of your fork (https://github.com/f00d4tehg0dz/hass-flashforge-adventurer-3)? Once that's done we can swap the integration link in HACS by changing the reference here: https://github.com/hacs/default/blob/master/integration#L632, and you can then fully take over. I'll also then archive this repo.

Sounds great! I'll get to it this week. New PC, and Windows install so getting all my ducks in a row atm πŸ˜„

f00d4tehg0dz commented 1 month ago

@f00d4tehg0dz do you want to merge this PR instead to the master branch of your fork (https://github.com/f00d4tehg0dz/hass-flashforge-adventurer-3)? Once that's done we can swap the integration link in HACS by changing the reference here: https://github.com/hacs/default/blob/master/integration#L632, and you can then fully take over. I'll also then archive this repo.

Done!

modrzew commented 1 month ago

@f00d4tehg0dz you'll need to ensure that two Github actions are running in your fork: