andig / homebridge-fritz

Homebridge platform for Fritz!Box router and supported DECT devices
MIT License
74 stars 22 forks source link

This plugin generated a warning from the characteristic 'Target Temperature': characteristic value expected valid finite number and received "NaN" (number). #169

Open appliko opened 3 years ago

appliko commented 3 years ago

I'm getting multiple times this warning, on all my 301 valves

[homebridge-fritz] This plugin generated a warning from the characteristic 'Target Temperature': characteristic value expected valid finite number and received "NaN" (number). See https://git.io/JtMGR for more info.

Could it be because the valves are in off mode ?

JoMensdorf commented 2 years ago

Hi! I am getting the same for my FRITZ!DECT 200: [3.9.2021, 10:41:23] [homebridge-fritz] This plugin generated a warning from the characteristic 'Energy Consumption': characteristic was expected valid number and received NaN. See https://git.io/JtMGR for more info. [3.9.2021, 10:41:23] [homebridge-fritz] This plugin generated a warning from the characteristic 'Current Temperature': characteristic was expected valid number and received NaN. See https://git.io/JtMGR for more info.

BionicThomas commented 2 years ago

Hi! For Power und Energy Cosumption I had the same problem. In my set-up it was a device registered on the fritz box that was not reachable / broken / lost. After removing this power outlet device from the Fritz Box the error message is gone. Hence I think it could be down to the API polling for this device and not getting a proper response due to the device not responding at all.

Not sure if it helped in any way but I also added a couple of lines of code to the outlet.js in the lib/accessories folder. I'm not a developer and not really sure if this is the correct place to add such a check. So if you copy it, do it at your own risk and have backups!

in those 2 functions I added sections

   if (power)
        {
        power = 0; 
        }

and

     if (energy)
        {
        energy = 0;
        }

so it looks like this:

FritzOutletAccessory.prototype.queryPowerUsage = function() {
    this.platform.fritz('getSwitchPower', this.ain).then(power => {
        const service = this.services.Outlet;

        if (power)
        {
        power = 0; 
        }

        service.fritzInUse = power > 0;
        service.fritzPowerUsage = power;

        service.getCharacteristic(Characteristic.OutletInUse).updateValue(service.fritzInUse);
        service.getCharacteristic(FritzPlatform.PowerUsage).updateValue(power);
    });
};

FritzOutletAccessory.prototype.getEnergyConsumption = function(callback) {
    this.platform.log(`Getting ${this.type} ${this.ain} energy consumption`);

    callback(null, this.services.Outlet.fritzEnergyConsumption);
    this.queryEnergyConsumption();
};

FritzOutletAccessory.prototype.queryEnergyConsumption = function() {
    this.platform.fritz('getSwitchEnergy', this.ain).then(energy => {
        const service = this.services.Outlet;

        if (energy)
        {
        energy = 0;
        }
        energy = energy / 1000.0;
        service.fritzEnergyConsumption = energy;
        service.getCharacteristic(FritzPlatform.EnergyConsumption).updateValue(energy);
    });
};
disasterdaddy commented 1 year ago

Hi Andig, there are a lot of "This plugin generated a warning from the characteristic ..." belonging to this issue since many months. Is there any solution? I can't find one. I will be happy if I can stop the messages in the log.