hycken / homebridge-fujitsu-hvac

Homebridge plugin for devices compatible with the FGLAir app.
MIT License
2 stars 0 forks source link

nodejs implementation #13

Open louisvangeldrop opened 1 year ago

louisvangeldrop commented 1 year ago

Do you also have a version of the FGLAIR software without a Homebridge connection, that I can use directly from nodejs?

hycken commented 1 year ago

I'm unsure what you are asking for. This is a Homebridge plugin so the Homebridge connection is the whole point.

If you want to build something separate yourself you could copy the files in src/api, I guess.

louisvangeldrop commented 1 year ago

I want to access the FGLAir device locally using nodejs as a mqtt based service. Something like this: import { LocalServer } from './dist/localServer.mjs' import { Region, User } from './dist/models.mjs' import { FGLAir } from './dist/fglair.mjs'

const user = new User('ĺmyemail', 'mypassword') const region = Region.getRegion('eu') const fglair = new FGLAir(region, user) const devices = await fglair.getDevices()

The last line will render a bad request error - 400

hycken commented 1 year ago

Hmm. Hard to say what it could be. Did you try any other regions?

louisvangeldrop commented 1 year ago

I have removed the content-length parameter and it works now. Any suggestions if I should use the localServer in order to connect to the Wifi-device locally?

hycken commented 1 year ago

Yes. I would recommend using localServer. It'll keep a connection open to the device and listens for updates. Using the web API you'll have to do polling to get updates.

louisvangeldrop commented 1 year ago

I have got the localServer working. Is my assumption correct, that if I use the localServer, that then the FGLAir App is unable to connect to the wifi-mcu?

hycken commented 1 year ago

They should both work at the same time, but I've noticed sometimes the response time will go up. While figuring out how the local connection works I also sent a few too many requests at one point and the wifi unit became completely unresponsive for a while.

louisvangeldrop commented 1 year ago

I have the same experience. Updating the temperature with FGLAir by pressing the up-arrow a couple of times and the localServer stopped calling the handler. BTW Do you know the meaning of the e.g. the following key: #136: w2_50: MwEBLQEAIgApBP////8iAA== I receive a lot of those key/value pairs: w1_1 => w1_55 and w2_1 => w2_55

hycken commented 1 year ago

It looks like it has to do with the weekly schedules. I haven't used any schedules on my device and I don't think there's any analog in HomeKit, so I never added support for those keys.

louisvangeldrop commented 1 year ago

Thx for the explanation. I haven't used the week schedules either. I am using IoBroker for driving the HVAC.