Hello internet friends!
Today we are releasing an update to our integration with Tuya that will delight many of you using sensors: we are now applying scaling units to the figures that Tuya is sending so you won’t see that your living room is at 2100º anymore, but instead the real 21º!
What’s changed?
Some of you noticed this issue already:
- Tuya Thermostatic Radiator Valves
- Add the ability to do math on Variables
- Ampersand in device name causing Tuya device not to be selectable - #3 by philsj
When we first implemented this integration, we couldn’t find a way to convert the scale of the units from sensors in a way that didn’t involve a lot of hacky code, we just couldn’t find how Tuya was doing it and we suspected a hardcoded solution was implemented on their app. After reviewing intensely the API documentation we found that the information to scale the units was available, albeit in a rather convoluted way!! The good news is that we can implement this in a more sustainable and not hacky way now thanks to the discovery.
Give me some examples!!
Your temperature sensor will say 21º instead of 2100º.
Your lux sensor will say 50 Lux instead of 5000.
Handy! This will help enormously when comparing devices, constants or variables to device values!
This is an example of the old values:
And here’s the new values!
You’ll also see the units of magnitude
Previously we would display numeric attributes but we wouldn’t display if they were volts, amps, watts, degrees Centigrade or Fahrenheit… Now you’ll see the unit that applies to your numeric attribute: V, mA, W, KWh, ºC, etc if they are available for your device (we can’t control what the manufacturer does, sorry!!).
See anything that hasn’t scaled yet?
You need to wait until your device sends an update, then the units will display correctly. Check this example above, the sensor on the right has received the update, the one on the left will do it shortly but it is still displaying the old values.
Please get in touch! Many devices are integrated in weird ways with the Tuya platform and, even if we’ve seen some edge cases that we can account for, you might find a funky device that is escaping all our crafty scaling development. We’d love to hear about it, drop a message below!
There is a small cosmetic display issue for users with Tuya conditions based on values that are now scaled: On the card of the configuration and when entering edit mode, it shows the old, unscaled value (but the logic runs based on adapted values). In those cases, just edit the condition and set the proper value.