nebulous / infinitude

Open control of Carrier/Bryant thermostats
MIT License
225 stars 50 forks source link

Setting up API #70

Closed Tangston311 closed 5 years ago

Tangston311 commented 5 years ago

I'm new to this so apologies for the basic questions here, but I'm trying to get my Infinitude instance linked up to Homebridge via something like the homebridge-thermostat, but I'm having trouble getting it working and could use some guidance to get me started.

The thermostat plugin calls for an API Route that provides thermostat info, target heating/cooling state, target temp, and target humidity (example of thermostat info below):

GET /status { targetHeatingCoolingState: INT_VALUE_0_TO_3, targetTemperature: FLOAT_VALUE, targetRelativeHumidity: FLOAT_VALUE, currentHeatingCoolingState: INT_VALUE_0_TO_2, currentTemperature: FLOAT_VALUE, //prev temperature currentRelativeHumidity: FLOAT_VALUE_AS_PERCENTAGE //prev humidity }

I tried simply using "http://[infinitude IP]:3000/api/config" for the API route, but all the calls don't return any values. I've obviously got some more setup to do, but I'm not sure where to start. Do I need to set up a separate API json file in the Infinitude folder that converts the Infinitude endpoints into the format above? Any advice would go a long way just so I know where to begin!

nebulous commented 5 years ago

If Infinitude is configured properly then /api/config should return your thermostat configuration in json format. Have you setup your thermostat to proxy thru Infinitude yet? What does the main infinitude interface look like?

Tangston311 commented 5 years ago

Yep the thermostat is set to proxy through Infinitude and the web interface is updating and showing correctly, and commands I put into the interface properly reflect back to the thermostat.

screen shot 2019-02-02 at 2 37 40 pm

So that bit is working just fine, but I can't seem to connect it to the Homebridge plugin via the API. Do you think the /api/config return values that would be compatible with the API requirements listed by the Homebridge-Thermostat plugin?:

Get any thermostat info GET /status { targetHeatingCoolingState: INT_VALUE_0_TO_3, targetTemperature: FLOAT_VALUE, targetRelativeHumidity: FLOAT_VALUE, currentHeatingCoolingState: INT_VALUE_0_TO_2, currentTemperature: FLOAT_VALUE, //prev temperature currentRelativeHumidity: FLOAT_VALUE_AS_PERCENTAGE //prev humidity }

Set target HeatingCoolingState GET /targetHeatingCoolingState/{INT_VALUE_0_TO_3} OK (201)

Set target temperature GET /targetTemperature/{FLOAT_VALUE} OK (201)

Set target relative humidity GET /targetRelativeHumidity/{FLOAT_VALUE} OK (201)

nebulous commented 5 years ago

A mapping could be made into these values, but it wouldn't JustWork™ with homebridge by default. I assume homebridge has some kind of way to write a mapping plugin. @MizterB has kindly put together a home assistant plugin that works fairly well too https://github.com/MizterB/homeassistant-infinitude.