jvmahon / Homebridge-HomeSeer4

Homebridge Plugin for HomeSeer 3 and 4
28 stars 8 forks source link

Scale is not Celsius or Fahrenheit #162

Closed AlanSmithe closed 2 years ago

AlanSmithe commented 2 years ago

Hi, I'm trying to add some KNX temperature devices however this seems to fail.

[12/16/2021, 9:18:49 PM] Initializing platform accessory 'K1 - Sensor K1 - Temperature'... (node:1464) UnhandledPromiseRejectionWarning: RangeError: Error setting up Temperature Sensor. Scale is not Celsius or Fahrenheit at Object.exports.setupSensor (/usr/lib/node_modules/homebridge-homeseer4/lib/Sensor Setup.js:272:12) at Object.exports.setupServices (/usr/lib/node_modules/homebridge-homeseer4/lib/HomeKitDeviceSetup.js:170:12) at HomeSeerAccessory.getServices (/usr/lib/node_modules/homebridge-homeseer4/index.js:218:11) at BridgeService.createHAPAccessory (/usr/lib/node_modules/homebridge/src/bridgeService.ts:461:41) at /usr/lib/node_modules/homebridge/src/bridgeService.ts:549:34 at Array.forEach () at /usr/lib/node_modules/homebridge/src/bridgeService.ts:539:21 at /usr/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/util/once.ts:9:18 at HomeSeerPlatform.accessories (/usr/lib/node_modules/homebridge-homeseer4/index.js:182:5) at processTicksAndRejections (internal/process/task_queues.js:95:5) (Use node --trace-warnings ... to show where the warning was created) (node:1464) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:1464) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

My config looks like { "type": "TemperatureSensor", "name": "K1 - Temp", "minCelsius": -100, "maxCelsius": 100, "ref": 832 },

And the device status page looks like this:

Screenshot 2021-12-16 at 21 25 53

The Status Graph page:

Screenshot 2021-12-16 at 21 37 21

Even if I add a new value range and limit the decimals to 1 it still fails.

Is there a fix or a workaround?

AlanSmithe commented 2 years ago

Digging around in the code I see the plugin looks at the status value, in my case that's Dim which I cannot edit. Would it be an option to also look at the device string? If that contains a "F" or a "C"?

jvmahon commented 2 years ago

Zoom out a bit on your browser window until you see the control ... image

You then get the range options: image

I think you can then enter " F" or " C" as a suffix There is also a code - you can use, I think its something like @S@ which will insert the appropriate symbol as used by your system. The setup for your temperature sensors should have included the @S@, but ...

jvmahon commented 2 years ago

Another workaround, set up your device using the temperatureUnit "F" or "C", like ...

{ "type": "TemperatureSensor", "name": "K1 - Temp", "minCelsius": -100, "maxCelsius": 100, "ref": 832, "temperatureUnit":"F" },

AlanSmithe commented 2 years ago

I think you can then enter " F" or " C" as a suffix I tried that but that didn't work.

Another workaround, set up your device using the temperatureUnit "F" or "C", like ... Yes this did the trick. I tried searching this in the config folder but I couldn't find an example of it. Thank you very much