tixi / Domoticz-Tuya-SmartPlug-Plugin

Domoticz Python Plugin for Tuya Smart Plug
MIT License
23 stars 24 forks source link

Key Error #18

Open xavierlp opened 4 years ago

xavierlp commented 4 years ago

Hello I could see some errors in Domoticz logs. In the line 445

for key in self.__plugs:                
            error = error or self.__plugs[key].update_state(state[str(key)])    
            Devices[key+1].Update(0,str(state[str(self.__ampere)]/1000))    # TypeName="Current (Single)
            Devices[key+2].Update(0,str(state[str(self.__watt)]/10) + ";0") # kWh / Calculated
            Devices[key+3].Update(0,str(state[str(self.__voltage)]/10))     # TypeName="Voltage"
        #   Devices[key+4].Update(0,str(state[str(self.__watt)]/10))        # TypeName="Usage"

If I comment this line , no error.

It seems that the "usage" is added and we can collect 4 indicators.

But I've got an error message if I add more than 3 dps in the UI.

I can't find a solution for this.

Thanks for any feedback.