sindrebroch / ha-magicmirror

Custom HomeAssistant-integration for MagicMirror
Apache License 2.0
14 stars 0 forks source link

Delay in monitor status - on purpose? Service calls seems strange, no entity? #3

Closed fribse closed 2 years ago

fribse commented 2 years ago

Version of the custom_component

1.4.1

Configuration

billede

Describe the bug

When I turn the monitor on or off, there is a delay on the status shown in Lovelace. Is it 'as designed' or is it a fluke?

The services set up in the integration doesn't show any entity requirement when looking in 'developer tools', which seems like a problem :-)

billede

P.S. I am SUPER excited that you made this integration, it's simply fantastic to not have to set up MQTTBridge like I've had for years now.

fribse commented 2 years ago

Ahh, ok, I can see that you are removing the special service calls, so that part is at least making sense, is the removal of 'binary_sensor' part the reason for the delay in status, it reads the status of the mirror, and with the new switch entity you are going to make it 'optimistic' in the sense that the switch will hold the status itself, and just hope the mirror agrees?

sindrebroch commented 2 years ago

I'm sure there are some optimizations possible to make the switch more responsive. I will take a look at it. I wrote the integration without much experience, but in theory it should fetch new state after POST, so it might just be the delay from the next status-fetch. Making it optimistic might be the best way out if there are no other glaring issues.

Will at it to my internal todo

sindrebroch commented 2 years ago

And also most of the service calls will be deprecated to be replaced by buttons per MagicMirror. For whatever service calls are left I might need a entity, hadn't though of that. Not sure how the integration handles multiple magicmirrors to be honest.

fribse commented 2 years ago

Well, the optimistic approach will of course give faster status updates, as it doesn't check the real status, problem is though, that if the monitor is turned on or off locally, the switch will not reflect that if it's optimistic, so it's a bit damned if you do, and damned if you don't 😆

sindrebroch commented 2 years ago

For sure, I'll try to do some tweaks and see what works best. Maybe we can do optimistic but update if it fails or something?

fribse commented 2 years ago

Yes, that would probably work well if it's doable.

sindrebroch commented 2 years ago

I have released a pre-release v1.2.0b0, which contains optimistic switch as well as some other improvements. All the services have been removed as well, now replaced with button-entities and notify-service. Again not 100% sure how the integration would handle multiple instances, but I'll tackle that at some later time.

I like to test the new releases for a few days before I properly release them, but you can update it to try if you want.

sindrebroch commented 2 years ago

Should be solved by release 1.2.0