Giter Club home page Giter Club logo

homebridge-hubitat-makerapi's Introduction

homebridge-hubitat-makerapi

This is based off of @tonesto7 homebridge-hubitat-tonesto7

npm version

Current App version: 0.4.15

Table of Contents

Change Log
Installation
Configuration File Parameters
Capability Filtering
Attribute Filtering
Troubleshooting

Change Log

Hubitat App:

v0.1.0 - Ported app over from my tonesto7 version and added Websocket channel. Reworked Device Classification, HSM and modes currently not supported!!!
v0.1.2 - Fixed bug of not updating tiles in HomeKit after an hour expired
v0.1.7 - Fixed issuse with Siri, Show version number in logging output
v0.1.8 - Fixed issue with setting Thermostat temperature, make a device a Fan if it has the attributes switch and level and the device type contains the words "fan control"
v0.1.9 - Added ability to filter out attributes and capabilities
v0.1.10 - Fixed Hampton Bay Fan Component
v0.1.11 - v0.1.17 - Several attempts to mess with messy fans...
v0.2.0 - migrated to dynamic homebridge platform that removes the need of restarting homebridge after a device selection was changed in MakerAPI, configure homebridge to use Celsius, fixed fan tile on/off functionallity, ability to create switch tiles for modes and switching of modes, HSM integration, reduced load on Hubitat at plugin start by removing dependency on full detail API call, plugin startup speed improved, perform daily version check against NPMJS and print logging statement on newer versions available
v0.2.1 - v0.2.4 - Fixed attribute filtering for cached devices
v0.2.5 allows correct usage of DNS host names instead of IP address to connect to hubitat, fans that support setLevel use setLevel instead of setSpeed to allow finer granularity, code baselined with homebridge-hubitat-hubconnect plugin to allow faster cross-sharing of improvements
v0.2.6 Fixed issue with multi sensors not updating temperature and humidity, fixed issue that temperature can't go negative
v0.2.7 - v.0.2.8 problems with deasync module, removed it
v0.2.9 fixed on/off for hampton bay controller, fixed water valve
v0.2.10 Hampton Bay Fan Controllers say they have speed level even though they are off, let's fix that
v0.2.11 Added some debug for fans....
v0.2.13 Fixed garage door implementation and set obstruction when status is unknown/stopped
v0.2.14 Added "debug" mode to see calls to MakerAPI in output. See description below on how to enable it.
v0.2.15 Added ability to write logging to file
v0.2.16 Fixed rounding issue for thermostats in auto mode
v0.2.17 Added support for colorTemperature bulbs
v0.2.18 Added thermostat fan switch support (thanks @swiss6th), added ping/pong for websockets (thanks @asj)
v0.2.19 Added some additional testing on websocket status to track down an issue...
v0.3.0 Added Button support, limited to "push" for 1 button, see "programmable_buttons" for advanced programmable button support (thanks to @swiss6th for the code base)
v0.3.1 fixed double usage of switch if a button also has the switch attribute
v0.3.2 Another try to deal with websocket issues
v0.3.3 Fixed programmed buttons implementation, further testing on websocket connection, reloading of attribute states via HTTP if websocket connection is "broken", some refactoring
v0.4.0 Adapted to new MakerAPI event-stream released with Hubitat release 2.1.6, websocket connection is used as fallback if MakerAPI stream is not supported, new configuration options for "local_ip" and "local_port" added, clean reload after lost communication with hub
v0.4.1 Fixed an issue during start and concurrent requests to MakerAPI
v0.4.2 Added automatic detection of free port to listen on for event stream
v0.4.5 Added diagnostic website hosted by plugin to see/download log files and enable debug logging
v0.4.6 Fixed thermostat low battery warnings, fixed iOS13 duplicate calling of setThermostatOperationgMode, some UI changes in diagnostic website
v0.4.7 Fixed null attribute on battery for thermostats
v0.4.8 Fixed setting Thermostat temperatures in auto mode, fixed Alarm Tile in Home App when HSM is disarmed with 'Disarm All' by RM, better detection of local_ip based on app_url host
v0.4.9 Fixed Alarm Tile reset when custom rule alert was canceled
v0.4.10 Fixed thermostat setpoint in auto mode for Thermostats
v0.4.11 Fixed exception on button events
v0.4.12 Validation of values for accessoires to prevent warning messages in Homebridge 1.3
v0.4.13 Fixed null reference for validation of values
v0.4.14 Fix for newer output on MakerAPI with version 2.2.6
v0.4.15 Fixed error on Hubitat reboot

