Giter Club home page Giter Club logo

homebridge-web-thermostat's Introduction

homebridge-web-thermostat

npm npm

Description

This homebridge plugin exposes a web-based thermostat to Apple's HomeKit. Using simple HTTP requests, the plugin allows you to set the thermostat mode and control the target temperature.

Installation

  1. Install homebridge
  2. Install this plugin: npm install -g homebridge-web-thermostat
  3. Update your config.json file

Configuration

"accessories": [
     {
       "accessory": "Thermostat",
       "name": "Thermostat",
       "apiroute": "http://myurl.com"
     }
]

Core

Key Description Default
accessory Must be Thermostat N/A
name Name to appear in the Home app N/A
apiroute Root URL of your device N/A

Optional fields

Key Description Default
validStates Which states you would like to enable (see key) [0, 1, 2, 3]
temperatureDisplayUnits Whether you want °C (0) or °F (1) as your units 0
currentRelativeHumidity Whether to include currentRelativeHumidity as a field in /status false
maxTemp Upper bound for the temperature selector in the Home app 30
minTemp Lower bound for the temperature selector in the Home app 15
minStep Minimum increment value for the temperature selector in the Home app 0.5
temperatureThresholds Whether you want the thermostat accessory to have heating and cooling temperature thresholds false

Additional options

Key Description Default
listener Whether to start a listener to get real-time changes from the device false
pollInterval Time (in seconds) between device polls 300
checkupDelay Time (in milliseconds) after setting HeatingCoolingState to update targetHeatingCoolingState and currentHeatingCoolingState 2000
timeout Time (in milliseconds) until the accessory will be marked as Not Responding if it is unreachable 3000
port Port for your HTTP listener (if enabled) 2000
http_method HTTP method used to communicate with the device GET
username Username if HTTP authentication is enabled N/A
password Password if HTTP authentication is enabled N/A
model Appears under the Model field for the accessory plugin
serial Appears under the Serial field for the accessory apiroute
manufacturer Appears under the Manufacturer field for the accessory author
firmware Appears under the Firmware field for the accessory version

API Interfacing

Your API should be able to:

  1. Return JSON information when it receives /status:
{
    "targetHeatingCoolingState": INT_VALUE,
    "targetTemperature": FLOAT_VALUE,
    "currentHeatingCoolingState": INT_VALUE,
    "currentTemperature": FLOAT_VALUE
}

Note: You must also include the following fields in /status if enabled in the config.json:

  • currentRelativeHumidity
  • coolingThresholdTemperature & heatingThresholdTemperature
  1. Set targetHeatingCoolingState when it receives:
/targetHeatingCoolingState?value=INT_VALUE
  1. Set targetTemperature when it receives:
/targetTemperature?value=FLOAT_VALUE
  1. (if enabled) Set coolingThresholdTemperature when it receives:
/coolingThresholdTemperature?value=FLOAT_VALUE
  1. (if enabled) heatingThresholdTemperature when it receives:
/heatingThresholdTemperature?value=FLOAT_VALUE

Optional (if listener is enabled)

  1. Update targetHeatingCoolingState following a manual override by messaging the listen server:
/targetHeatingCoolingState?value=INT_VALUE
  1. Update targetTemperature following a manual override by messaging the listen server:
/targetTemperature?value=FLOAT_VALUE
  1. (if enabled) Update coolingThresholdTemperature following a manual override by messaging the listen server:
/coolingThresholdTemperature?value=FLOAT_VALUE
  1. (if enabled) Update heatingThresholdTemperature following a manual override by messaging the listen server:
/heatingThresholdTemperature?value=FLOAT_VALUE

HeatingCoolingState Key

Number Name
0 Off
1 Heat
2 Cool
3 Auto

homebridge-web-thermostat's People

Contributors

augustozanellato avatar inacho avatar lavransbjerkestrand avatar phenotypic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

homebridge-web-thermostat's Issues

TargetHeatingCoolingState cannot be set to AUTO

When changing TargetHeatingCooling state to AUTO home bridge returns error.
That's because updated is CurrentHeatingCoolingState (AUTO for this does not make any sens).
I think CurrentHeatingCoolingState should be changed to TargetHeatingCoolingState

error timeout

Hi,

Im getting this error when connecting to my api.
Error setting targetHeatingCoolingState: ESOCKETTIMEDOUT
if I type in the url from the browser it works.
any ideas?

characteristic was supplied illegal value: number 10 exceeded minimum of 17.

Hello
Thanks for your plugin!

How I can fix it?

[homebridge-web-thermostat] This plugin generated a warning from the characteristic 'Target Temperature': characteristic was supplied illegal value: number 10 exceeded minimum of 17. See https://git.io/JtMGR for more info.

It's coming from here

        this.service
            .getCharacteristic(Characteristic.TargetTemperature)
            .on('set', this.setTargetTemperature.bind(this))
            .setProps({
                minValue: this.minTemp,
                maxValue: this.maxTemp,
                minStep: this.minStep
            })

checkupDelay does not update

I happily made the plugin work with my thermostat, but there is one problem I discovered. The targetHeatingCoolingState and currentHeatingCoolingState are not updating after setting a HeatingCoolingState.

The default should be set to 2000 (ms), but it doesn't seem to do anything. I also tried adjusting the delay to a different number (5000) and unfortunately that makes no difference.

Is this a known issue or am I doing something wrong?

