RonnyW
July 25, 2024, 4:52pm
263
Hi @Emile ,
I just want to forward this information about the Tuya internal scale factor to your devs. I don’t know who is responsible while @Doekse is in vacation.
Afaik the device definition provides the multipler. So it can be used while pairing to preset the value in the device. A setting option would be nice nevertheless.
In this example, it’s the scale attribute used to calculate min_max/step based on the scale. And it’s stored in device store to calculate temperatures.
@Doekse
}
}
if (tuyaDevice.functions){
for (let i=0; i<tuyaDevice.functions.length; i++){
let values;
switch (tuyaDevice.functions[i].code){
case "switch":
capabilities.push("onoff");
break;
case "temp_set":
values = JSON.parse(tuyaDevice.functions[i].values);
capabilities.push("target_temperature");
scale = values.scale;
capabilitiesOptions["target_temperature"] =
{
"min": values.min/Math.pow(10,values.scale),
"max": values.max/Math.pow(10,values.scale),
"step": values.step/Math.pow(10,values.scale),
"decimals": values.scale
};
break;
This is just because it was annoced to offer device settings for scale, but it’s already available in device details.
Thanks for forwarding