Explanation:

Direct Updates

This method is nearly instant.

When properly setup, you should see something like this in your Homebridge startup immediately after the PIN:

[2019-4-12 14:22:51] [Hubitat] homebridge-hubitat-makerapi server listening on 20009
[2019-4-12 14:22:51] Homebridge is running on port 51826.

Installation

1. Hubitat MakerAPI App Configuration

  • Under the Hubitat Web Interface, Click on Apps in the left side menu.
  • Click on the button +Add Built-In App
  • Select Maker API from the list of apps
  • Enable Allow Access via Local IP Address
  • Tap Done and you are finished with the App configuration.
  • Go into the newly added Maker API app
  • Select the devices you would like to have available via HomeKit
  • Enable Include Location Events to support HSM and chaning of modes

2. Homebridge Plugin Installation:

  1. Install homebridge using: sudo npm i -g homebridge (For Homebridge Install: Homebridge Instructions)
  2. Install Hubitat plugin using: sudo npm i -g homebridge-hubitat-makerapi
  3. Create your config.json configuration file. The config.json file has to be stored in the folder ~/.homebridge
  4. To help creating your inital configuration file, click here for some assistance.
  5. Start homebridge using the command: homebridge

Configuration File Parameters

Example of all settings. Not all settings are required. Read the breakdown below. There is also a tool to help you creating a config.json file located here

{
   "platform": "Hubitat-MakerAPI",
   "name": "Hubitat",
   "app_url": "http://192.168.10.169/apps/api/YOUR_APPS_ID/",
   "access_token": "THIS-SHOULD-BE-YOUR-TOKEN",
   "local_ip": "10.0.0.70",
   "local_port": 20010,
   "polling_seconds": 300,
   "temperature_unit": "F",
   "mode_switches": true,
   "hsm": true,   
   "debug": false,
   "programmable_buttons": [
        "97",
        "98"
   ],
   "excluded_capabilities": {
       "HUBITAT-DEVICE-ID-1": [
          "Switch",
          "TemperatureMeasurement"
       ]
   },
   "excluded_attributes": {
       "HUBITAT-DEVICE-ID-1": [
          "power",
          "humidity"
       ]
   },
   "logFile": {
         "enabled": true,
         "path": "",
         "file": "",
         "compress": true,
         "keep": 5,
         "size": "10m"
   }
}
  • platform & name Required
    This information is used by homebridge to identify the plugin and should be the settings above.

  • app_url & access_token Required
    This is the base URL and access token for MakerAPI, check step 1 of the installation instructions on how to obtain the value Notice: The app_url in the example above may be different for you.

  • local_ip Optional
    Defaults to first available IP on your computer
    Most installations won't need this, but if for any reason it can't identify your ip address correctly, use this setting to force the IP presented to Hubitat for the hub to send to.

  • local_port Optional
    Defaults to 20010
    This is the port that homebridge-hubitat-makerapi plugin will listen on for events from your hub. Make sure your firewall allows incoming traffic on this port from your hub's IP address.

  • polling_seconds Optional
    Configures the how often (in seconds) the plugin should check if devices were removed or added from/to the selection in MakerAPI. Default is every 300 seconds. Almost no need to restart homebridge anymore! Name changes and changing a device driver still requires a restart.

  • excluded_capabilities Optional
    Defaults to None
    Specify the Hubitat device by ID and the associated capabilities you want the plugin to ignore
    This prevents a Hubitat device from creating unwanted or redundant HomeKit accessories

  • excluded_attributes Optional
    Defaults to None
    Specify the Hubitat device by ID and the associated attributes you want homebridge-hubitat-makerapi to ignore. This prevents a Hubitat device from creating unwanted or redundant HomeKit accessories

  • programmable_buttons Optional
    Defaults to None
    By default, pressing Buttons in Homekit trigger a "pushed" event for button number 1 in Hubitat. The setting "programmable_buttons" allows Hubitat to trigger HomeKit specific scenes. You can assign scenes to three types of events: Pushed, Held and DoubleTapped. This can be helpful to interact with Homekit only devices. E.g. a button press in HE can trigger a HomeKit only lock to lock. Note: there is no feedback if the Homekit scene was executed successfully or not. Specify the Hubitat device by ID in this setting to create a programmable button.

  • temperature_unit Optional
    Default to F
    Ability to configure between Celsius and Fahrenheit. Possible values: "F" or "C"

  • mode_switches Optional
    Default to false
    Create switches for modes and ability to switch modes by enabling such switches Possible values: true or false
    Requires HE fimrware 2.0.9 or newer

  • hsm Optional
    Default to false
    Integrates HSM into Home app and allow to arm/disarm the hsm and receive notifications on intrusions
    Requires HE firmware 2.0.9 or newer

  • debug Optional
    Default to false
    Enables debugging of HTTP calls to MakerAPI to troubleshoot issues

  • logFile Optional
    Settings to enable logging to file. Uses winston logging facility

    • enabled Optional
      Enable logging to file. Default is true. Set to true to enable file logging

    • path Optional
      Path to store log files. Defaults to path where config.json is stored - Only applicable if logFile -> enable is set to true

    • file Optional
      Filename of log file. Default is homebridge-hubitat.log - Only applicable if logFile -> enable is set to true

    • compress Optional
      Compress log files when they rotate. Default is true - Only applicable if logFile -> enable is set to true

    • keep Optional
      Number of log files to keep before deleting old log files. Default is 5 - Only applicable if logFile -> enable is set to true

    • size Optional
      Maximum size of log file. Default is 10m - Only applicable if logFile -> enable is set to true

