athombv / homey-web-api-issues

This issue tracker is for Homey Developers using the Web API.
4 stars 1 forks source link

Undocumented temperature conversions "under the hood"? #58

Closed robertklep closed 12 hours ago

robertklep commented 2 months ago

Asked on Slack already but haven't gotten an answer.

I'm trying to track down an issue with HomeKitty where iOS is showing an incorrect temperature (based on a measure_temperature capability). The issue is a "double Fahrenheit conversion".

I found this code in @athombv/homey-core/dist/lib/Device.mjs which seems to be causing my problem:

            this.broadcast('capability', {
                capabilityId,
                transactionId,
                transactionTime,
                value: capability.units === TEMPERATURE_UNITS.CELSIUS && this.homey.isMeasurementSystemImperial()
                    ? HomeyUtil.celsiusToFahrenheit(value, capability.decimals)
                    : value,
            }).catch(this.error);

The capability event is used by Device#makeCapabilityInstance, which is what I use to track capability changes.

It looks like even though the capability unit is set to "Celcius", capability instance listeners will receive a Fahrenheit value if the Homey is set to imperial.

This is rather unexpected because apparently I cannot trust that the capability's value reflects the capability's unit.

Before I work around this problem in my app, I want to make sure that I understand this behaviour correctly and that it's intentional.

robertklep commented 1 month ago

Bump.

robertklep commented 1 month ago

Bump again... 🥱

robertklep commented 3 days ago

@jeroenwienk I'm getting more and more reports about this issue, could you please take a look at it? It's been almost 3 months now...

mkormendy commented 3 days ago

Three bumps and not even a simple reply,... verging on abandoned in my opinion.

ParkFans commented 3 days ago

This is also an issue in their Alexa integration.