adamoutler / anycubic-homeassistant

Home assistant integration for Anycubic Printers.
Other
10 stars 2 forks source link

fix: replace _attr_* properties with their overwritable methods #8

Closed sopelj closed 5 months ago

sopelj commented 5 months ago

The cause of #7 seems to be the two _attr_* methods declared as properties in AnycubicEntityBaseDecorator clash with the ones defined in the base class of Entity. I believe those are supposed to be either set to fixed values or updated in other functions. I think the methods are the ones that are designed to be overwritten if you want to do something dynamic. In this case that would appear to be entity_picture and assumed_state.

adamoutler commented 5 months ago

Thank you. Let's see if it works.

adamoutler commented 5 months ago

Let me know if you can test the head. If so I'll add a new release version.

sopelj commented 5 months ago

Let me know if you can test the head. If so I'll add a new release version.

It definitely fixes the error and the sensors work again. I don't think I've ever seen the picture entity for my Anycubic Mono SE however. So I can't really test that.

adamoutler commented 5 months ago

It's a checkbox in the settings for the integration

sopelj commented 5 months ago

Oh thanks! I'd never notices before. First try it crashed with:

File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 188, in async_setup_entry
raise ValueError("Config entry has already been setup!")
ValueError: Config entry has already been setup!

I had to remove it and re-add it. Second time cheking it, it seems to have loaded, although no entities have pictures. Maybe they only appear when printing? In download diagnostics I do see "use_pictures" is true. I don't see any errors at least.

adamoutler commented 5 months ago

The picture replaces the 3d printer icon and it's a static picture of a monoX black/yellow printer from far enough away that you can't tell which MonoX it is