Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

homebridge-pentair-screenlogic

zyonse63MIT3.0.2TypeScript support: included

Plugin for Pentair Screenlogic Controllers

homebridge-plugin, homebridge-screenlogic, pentair, screenlogic

readme

homebridge-pentair-screenlogic

NPM version License Downloads

Fork of schemers/homebridge-screenlogic with some of my own improvements and fixes.

ScreenLogic plug-in for Homebridge using the node-screenlogic library.

Requirements

This plugin was recently rewritten in Typescript to use the latest capabilities of Homebridge 1.x, so it requires at a minimum:

  1. Homebridge >= 1.0.0
  2. Node >= 10.17.0

Installation

  1. Install homebridge using: npm install -g homebridge
  2. Install this plug-in using: npm install -g homebridge-screenlogic
  3. Update your configuration file. See example config.json snippet below.

Configuration

Configuration samples (edit ~/.homebridge/config.json):

UDP Broadcast

This performs a UDP broadcast on 255.255.255.255, port 1444, so ensure your network supports UDP broadcasts and the device is on the same subnet.

"platforms": [
        {
            "platform": "ScreenLogic"
        }
    ],

Direct connection via IP Address

Use this when you know the local static IP address.

"platforms": [
        {
            "platform": "ScreenLogic",
            "ip_address": "192.168.0.100"
        }
    ],
  • "port" is optional and defaults to 80
  • "username" is optional, but is recommended as it is used to keep accessory UUIDs consistent. Should be in the format "Pentair: XX-XX-XX".

Remote connection via gateway

Use this to go through Pentair servers.

"platforms": [
        {
            "platform": "ScreenLogic",
            "username": "Pentair: XX-XX-XX",
            "password": "..."
        }
    ],

Optional fields:

  • "hidden_circuits" comma-separated list of circuit names to hide. Set this for circuits you don't want showing up as switches. (ie.., "Aux 6,Floor Cleaner").

  • "hideAirTemperatureSensor" hides the air temperature sensor. Default is false.

  • "hidePoolTemperatureSensor" hides the pool temperature sensor, which is redundant if you are showing pool thermostat. Default is true.

  • "hideSpaTemperatureSensor" hides the spa temperature sensor, which is redundant if you are showing spa thermostat. Default is true.

  • "hidePoolThermostat" hides the pool thermostat (aka, pool heater) if you don't want to allow changes via HomeKit. Default is false.

  • "hideSpaThermostat" hides the spa thermostat (aka, spa heater) if you don't want to allow changes via HomeKit. Default is false.

  • "statusPollingSeconds" time in seconds to poll for pool statu. Default is 60 seconds.

  • createLightColorSwitches will create a "Pool Lights" accessory that contains switches for turing on light modes/colors. Default is false.

  • disabledLightColors an array of strings with the names of light mode/colors you want to disable. Default is an empty array.

Sample config

{
  "platform": "ScreenLogic",
  "hidePoolTemperatureSensor": false,
  "hideSpaTemperatureSensor": true,
  "hideAirTemperatureSensor": true,
  "hidePoolThermostat": false,
  "hideSpaThermostat": false,
  "statusPollingSeconds": 60,
  "createLightColorSwitches": true,
  "disabledLightColors": ["Pool Mode Party", "Pool Mode Romance"],
  "hidden_circuits": "Fountains,Floor Cleaner,Aux 6"
}

Implemented HomeKit Accessory Types

Air Temperature

  • TemperatureSensor accessory (Air) indicating the ambient temperature where thee screenlogic hardware is located

