jvmahon / Homebridge-HomeSeer4

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

Issue with Homeseer (no F or C specified) #79

Closed homeconnector closed 4 years ago

homeconnector commented 4 years ago

Using Homeseer to OMNI. No C or F is specified causing the code to crash.

See Homeseer Example   | 558 | 13 |   | 13 | Outside | Porch | Temperature Sensor | OMNI-Q191 | OMNI Zones | Today3:09:31 PM |     | 13   | 557 | 18.5 |   | 18.5 | Ground | Family | Temperature Sensor | OMNI-Q184 | OMNI Zones | Today 3:16:31 PM   | 18.5

https://github.com/jvmahon/Homebridge-HomeSeer4/blob/3e9a6b84c53841c7b55b82f91e81d5418f0c94d5/lib/ThermostatSetup.js#L231 Are you able to force an override - optional temperatureUnit (from the previous version)

2|connectm | (node:27321) 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) 2|connectm | (node:27321) [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. 2|connectm | (node:27346) UnhandledPromiseRejectionWarning: RangeError: Error setting up Temperature Sensor. Scale is not Celsius or Fahrenheit 2|connectm | at Object.exports.setupSensor (/usr/local/lib/node_modules/homebridge-homeseer4/lib/Sensor Setup.js:261:12) 2|connectm | at Object.exports.setupServices (/usr/local/lib/node_modules/homebridge-homeseer4/lib/HomeKitDeviceSetup.js:170:12) 2|connectm | at HomeSeerAccessory.getServices (/usr/local/lib/node_modules/homebridge-homeseer4/index.js:218:11) 2|connectm | at Server.createHAPAccessory (/usr/local/lib/node_modules/homebridge/src/server.ts:441:41) 2|connectm | at /usr/local/lib/node_modules/homebridge/src/server.ts:426:34 2|connectm | at Array.forEach () 2|connectm | at /usr/local/lib/node_modules/homebridge/src/server.ts:416:21 2|connectm | at /usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/util/once.ts:10:18 2|connectm | at HomeSeerPlatform.accessories (/usr/local/lib/node_modules/homebridge-homeseer4/index.js:182:5) 2|connectm | at processTicksAndRejections (internal/process/task_queues.js:97:5) 2|connectm | (node:27346) 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) 2|connectm | (node:27346) [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.

emiliosic commented 4 years ago

Hi. I had the same problem. We have three Z-Wave thermostats (Two of them are AC/Heat and another is only heat). This morning, I had to reset the Sonos plugin on HS3 after upgrading to Sonos S2. Later in the day I notice Homebridge is not working, and find the following below on the logs:


ESC[31m    at Socket.<anonymous> (/usr/lib/node_modules/homebridge-homeseer4/lib/Setup Listener.js:76:51)ESC[39m
ESC[31m    at Socket.emit (events.js:310:20)ESC[39m
ESC[31m    at addChunk (_stream_readable.js:286:12)ESC[39m
ESC[31m    at readableAddChunk (_stream_readable.js:268:9)ESC[39m
ESC[31m    at Socket.Readable.push (_stream_readable.js:209:10)ESC[39m
ESC[31m    at TCP.onStreamRead (internal/stream_base_commons.js:186:23)ESC[39m
ESC[37m[6/10/2020, 9:34:15 AM] ESC[39mGot SIGTERM, shutting down Homebridge...
ESC[37m[6/10/2020, 9:34:32 AM]ESC[0m ESC[36m[HB Supervisor]ESC[0m Homebridge Process Ended. Code: 143, Signal: nu
ll
ESC[37m[6/10/2020, 9:34:37 AM]ESC[0m ESC[36m[HB Supervisor]ESC[0m Restarting Homebridge...
ESC[37m[6/10/2020, 9:34:37 AM]ESC[0m ESC[36m[HB Supervisor]ESC[0m Starting Homebridge with extra flags: -I
ESC[37m[6/10/2020, 9:34:44 AM]ESC[0m ESC[36m[HB Supervisor]ESC[0m Started Homebridge v1.1.0 with PID: 26667
ESC[37m[6/10/2020, 9:35:04 AM] ESC[39mLoaded config.json with 0 accessories and 2 platforms.
ESC[37m[6/10/2020, 9:35:05 AM] ESC[39m---
ESC[37m[6/10/2020, 9:35:11 AM] ESC[39mLoaded plugin: homebridge-config-ui-x@4.21.0
ESC[37m[6/10/2020, 9:35:11 AM] ESC[39mRegistering platform 'homebridge-config-ui-x.config'
ESC[37m[6/10/2020, 9:35:11 AM] ESC[39m---
ESC[37m[6/10/2020, 9:35:12 AM] ESC[39mLoaded plugin: homebridge-homeseer4@1.0.1
homebridge API version: 2.6
ESC[37m[6/10/2020, 9:35:12 AM] ESC[39mRegistering platform 'homebridge-homeseer4.HomeSeer'```
{...}
```ESC[37m[6/10/2020, 9:35:13 AM] ESC[39mInitializing platform accessory 'Master Bedroom Master Bedroom Thermostat'...
ESC[37m[6/10/2020, 9:35:13 AM] ESC[39mESC[36m[HomeSeer] ESC[39mSetting up a Thermostat with configuration values: {"ref":99,"controlRef":102,"stateRef":103,"heatingSetpointRef":104,"coolingSetpointRef":105}
(node:26667) UnhandledPromiseRejectionWarning: RangeError: Error setting up Thermostat. Scale is not Celsius or Fahrenheit
    at Object.exports.setupThermostat (/usr/lib/node_modules/homebridge-homeseer4/lib/ThermostatSetup.js:231:12)
    at Object.exports.setupServices (/usr/lib/node_modules/homebridge-homeseer4/lib/HomeKitDeviceSetup.js:156:16)
    at HomeSeerAccessory.getServices (/usr/lib/node_modules/homebridge-homeseer4/index.js:218:11)
    at Server.createHAPAccessory (/usr/lib/node_modules/homebridge/src/server.ts:441:41)
    at /usr/lib/node_modules/homebridge/src/server.ts:426:34
    at Array.forEach (<anonymous>)
    at /usr/lib/node_modules/homebridge/src/server.ts:416:21
    at /usr/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/util/once.ts:10:18
    at HomeSeerPlatform.accessories (/usr/lib/node_modules/homebridge-homeseer4/index.js:182:5)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:26667) 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:26667) [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.```
jvmahon commented 4 years ago

The code no longer has the parameter which allows you to manually force the F or C setting, it has to be read from HomeSeer. My guess is that your Omni plugin isn't setting up its temperature device properly, but its an easy fix.

In HomeSeer, go to the Indoor Temperature device (), and switch to its Status Graphics page. In the Status section, there's a "Suffix" field. It needs to have the entry "°@S@". See image below. Please give that a try and let me know if that works.
image

emiliosic commented 4 years ago

@homeconnector Sorry if I hijacked this defect. My thermostat is Z-Wave. As @jvmahon, my problem was just that: For some reason, Homeseer removed that value range and it was showing up as a dimmer (although the root device and all the other ones are part of the Z-Wave thermostat). I recall running a Z-Wave rescan on the Homeseer UI on that thermostat when this started happening. Odd because it's been stable for some years. After adding this change, Homeseer started reporting again as Fahrenheit (in my case) and after restarting Homeseer, home bridge started again.

homeconnector commented 4 years ago

not at all.

Two issues for me

  1. my thermostats are too Z-Wave not OMNI/Leviton. It seems to be when the Z-Wave/homeseer loses the connection (nature of Z-Wave) - it resulted in the thermostat (losing the current temperature in one of the devices losing it's value) until the z-wave connection was re-established. this resulted in the code - which now relies upon current temperature e.g. 20 C to show up as UNKNOWN, resulting in it crashing.

  2. Temperature Sensor - comes from Omni/Leviton. It does not contain F or C in its reading thus homeseer only shows up as "23" degrees. after making your changes

Making your suggested changes failed "°@s@"

  558 5°@s@   5°@s@ Outside Porch Temperature Sensor OMNI-Q191 OMNI Zones Today6:33:06 AM
  5°@s@

2|connectmgr1 | [6/11/2020, 7:43:31 AM] Initializing platform accessory 'Outside Porch Temperature Sensor'... 2|connectmgr1 | (node:5584) UnhandledPromiseRejectionWarning: RangeError: Error setting up Temperature Sensor. Scale is not Celsius or Fahrenheit 2|connectmgr1 | at Object.exports.setupSensor (/usr/local/lib/node_modules/homebridge-homeseer4/lib/Sensor Setup.js:261:12) 2|connectmgr1 | at Object.exports.setupServices (/usr/local/lib/node_modules/homebridge-homeseer4/lib/HomeKitDeviceSetup.js:170:12) 2|connectmgr1 | at HomeSeerAccessory.getServices (/usr/local/lib/node_modules/homebridge-homeseer4/index.js:218:11) 2|connectmgr1 | at Server.createHAPAccessory (/usr/local/lib/node_modules/homebridge/src/server.ts:441:41) 2|connectmgr1 | at /usr/local/lib/node_modules/homebridge/src/server.ts:426:34 2|connectmgr1 | at Array.forEach () 2|connectmgr1 | at /usr/local/lib/node_modules/homebridge/src/server.ts:416:21 2|connectmgr1 | at /usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/util/once.ts:10:18 2|connectmgr1 | at HomeSeerPlatform.accessories (/usr/local/lib/node_modules/homebridge-homeseer4/index.js:182:5) 2|connectmgr1 | at processTicksAndRejections (internal/process/task_queues.js:97:5) 2|connectmgr1 | (node:5584) 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) 2|connectmgr1 | (node:5584) [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.

Two recommendations A) i modified your code (Sensor Setup.js) temporarily default:^M {^M thisSensorService.temperatureUnit = "C"; ^M }^M

This works. Ideally the override temperatureUnit (Optional) would been my preferred fix.

B) Simple Suffix Override (C) works (quick work around) via Homeseer

558 | 5C |   | 5C | Outside | Porch | Temperature Sensor | OMNI-Q191 | OMNI Zones | Today6:33:06 AM |     | 5C  

jvmahon commented 4 years ago

Can you post an image of the "status graphics" page for the temperature device? Thanks.

jvmahon commented 4 years ago

I can probably add back in a manual override, but not until the weekend (at least).

homeconnector commented 4 years ago

Can you post an image of the "status graphics" page for the temperature device? Thanks.

image

homeconnector commented 4 years ago

I can probably add back in a manual override, but not until the weekend (at least).

Awesome - an optional manual over-ride for both would fix both problems

homeconnector commented 4 years ago

Can you post an image of the "status graphics" page for the temperature device? Thanks.

image

fyi - doing a reboot of homeseer (reverts the suffix). resulting it being blank and crashing the entire homebridge again. i've done a work around (fixing default - checks on temperature sensor)

jvmahon commented 4 years ago

Update published. Should now recognize "temperatureUnit":"F" or "temperatureUnit":"C" parameters. So, for example, you can set up a TemperatureSensor using . . . {"type":"TemperatureSensor", "ref":213, "temperatureUnit":"C"}

Let me know if this works for you.

homeconnector commented 4 years ago

Confirmed - it works - {"type":"TemperatureSensor", "ref":213, "temperatureUnit":"C"}

Thanks very much