ToddGreenfield / homebridge-onkyo

Homebridge module for Onkyo Receivers
ISC License
39 stars 23 forks source link

Warning from the characteristic 'Volume' - error message #100

Open JSVarga opened 3 years ago

JSVarga commented 3 years ago

Describe the bug Error message: [3/2/2021, 3:59:02 PM] [homebridge-onkyo] This plugin generated a warning from the characteristic 'Volume': characteristic was expected valid number and received NaN. See https://git.io/JtMGR for more info.

To Reproduce Information on your Onkyo receiver:

  1. Model information TX-NR609
solowalker27 commented 3 years ago

Volume and Mute are intentionally added as characteristics so they can be used directly on the accessory via third party apps. The way to fix this warning would be to not include those. That would be a breaking change and I believe plenty of people are relying on this functionality as there's still no native way of controlling volume on a Tab accessory.

jondthompson commented 3 years ago

I'm going to add this error here because it's similar, and I got it today.

[homebridge-onkyo] This plugin generated a warning from the characteristic 'Active Identifier': characteristic was supplied illegal value: null! Home App will reject null for Apple defined characteristics. See https://git.io/JtMGR for more info.

jondthompson commented 3 years ago

Found the smoking gun...

async getAlarmState(callback) {
        debug('getting state for Alarm'+this.name);
        if(await this._getStateFromAlarm(false) && this.alarmSystem.state) 
            callback(null,this.alarmSystem.state);
        else
            callback('get state failed or null',null); 
    }

    async getSwitchState(switchType, callback) {
        /* 0 = stay, 1 = away, 2 = night, 3 = disarmed, 4 = alarm */
        debug('getting state for Switch '+ switchType);
        await this._getStateFromAlarm(false);
        if(switchType == 'panic' && this.alarmSystem.state==4)
            callback(null,true);
        else if ((switchType == 'stay' || switchType == 'home') && this.alarmSystem.state==0)
            callback(null,true);
        else if (switchType == 'away' && this.alarmSystem.state==1)
            callback(null,true);
        else if (switchType == 'night' && this.alarmSystem.state==2)
            callback(null,true);
        else
            callback(null,false);
    }

getSwitchState() is for switches coming from the alarm system, not from homekit. getAlarmState() on the other hand works fine as long as stay isn't used because of && this.alarmSystem.state despite all of its logic being in the wrong function.

I'm working on a fix right now.

rsuaver commented 3 years ago

Getting this - assuming it's the same bug?

This plugin generated a warning from the characteristic 'Volume': characteristic was supplied illegal value: number 127 exceeded maximum of 100. See https://git.io/JtMGR for more info.

BenS89 commented 3 years ago

I can confirm the error. Plugin version: homebridge-onkyo v2021.28.1 TX NR 696

[homebridge-onkyo] This plugin generated a warning from the characteristic 'Volume': characteristic was supplied illegal value: number 157 exceeded maximum of 100. See https://git.io/JtMGR for more info.

rsuaver commented 2 years ago

It looks like this happens when "Map Max Volume to 100%" is unchecked (or map_volume_100 is not set or not true). Checking this option and reloading no longer shows the message.

JSVarga commented 2 years ago

Tried changing this setting, and stripped down to minimum option, and still crashes by Homebridge or at least stops it running to disable the plug in again.