jhschuster / homebridge-intesisweb

Homebridge plugin for IntesisHome devices
Other
1 stars 1 forks source link

Configuration/setup failure - panel/vista?id= undefined #5

Closed MmmmJoel closed 3 years ago

MmmmJoel commented 3 years ago

First time user, the plug-in looks okay I think until it reaches "panel/vista?id= undefined" after which it fails to configure properly. I also attached my "panel/headers" page for reference. Screen Shot 2021-02-09 at 1 23 34 PM

[2/9/2021, 1:11:51 PM] [IntesisWeb] Initializing IntesisWeb platform...
[2/9/2021, 1:11:51 PM] [IntesisWeb] IntesisWeb(log, config) called.
[2/9/2021, 1:11:51 PM] [IntesisWeb] IntesisWeb.accessories(callback) called.
[2/9/2021, 1:11:51 PM] [IntesisWeb] IntesisWeb.getConfig() called.
[2/9/2021, 1:11:51 PM] [IntesisWeb] IntesisWeb.doLogin() called.
[2/9/2021, 1:11:53 PM] [IntesisWeb] GET /login OK
[2/9/2021, 1:11:53 PM] [IntesisWeb] POST /login 302
[2/9/2021, 1:11:53 PM] [IntesisWeb] POST /login OK
[2/9/2021, 1:11:53 PM] [IntesisWeb] IntesisWeb.getHeaders() called.
[2/9/2021, 1:11:54 PM] [IntesisWeb] GET /panel/headers OK
[2/9/2021, 1:11:55 PM] [IntesisWeb] panel/vista?id= undefined
[2/9/2021, 1:11:55 PM] [IntesisWeb] TypeError: Cannot read property '1' of null
    at IntesisWeb.getDeviceStateFromVista (/usr/local/lib/node_modules/homebridge-intesisweb/index.js:197:70)
    at /usr/local/lib/node_modules/homebridge-intesisweb/index.js:159:16
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async Promise.all (index 0)
    at IntesisWeb.getConfig (/usr/local/lib/node_modules/homebridge-intesisweb/index.js:154:15)
    at IntesisWeb.instantiateAccessories (/usr/local/lib/node_modules/homebridge-intesisweb/index.js:266:16)
[2/9/2021, 1:11:55 PM] [IntesisWeb] getConfig:
[2/9/2021, 1:11:55 PM] [IntesisWeb] [
  {
    "device_id": "abcdefghijklmno",
    "name": "Downstairs",
    "services": null
  }
]
[2/9/2021, 1:11:55 PM] [IntesisWeb] Added "Downstairs" - Device ID: abcdefghijklmno.
[2/9/2021, 1:11:55 PM] [IntesisWeb] Setting up accessories/devices...
[2/9/2021, 1:11:55 PM] Initializing platform accessory 'Downstairs'...
jhschuster commented 3 years ago

Hmm. It's that "--ºF" that's messing the regular expression up. Do you know why it's showing that? I've never seen it before.

jhschuster commented 3 years ago

If you change line 197 of index.js from: body.match(/<div class="key_value">[0-9.]+\&deg;([FC])<\/div>/)[1], to: body.match(/<div class="key_value">[-0-9.]+\&deg;([FC])<\/div>/)[1], the problem should go away, but it will cause some weirdness further down the road because it can't get the current temperature. What kind of Intesis Home devices do you have? Does it not have an internal thermometer?

MmmmJoel commented 3 years ago

It is an Intesis FJ-RC-WIFI-1NA. It shows that because the ambient temperature sensor is disabled since the thermostat is located in a place where an accurate reading couldn't be taken.

So my use case (and people in similar situations) is just setting the output temperature (70 degrees) and allowing me to set up basic automation like turning it off/on when people arrive/leave.

What kind of weirdness might occur if I implement the fix? Thanks for your work on the module!

jhschuster commented 3 years ago

Ok. I've updated the plugin to 1.0.9 to handle the case where the current temperature isn't available. You should be able to update to it now. I can't test it completely because I haven't disabled the temperature on my units, so please let me know if it works for you.

MmmmJoel commented 3 years ago

Thanks, I updated and the module loads now and I can share more information. It doesn't function yet -- switching the unit on/off in Homebridge does not effect the change for example. And the module is displaying the ambient temperature (represented as 0 C or 32 F in my case) rather than the setpoint temperature.

My AC Cloud view is below. Screenshot 2021-02-18 at 2 44 18 PM

I would expect that the "setpoint temperature" be read and controlled by the module, similar to how the Nest module works. (The Nest module calls it the Target Temperature, and reads both the Current Temperature and Target Temperature.)

See below for the Nest compared to the Intesis:

Screen Shot 2021-02-18 at 2 55 10 PM

Screen Shot 2021-02-18 at 2 58 10 PM

Are there other logs that would help? Nothing is being thrown up in the Homebridge logs that I see.

jhschuster commented 3 years ago

If you look in the homebridge logs you should see the JSON of the data structure generated by scraping the Intesis web page. It will look something like this: [2/18/2021, 3:14:49 PM] [IntesisWeb] [ { "device_id": "1111111111", "name": "Bedroom", "services": { "power": { "service_name": "power", "service_id": 1, "user_id": "00000", "value": 0 }, "userMode": { "service_name": "userMode", "service_id": 2, "user_id": "00000", "value": 1 }, "fanSpeed": { "service_name": "fanSpeed", "service_id": 4, "user_id": "00000", "value": 0 }, "setpointTemp": { "service_name": "setpointTemp", "service_id": 9, "user_id": "00000", "raw_value": "22.0", "value": 22 }, "currentTemp": { "service_name": "currentTemp", "user_id": "00000", "units": "F", "raw_value": "74", "value": 23.333333333333332 }, "horizontalVanes": { "service_name": "horizontalVanes", "service_id": 6, "user_id": "00000", "value": 10 }, "swingMode": { "service_name": "swingMode", "service_id": 6, "user_id": "00000", "value": 10 }, "verticalVanes": { "service_name": "verticalVanes", "service_id": 5, "user_id": "00000", "value": 10 } } },

It may be that HomeKit requires the current temperature attribute for the HeaterCooler. I can hunt in the documentation to find that out.

As for the Home display, yes, it shows the current temperature in the thermostat circle; it shows the set point in the text and/or when you click on the thermostat. This is the way the Home app operates. I have Nests so I know what you're talking about. Nest shows the set point primarily; to see the current temp you have to drill down. I prefer the HomeKit method, but that's neither here nor there -- you're seeing the Apple behavior.

jhschuster commented 3 years ago

CurrentTemperature is a required characteristic. So disabling it isn't a good idea for HomeKit. I'm going to add a configuration variable to which the current temperature will default if it can't be retrieved.

jhschuster commented 3 years ago

1.0.10 now is available to fix this. It defaults the current temperature to 0º C if it can't be read. You can change the default value to something more reasonable in the JSON configuration or via the HomeBridge UI.

MmmmJoel commented 3 years ago

It works, thanks! And thanks for the information about default HomeKit behavior.

A minor suggestion about the fix would be to merely assign the setpointTemp to the currentTemp if the currentTemp can't be retrieved rather than have it user-configurable. (I can't think of a reason it would ever need be user-configurable, but I guess my use case wasn't foreseen either.)

jhschuster commented 3 years ago

I updated it so that the default is to use the set point, as you suggested. I left the configuration variable in there (unset or 0 means use the set point) in case someone wanted to default a temperature which would mean to them that the plugin couldn't retrieve the temperature. Anyhow, give it a shot!

jhschuster commented 3 years ago

Closing this.