Pool

  • TemperatureSensor accessory (Pool) indicating the ambient temperature of the pool (last known temperature if pool isn't running)

Spa

  • TemperatureSensor accessory (Spa) indicating the ambient temperature of the Spa (last known temperature if pool isn't running)

Circuits

  • creates a Switch accessory for each discovered circuit (i.e., Pool, Spa, Jets, Pool Light, Spa Light, etc)

Pool Heater

  • Thermostat accessory with ambient temperature, mode control (heat/cool/auto/off), and target temperature control. See also Note on Pool/Spa Heater below.

Spa Heater

  • Thermostat accessory with ambient temperature, mode control (heat/cool/auto/off), and target temperature control. See also Note on Pool/Spa Heater below.

Light Colors

  • Light Colors accessory with multiple switches for setting a light mode/color. See also Note on Light Colors

"On" State

Pool and spa heaters do not turn the pool and/or spa on or off, they just change the heat mode.

i.e., if you want to heat the spa, you need to do two things:

  1. turn on the Spa (via the Spa Switch)
  2. make sure the Spa Heater is set to something other than off (most likely Heat)

This should work well in practice though, as you will generally have a set target temperature and mode, and then just turn the spa on/off without mucking with the thermostat.

This also means that even if the Pool/Spa is turned off and you open the Pool/Spa Heater it mght say "HEATING TO". It will not actually being heating unless the corresponding Pool/Spa switch is turned on.

Note on Light Colors

The light color commands (for modes and colors) are exposed as switches in HomeKit if you enable createLightColorSwitches (it is false by default).

Semantics

Since I don't have the ability to query the current state of which color/mode is active (Screenlogic app doesn't show it either), I implemented the following behavior:

  1. light mode/color switch is turned on (i.e., Pool Mode Sunset)
  2. light command is sent to Screenlogic controller
  3. after a few seconds, the same switch is turned off to give feedback that the command was sent
  4. all pool/spa lights will be turned on (if they aren't already), and set to that mode/color. This is done by the screenlogic controller itself.

Single Tile

Instead of cluttering the room with a bunch of switches, they are all shown in HomeKit as a single accessory called "Light Colors". Tap on the tile to expand, and then turn on the individual switch for the desired mode/color.

If you'd like to show them as separate tiles, you can tap the gear icon at the bottom of the expanded tile (or slide up at the bottom) and then select "Show as Separate Tiles". If you are showing as separate tiles and want to revert back to a single tile, you can select any switch and then select "Show as Single Tile"

Renaming

While showing the light switches as separate tiles, you can rename them if desired, which will let you pick a different name to use with Siri. After renaming you can then show as a single tile again if you'd like.

Siri

You can set a mode/color by saying the mode/color name:

  • "Hey Siri, turn on pool mode sunset"
  • "Hey Siri, turn on pool color blue"

Which will set the selected mode/color and turn on all the lights if they aren't on.

changelog

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

V2.2.1 - 2020-11-9

Fixed

  • set min/max on CurrentTemperature characteristic to allow temperatures below 0 degrees Celsius. Fixes "unavailable" error message from HomeKit went temperatures dropped below 0.

V2.2.0 - 2020-9-26

Fixed

  • fix light colors

  • fixes for new TypesSript errors

V2.1.1 - 2020-7-5

Added

  • DEBUG: add additional debug output when successfully sending commands

  • DEBUG: dump out raw pool controllerConfig message from node-screenlogic

V2.1.0 - 2020-7-4

Added

  • add createLightColorSwitches config that creates switches for setting pool light modes/colors. See README.md for more details
  • add disabledLightColors config for disabling light modes/colors that you don't want to create switches for. See README.md for more details

Fixed

  • add catch handlers for controller promises to log errors

V2.0.3 - 2020-6-27

Fixed

  • simplified the way get triggered a refresh
  • Typescript cleanup

V2.0.2 - 2020-6-22

Fixed

  • restore Hoobs support by using api.registerPlatform(PLUGIN_NAME, PLATFORM_NAME, ScreenLogicPlatform)

V2.0.1 - 2020-6-22

Added

  • add hideAirTemperatureSensor config that hides the air temperature sensor. Default value is false.

  • don’t use status faults to indicate polling error

V2.0.0 - 2020-6-21 (MAJOR RELEASE)

Added

  • rewrite in Typescript to provide much cleaner/safer base
  • minimum of Homebridge 1.1.1 is required
  • support DynamicPlatformPlugin
  • properly add/remove/update cached accessories on startup

Fixed

  • caching/persisting of accessories, so if bridge is unavailable when server starts the previous configured shades will remain

  • add retry logic for obtaining the initial config from the controller if there is an error contacting it

  • try to cleanup the way I was setting/getting/updating of service characteristics to be more proper

v1.4.2 - 2020-5-29

Fixed

  • fixes #4 by adding extra checks to see if spa or pool circuits exist

v1.4.1 - 2020-5-25

Fixed

  • updated to node-screenlogic v1.4.0 which emits errors to the caller

  • add .on('error') handlers to propagate errors back to promises via reject

v1.4.0 - 2020-4-18

Fixed

  • since we are using a shared Promise, make sure to have a .catch handler when also setting up the .finally, otherwise we'll get an unhandled promise rejection error

v1.3.5 - 2020-3-20

Fixed

  • fixes #3 by clamping set point so it is just above/below the min/max set point

v1.3.4 - 2020-3-20

Added

  • dump out pool config and status when debug is turned on

  • add a default case for mapHeatModeToTargetHeatingCoolingState

v1.3.3 - 2020-3-19

Fixed

  • attempt to fix issue #3

was incorrectly using Characteristic.CurrentHeaterCoolerState.{OFF,HEAT} instead of Characteristic.CurrentHeatingCoolingState.{HEAT,OFF}

before fixing I was seeing:

[3/19/2020, 2:46:56 PM][screenlogic] Pool Heater set heatingCoolingState undefined
[3/19/2020, 2:46:56 PM][screenlogic] Pool Heater set heatingCoolingState 0

afer fixing:

[3/19/2020, 2:49:29 PM][screenlogic] Pool Heater set heatingCoolingState 0
[3/19/2020, 2:49:29 PM][screenlogic] Pool Heater set heatingCoolingState 0

v1.3.2 - 2020-3-14

Added

  • updated images in README.md

v1.3.1 - 2020-3-14

Added

  • updated images in README.md

v1.3.0 - 2020-3-14

Added

  • add "Pool Heater" and "Spa Heater" accessories which are exposed as HomeKit Thermostats. Fixes #1. See README.md for details

  • add hidePoolTemperatureSensor config that hides the pool temperature sensor, which is redundant if you are showing pool thermostat

  • add hideSpaTemperatureSensor config that hides the spa temperature sensor, which is redundant if you are showing spa thermostat

  • add hidePoolThermostat config that hides the pool thermostat (aka, pool heater) if you don't want to allow changes via HomeKit

  • add hideSpaThermostat config that hides the spa thermostat (aka, spa heater) if you don't want to allow changes via HomeKit

Fixed

  • fixes #2, typo in description

v1.2.1 - 2020-1-4

Fixed

  • actually set default polling to 60 seconds

v1.2.0 - 2020-1-4

Added

  • add background polling for status updates to enable automations to work

  • add statusPollingSeconds option to config, defaults to 60 seconds

  • expontential backoff on error

v1.1.3 - 2020-1-3

Fixed

  • promise.then(f1,f2) -> promise.then(f1).catch(f2) cleanup

  • remove bluebird dependency since not using it

v1.1.2 - 2020-1-3

Fixed

  • log connected/errors in _refreshStatus

  • replace pending callback queue with pending promise

v1.1.1 - 2020-1-2

Fixed

  • refresh status before returning accesscories to homebridge

v1.1.0 - 2020-1-2

Fixed

  • rewrite to use promises/async/await

  • move all ScreenLogic-related code to Pool module to keep platform simpler

  • simplify logging with top-level exception handlers

v1.0.0 - 2020-1-2

  • bump verison to 1.0.0 for easier updates in homebridge

v0.2.0 - 2020-1-2

Added

  • add bindCharacteristicGet convenience method on platform to easily bind a characteristics on('get') function to a function that refreshes values and handles callback properly.

Fixed

  • properly handle when controller is conifgured for celsius temperatures

  • refactor characteristic handlers

v0.1.1 - 2020-1-1

Fixed

  • fixed number of found accessories in log

v0.1.0 - 2020-1-1

  • expose discovered circuit names as switches

  • add a config option to hide circuits by name

v0.0.6 - 2019-12-31

Added

  • remove cache logic and instead queue pending callbacks if there is an outstanding refresh connection and call them when connection returns

v0.0.5 - 2019-12-30

Added

  • added config.schema.json for easier configuration in Homebridge UIs

v0.0.4 - 2019-12-30

Added

  • Apple only allows n.n.n for HardwareVersion/FirmwareVersion, so store Screen Logic software version in Model characterstic, which allows a free-form string.

Fixed

  • update callbacks to use error-first conventions

  • define Error objects on ScreenLogicPlatform

  • log errors

  • update getConnectionByIPAddress to honor callback contract be using setImmediate so it calls callback async

  • set Characteristic.StatusFault to true on errors

v0.0.3 - 2019-12-29

Added

  • cache values for 5s to prevent making a bunch of simultaneous calls

v0.0.2 - 2019-12-29

Fixed

  • cleanup

v0.0.1 - 2019-12-29

Fixed

  • initial check in (no release)