EHylands / homebridge-anthemreceiver

Homebridge Plugin for Anthem Receiver
Apache License 2.0
7 stars 2 forks source link

Power accessory immediately shows as turned on after it is turned off from Home app #4

Closed keremerkan closed 2 years ago

keremerkan commented 2 years ago

Describe The Bug:

I added a MRX 1140 with version 0.5.2 of the plugin. Also added the power/input accessory as a TV manually. Controlling Home app on iOS 15.4.1. Everything works perfectly with one small bug. When I tap the power accessory to turn off the MRX, it is turned off, but the accessory in Home app immediately turns back on (the receiver itself is not turned on, only the accessory). The issue does not resolve itself unless I force close Home app and reopen it or tap the accessory again to turn it off.

If I turn MRX off via the device remote, or a shortcut from the Shortcuts app, this issue does not occur and the accessory reports its current status correctly and immediately.

To Reproduce:

  1. Open Home app.
  2. Tap the MRX accessory to turn the device on. It turns on the receiver correctly.
  3. Tap the MRX accessory again to turn the receiver off.
  4. The receiver turns off and stays off and the accessory immediately turns back on.
  5. Tap the accessory again. It stays off this time.
  6. When it is tapped again to turn the receiver on, it works correctly. But the issue goes back to the beginning.

Expected behavior:

The accessory needs to keep off after it turns off the receiver. Perhaps a slight script sleep after turning off the device may remedy the issue.

Plugin Config:

         {
            "Host": "xxxxx",
            "Port": 12345,
            "Zone1": {
                "Active": true,
                "Name": "Anthem MRX 1140",
                "Power": false,
                "Mute": false,
                "Input": false,
                "ALM": false,
                "ARC": false,
                "Volume": false
            },
            "Zone2": {
                "Active": false,
                "Power": false,
                "Mute": false,
                "Input": false,
                "Volume": false
            },
            "platform": "AnthemReceiver",
            "name": "Anthem Receiver",
            "_bridge": {
                "username": "xxxxxx",
                "port": 12345
            }
        }

Environment:

EHylands commented 2 years ago

Hi, thank you for providing a bug report. Was also able to reproduce on my setup. Could you try with new version 0.5.3 ? EH

keremerkan commented 2 years ago

Hi Eric,

Just tested it. Works perfectly now. Thanks from a fellow developer for this great plugin. 😊

EHylands commented 2 years ago

Great !

An event emitter was introduce in the wrong scope after a simple copy/paste error ... Corrected the error and made sure accessories initial state were properly set for case when Homebridge is started when receiver is allready powered on.

When the receiver powers on or off, its immediately reports being on or off through the ip command protocol while being unable to accept any commands for a short period. It gets overly complicated to find an easy solution for this because the receiver doesn't report being in the init sequence.

The same problem applies on the receiver web ui. While in the init sequence, you can change a setting on the interface but it will throw an error and revert this setting to previous state.

Will close this issue for the moment.

Please let me known if you have any feature request !

EH

keremerkan commented 2 years ago

I think the firmware is still in early stages. They will improve it in the years to come. Anthem has always been a slow but steady company. I had a MRX 1120 before this one but its network board somehow got broken.

I have everything I want currently. The plugin is perfect and very fast. Works even better than some Android TVs with HomeKit support. Thank you for your time. :)