Fan support

What about adding fan control support similar to this zoltanhosszu/homebridge-web-thermostat.
It's a fork of your project, but I think you could pull in that changes and make the fan control section optional.

SetUp

I'm new to coding so not familiar with some of these things... how would I go about finding the apiroute (http://myurl.com) for the thermostat? Would this pluggin work with an Aprilaire WiFi thermostat?

Feature Request: Call _getStatus after setting changes via API

The HomeKit thermostat UIs would be a lot snappier (not having to wait for the next poll for updates) if

_getStatus

was called after these API calls are finished:

/targetHeatingCoolingState /targetTemperature /coolingThresholdTemperature /heatingThresholdTemperature

Does this work with Baxi?

Hi!

Sorry if this is sort of a dumb question but: does this work with BAXI heaters? I have a BAXI heater with a wireless thermostat (RXM) but I can't figure a way to integrate with homebridge. I know it has opentherm and it uses its property bridge to communicate with the wireless thermostat (RF).

Is there anything else I can do?

Thanks!

Cooling Only Mode

Hi! I'v been working to add this plugin to my Homebridge setup, and I noticed that it had the heatOnly, but I needed the coolOnly feature instead.

Since Cooling (2) and Auto (3) are after Heat (1), maxValue would not work in this case. I investigated some on how it works, and found it could also be done with validValues instead of maxValue.

I adapted the plugin in my setup with validValues and it works well, I include the relevant piece of code below for consideration. Maybe the config could be adapted to set separate modes as true or false.

if (this.coolOnly) {
      this.service.getCharacteristic(Characteristic.TargetHeatingCoolingState)
        .setProps({
          validValues: [0, 2, 3]
        })
      this.log('Set to cool only')
    }

Thanks!

Error setting targetHeatingCoolingState: socket hang up

Hi, I'm getting this error in the homebridge log file:

Error setting targetHeatingCoolingState: socket hang up

But my ESP8266 successfully sets the HeatingCoolingState.

Here is my current ESP8266 request handler:

server.on("/targetHeatingCoolingState", handle_targetHeatingCoolingState);

void handle_targetHeatingCoolingState () {
  String value = server.arg("value");
  tarState = value.toInt();

  Serial.print("\n tarState: ");
  Serial.println(tarState);
}

Thanks in advance!

RegEx patterns

Hello,

Great work on the plugin!
It would be cool if the URLs that are used for data collection could have their own custom RegEx patterns with them. This would then allow there to be more flexibility with where the data comes from so it doesn't need to conform to current constraints when /status is called.

Thanks!

Status delay

Hello!
Could it be possibile to have a delay configuration for /status endpoint?
I have 4 ble thermostats and i would like to have a same poll interval but a starting delay between each other.
So, for example
*thermostat 1 call /status at time 0 with pollinterval 20 seconds
*thermostat 2 call /status at time 5 with pollinterval 20 seconds
*thermostat 3 call /status at time 10 with pollinterval 20 seconds
*thermostat 4 call /status at time 15 with pollinterval 20 seconds

Need example please

Hello,
Can you give some example for the config.json
I want to use with a restfull API work like this :
CONSIGN URL :
URL : http://xxx.xxx.xxx.xxx/api/object/thermostat/1638403?ApiKey=xxxxx
Method : GET
Body : { "anaCurrSetPoint": 21 }
Thx for your work

Wrong thresholds temperature range

Even if i set maxTemp and minTemp in config.json when I'm in auto mode the range is 0°-35°

My config.json

     {
       "accessory": "Thermostat",
       "name": "Thermostat",
       "apiroute": "http://192.168.1.252",
       "currentRelativeHumidity": true,
       "minTemp": 16,
       "maxTemp": 30,
       "pollInterval": 60,
       "manufacturer": "Samsung",
       "model": "AR07FSFPESNN",
       "firmware" : "v1.0.0",
       "temperatureThresholds": true
     }

Modify Plugin

Know its not an issue, more of a challenge...looking to try and modify this plugin to connect to a wifi enable hot tub. Have details of the structure, commands and api calls needed to read status and issue commands...just not sure how to achieve it!

ESOCKETTIMEDOUT and illegal Value

[homebridge-web-thermostat] This plugin generated a warning from the characteristic 'Target Temperature': characteristic was supplied illegal value: number 10 exceeded minimum of 17. See https://git.io/JtMGR for more info.

[Thermostat] Error setting targetTemperature: ESOCKETTIMEDOUT

group thermostats in home app

Hi,

I'm wondering why it isn't possible to group multiple thermostats from the same room in the home app.
Isn't it possible with your plugin or am I missing anything?

Greetings
satrik

Min/Max Values Do not apply to current temperature

Hello, I use this plugin to automate my wood stove. You allow the temperature thresholds to be changed, but once it passes 212F (100C) it errors out because there is an internal limit in the Characteristic.CurrentTemperature. I forked it awhile ago and added (below) but I don't want to keep updating my fork with your updates. Is this plausible to add the min/max for current temperature as well?

    this.service
      .getCharacteristic(Characteristic.CurrentTemperature)
      .setProps({
        minValue: -600,
        maxValue: 600
      });

new minStep option vs. displayed values

Hi

I tested the new minStep option with 0.2 - in the Home App the steps for the targetTemp are still 0.5.
(Homebridge log shows 0.2 steps)
Is there some Characteristics Settings missing?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.