Capability Filtering

The homebridge-hubitat-makerapi creates Homekit devices based on the attributes of devices. See Attribute Filtering below. To allow backwards compatibilty to tonesto7's plugin, the homebridge-hubitat-makerapi plugin still allows filtering by capability. Capabilities are going to be matched to Hubitat's listed capabilities at Driver Capability List and the associated attributes are going to be removed.

Attribute Filtering

The homebridge-hubitat-makerapi creates Homekit devices based on the attributes of devices. The following attributes are currently being handled:

Attribute HomeKit Devices
thermostatOperatingState Thermostat
switch and (level or hue or saturation) Light Bulb
switch Switch
motion Motion Sensor
presence Occupancy Sensor
lock Lock Mechanism
temperature (and not a thermostat) Temperature Sensor
contact Contact Sensor
door Garage Door Opener
smoke Smoke Sensor
carbonMonoxide Carbon Monoxide Sensor
carbonDioxideMeasurement Carbon Dioxide Sensor
water Leak Sensor
humidity Humidity Sensor
illuminance Light Sensor
battery Battery Service
position Window Covering
speed Fan Controller
valve Valve

The homebridge-hubitat-makerapi plugin does not discriminate! The plugin will create multiple devices in Homekit if a device has multiple of these attributes. Let's take a window shade as an example. A window shade might have the attributes "switch" and "position" and would create two Homekit devices, one as a switch and one as window covering. This might not be the desired behavior and you might want to only have one Homekit devices that sets the position of the shade. The plugin allows you to filter out the "switch" attribute and won't create a Homekit device for that attribute. To do so, you would add the following configuration to your config.json:


   "excluded_attributes": {
       "HUBITAT-DEVICE-ID": [
          "switch"
       ]
   }

Troubleshooting

With version v0.4.5 a plugin dashboard is available to help troubeshooting. The dashboard is a website that can be reached while homebridge and the plugin are running. To reach the dashboard, you can follow these steps:

  1. In Hubitat, go open your MakerAPI Instance
  2. Scroll down to find your "URL to send device events to by POST" alt text
  3. Copy the URL and enter the URL in a new browser window
  4. You will see a view like this, showing you the logging output of the plugin, the ability to download the log-file to your computer, enablign, disabling debug mode and see your current configuration alt text

homebridge-hubitat-makerapi's People

Contributors

as-j avatar dantapps avatar swiss6th avatar tternes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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  avatar

homebridge-hubitat-makerapi's Issues

Zigbee LED Strip Colors Wrong

Hi, hoping someone can help me. I am trying to get a zigbee LED strip over to my HomeKit app. I was able to set it up via the Hue app, and it works fine there (however, that won’t get it to HomeKit). I have the Hubitat and I installed this plugin. I was able to work through things, and I have my LED strip showing up in my home app!

My issue is for some reason the colors are all off! When I try to use blue, it turns red, etc... It’s all messed up. I switch back to the hue app though, and the colors are fine. Is there a setting in this plugin or hubitat I’m not doing correctly?

I have an RGBgenie ZB-1007 zigbee controller. Thank you!

RFC: hue should should not convert between 0-100 and 0-360

Because you are converting and rounding both directions, the hue that homekit sends often won't be what it gets back later.

example:

  1. Homekit sends 1 for hue.
  2. That gets converted to 0 (Math.round(1/3.6) === 0) and saved in hubitat.
  3. Homekit asks for the hue later.
  4. Hubitat gives homebridge the 0 it saved earlier, then converts that to 0 (Math.round(0*3.6) === 0) and sends it to homekit.

This rounding error happens about 72% of the time.

It appears that homebridge RGB and RGBW drivers have a setting to send and receive hue in degrees (0-360), so the user would just need to set that for all of their RGB and RGBW lights.

Unreliable performance with dimmers

I have around 15 Zooz dimmers connected to a hubitat C-7 hub. I am able to get them into homebridge and appear in homekit using MakerAPI, however setting the brightness level is unreliable. Sometimes it responds instantly, sometimes it doesn't respond at all until I repeat the command, and other times it will respond 5-10 seconds later. I have searched exhaustively and seem to be the only one with this issue. Control works fine directly from hubitat instantaneously. Any ideas? I get similar behavior with the Tonesto plugin as well

Security System "Undefined" messages in logs

Seeing these in my logs and not quite sure what this means. I am running on hoobs beta 4.0xx on a rpi 4

4/13/2021, 8:19:31 AMHubitat Maker API BridgeWarning[Hubitat Maker API Bridge 6F78@Alarm System Hubitat@@Security System Target State] characteristic value expected valid finite number and received "undefined" (undefined)4/13/2021, 8:19:31 AMHubitat Maker API BridgeWarning[Hubitat Maker API Bridge 6F78@Alarm System Hubitat@@Security System Current State] characteristic value expected valid finite number and received "undefined" (undefined)

Zooz 4-in-1 Multi-sensor (ZSE40 700) illuminance level locked at level when HomeKit initially picks up device

All of the sensors in the Zooz 4-in-1 Multi-sensor (ZSE40 700) show data via makerAPI.

All of the sensors except for the illuminance sensor report updated information in HomeKit.

After some tests, I determined that the illuminance level showing in HomeKit is whatever the illuminance was when the device is initially picked up in HomeKit.

This is repeatable by removing the sensor from the makerAPI list, waiting a while for it to drop from HomeKit, and then adding it again. Whatever illuminance was being reported in Hubitat, will transfer to HomeKit, but the value will never change in HomeKit after that point.

I am using the Zooz enhanced driver (https://raw.githubusercontent.com/jtp10181/Hubitat/main/Drivers/zooz/zooz-zse40-multisensor.groovy), but experienced the same behavior with the Hubitat built-in driver.

Interesting note (although not reporting as a bug, but rather an interesting behavior). When I first experienced the issue with the illuminance level, I updated the driver on Hubitat to the enhanced driver, link above, but made no other changes - device name, device label, preferences, etc.).

I found that when trying to make an automation in HomeKit, I would choose the motion sensor, and it would show me lux settings. I tried choosing the illumination option, but would still see lux settings (I thought they might be swapped, but that was not the case).

I found that the issue was likely due to me changing the driver in Hubitat, but not removing it from makerAPI first, letting it drop out of HomeKit, and then re-adding it.

Since then, if I change a driver in Hubitat, I make sure to remove it from makerAPI, ensure that it has dropped from HomeKit, then re-add it to Hubitat. Probably common sense, but it caught me unawares.

HOOBs certified and Config Schema?

I was hoping to see your plugin become HOOBs certified with its own config schema. Is this in development by chance? This plugin has worked flawlessly for me versus others I have tried (Hoobs certified too) have failed with delay and latency issues

[homebridge-hubitat-makerapi] This plugin threw an error

Im still trying to parse this to determine what device/action this might be attributed to. Will update if I find/resolve/get-more-info

From HomeBridge

This plugin threw an error from the characteristic...
If you see this message in the log, the plugin threw an unhandled exception while processing the SET or GET request for the characteristic.
[homebridge-hubitat-makerapi] This plugin threw an error from the characteristic 'Brightness': Unhandled error thrown inside read handler for characteristic: Characteristic is not defined. See https://git.io/JtMGR for more info.
[12/29/2021, 8:38:40 AM] [homebridge-hubitat-makerapi] ReferenceError: Characteristic is not defined
    at validateValue (/homebridge/node_modules/homebridge-hubitat-makerapi/lib/validate.js:178:35)
    at Brightness.<anonymous> (/homebridge/node_modules/homebridge-hubitat-makerapi/accessories/he_st_accessories.js:650:40)
    at Brightness.emit (node:events:390:28)
    at /usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:1544:14
    at new Promise (<anonymous>)
    at Brightness.<anonymous> (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:1542:12)
    at step (/usr/local/lib/node_modules/homebridge/node_modules/tslib/tslib.js:143:27)
    at Object.next (/usr/local/lib/node_modules/homebridge/node_modules/tslib/tslib.js:124:57)
    at /usr/local/lib/node_modules/homebridge/node_modules/tslib/tslib.js:117:75
    at new Promise (<anonymous>)
    at __awaiter (/usr/local/lib/node_modules/homebridge/node_modules/tslib/tslib.js:113:16)
    at Brightness.Characteristic.handleGetRequest (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/dist/lib/Characteristic.js:656:38)
    at Brightness.Characteristic.getValue (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:1252:10)
    at HE_ST_Accessory.loadData (/homebridge/node_modules/homebridge-hubitat-makerapi/accessories/he_st_accessories.js:1614:63)
    at /homebridge/node_modules/homebridge-hubitat-makerapi/index.js:218:47
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

Devices not showing up

I loaded the makerAPI on my hubitat and the webhooks work and show the json device data

I setup homebridge on my raspberry and apple home find it and shows the bridge

I cannot figure out how to get my devices to show up. Have tried everything. Hoping someone might have something I missed

If hubitat is not accessible, homebridge cannot start

Hi
If hubitat is not available for whatever reason, then homebridge cannot start as a result. I think we need to change this. It's not good that homebridge cannot start because of this plugin.

See below for the error that happens and homebridge will keep rebooting until hubitat is available. There's a lot of other services that on homebridge, and I think homebridge should be able to start even if hubitat is not available (and the plugin try again later to connect to hubitat).

Aug 24 17:00:44 raspberrypi3 homebridge[19057]: [8/24/2020, 5:00:44 PM] [Hubitat hhm:0.4.11] Configuration of cached accessories not done, wait for a bit... 6
Aug 24 17:00:44 raspberrypi3 homebridge[19057]: error at req: connect EHOSTUNREACH 192.168.3.21:80
Aug 24 17:00:44 raspberrypi3 homebridge[19057]: [8/24/2020, 5:00:44 PM] [Hubitat hhm:0.4.11] GET ERROR: { path: '/modes', method: 'GET' } { Error: connect EHOSTUNREACH 192.168.3.21:80
Aug 24 17:00:44 raspberrypi3 homebridge[19057]: at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1107:14)
Aug 24 17:00:44 raspberrypi3 homebridge[19057]: errno: 'EHOSTUNREACH',
Aug 24 17:00:44 raspberrypi3 homebridge[19057]: code: 'EHOSTUNREACH',
Aug 24 17:00:44 raspberrypi3 homebridge[19057]: syscall: 'connect',
Aug 24 17:00:44 raspberrypi3 homebridge[19057]: address: '192.168.3.21',
Aug 24 17:00:44 raspberrypi3 homebridge[19057]: port: 80 }
Aug 24 17:00:44 raspberrypi3 homebridge[19057]: [8/24/2020, 5:00:44 PM] [Hubitat hhm:0.4.11] { Error: connect EHOSTUNREACH 192.168.3.21:80
Aug 24 17:00:44 raspberrypi3 homebridge[19057]: at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1107:14)
Aug 24 17:00:44 raspberrypi3 homebridge[19057]: errno: 'EHOSTUNREACH',
Aug 24 17:00:44 raspberrypi3 homebridge[19057]: code: 'EHOSTUNREACH',
Aug 24 17:00:44 raspberrypi3 homebridge[19057]: syscall: 'connect',
Aug 24 17:00:44 raspberrypi3 systemd[1]: homebridge.service: Main process exited, code=exited, status=1/FAILURE
Aug 24 17:00:44 raspberrypi3 systemd[1]: homebridge.service: Unit entered failed state.
Aug 24 17:00:44 raspberrypi3 systemd[1]: homebridge.service: Failed with result 'exit-code'.

Doesn’t refresh switch state.

I have 3 light switches the state of which is set to whatever it was on homebridge server boot. Even if you toggle them. After a moment HomeKit resets back to the initial state it was at boot even if it doesn't match the current state

Dynamically remove cached Accesories?

Hello. I recently removed a Z-wave switch that I had been passing through to the maker api. Does your plugin check on start to see if the list of devices it has access to has changed and if so, remove the accessory from the cached accessories database?

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.