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

Package detail

homebridge-homewizard-energy-socket

jvandenaardweg85MIT1.6.4TypeScript support: included

This Homebridge plugin exposes your HomeWizard Energy Sockets to Apple HomeKit. So you can use the Home App to switch your Energy Sockets on or off and integrate the Energy Sockets into your Home Automations.

home-automation, home automation, apple, homebridge, homebridge-plugin, homebridge plugin, homekit, homekit-accessory, homekit accessory, homewizard, apple-homekit, apple homekit, homebridge-plugins, homebridge plugins, homewizard-energy, homewizard energy, homewizard-energy-socket, homewizard energy socket, apple-home, apple home

readme

npm   github   github   github sponsor   mit license

Homebridge plugin for HomeWizard Energy Socket

This verified Homebridge plugin exposes your HomeWizard Energy Sockets to Apple HomeKit. So you can use the Home App to switch your Energy Sockets on or off and integrate the Energy Sockets into your Home Automations.

Features

  • Control Energy Sockets from within the Home App
  • Use Energy Sockets in your Home Automations
  • Use the Outlet In Use characteristic to trigger automations based on power consumption
  • Automatically discovers Energy Sockets in your network

This plugin does not provide a way to show the current power consumption of the Energy Sockets. This is a limitation of HomeKit and not of this plugin. I do however have a way to trigger automations based on the Outlet In Use characteristic.

Getting started

For Homebridge to communicate with your Energy Sockets, it is required to enable the "Local API" setting and disable the "Switch lock" setting from within the HomeWizard Energy App. You must do this for each Energy Socket you want to expose in the Home App. It is also advised to use DHCP Reservations for each Energy Socket in your network to improve reliability.

1. Enabling the Local API setting and disable the Switch lock setting

  1. Open your HomeWizard Energy app
  2. Go to settings and choose "Meters"
  3. Tap on each Energy Socket you want to use and follow step 4 and 5
  4. Enable the "Local API" setting
  5. Disable the "Switch lock" setting

More on this on the HomeWizard support page: Integrating Energy with other systems (API)

2. Installation of the plugin bridge

This package is published on NPM, so available on the Homebridge plugin page

  1. Go to your Homebridge UI and click on "Plugins"
  2. Search for homebridge-homewizard-energy-socket and select the plugin Homebridge HomeWizard Energy Socket from @jvandenaardweg and click "Install"
  3. On the plugin Settings, set the name you want to use for this plugin, or leave it empty to use the default. Click Save.
  4. Click the little QR code icon for the plugin and enable the bridge. Save it and restart Homebridge.
  5. After restarting Homebridge, click the QR code icon again and scan the QR code with your iPhone using the Home App. This will add the plugin bridge to your Home App.
  6. Your Energy Sockets should now be available to configure in the Home App

Make sure to read this Wiki article about Identifying the Energy Socket in the Home App

Troubleshooting

By default the plugin will automatically discover the Energy Sockets in your network that have the "Local API" setting enabled using Multicast DNS. Multicast DNS is a feature of all routers. So unless you have changed these settings specifically, or using multiple different LAN networks, there should be no need to change any settings for this. It should just work.

More on this in the HomeWizard API documentation about Discovery.

If no Energy Sockets could be found, maybe this could help:

  • Verify if the Energy Sockets are still available/online in the Energy App
  • Verify if the Energy Sockets have the "Local API" setting enabled
  • Restart the Energy Sockets (unplug and plug them back in)
  • Restart the Homebridge plugin and/or server
  • If none of the above help, there probably is an issue with Multicast DNS in your network. Check your network settings and/or router settings to enable Multicast DNS. Or use the Energy Sockets config option for the plugin to manually add your Energy Sockets by using the IP address.

Still experience an issue? Please open an issue on GitHub.

changelog

Changelog

All notable changes to this project will be documented in this file. Dates are displayed in UTC.

Generated by auto-changelog.

1.6.4

  • feat: prevent flooding the logs with errors on state polling 1e3d889

1.6.3

20 December 2024

  • refactor: prevent flooding logs when error happens during polling 3814375
  • chore: release v1.6.3 b4d54af
  • feat: stop state polling temporary when manually switching on or off 58c2d40

1.6.2

20 December 2024

1.6.1

20 December 2024

1.6.0

19 December 2024

1.6.0-0

19 December 2024

1.5.1

7 November 2023

  • chore: release v1.5.1 97fa4c1
  • chore: remove older node version from tests 522c5e2

1.5.0

7 November 2023

  • chore: update dependencies 214f02a
  • chore: release v1.4.3 8acd274
  • chore: release v1.5.0 9135ff3
  • chore: update readme homebridge logo b220417

1.5.0-0

7 November 2023

  • feat: basic setup extra accessory for just using power consumption 1bacfa5
  • chore: release v1.5.0-0 cb1cbd5

1.4.3

7 November 2023

  • chore(deps-dev): bump release-it from 15.10.0 to 16.1.5 c7c1756
  • chore(deps-dev): bump vitest from 0.29.2 to 0.34.3 8f0ffad
  • chore(deps-dev): bump release-it from 15.6.1 to 15.10.0 856bb16
  • chore(deps): bump vite from 4.1.4 to 4.3.9 8605850
  • chore(deps-dev): bump @typescript-eslint/eslint-plugin 9c38b77
  • chore(deps-dev): bump rimraf from 5.0.0 to 5.0.1 efc6296
  • chore(deps-dev): bump @babel/traverse from 7.20.10 to 7.23.2 ea8e742
  • chore(deps-dev): bump eslint from 8.35.0 to 8.52.0 c69c663
  • chore(deps-dev): bump @typescript-eslint/parser from 5.54.0 to 5.59.8 190aadc
  • chore(deps-dev): bump @typescript-eslint/eslint-plugin b451e08
  • chore(deps-dev): bump @vitest/coverage-istanbul from 0.28.5 to 0.29.8 bd30f85
  • chore(deps-dev): bump homebridge from 1.6.0 to 1.6.1 4047b9c
  • chore(deps-dev): bump vitest from 0.34.3 to 0.34.6 9956bee
  • chore(deps-dev): bump @typescript-eslint/eslint-plugin abfcba7
  • chore(deps-dev): bump @typescript-eslint/eslint-plugin be298a7
  • chore(deps-dev): bump @typescript-eslint/eslint-plugin 38984d8
  • chore(deps-dev): bump rimraf from 4.4.1 to 5.0.0 1fa085d
  • chore(deps-dev): bump lint-staged from 13.1.2 to 13.2.0 9a2f1c6
  • chore(deps-dev): bump rimraf from 4.1.2 to 4.4.1 0b1177d
  • chore(deps-dev): bump @typescript-eslint/parser from 5.59.8 to 5.62.0 6b8ba77
  • chore(deps-dev): bump rimraf from 5.0.1 to 5.0.5 25a6b4e
  • chore(deps): bump undici from 5.22.1 to 5.27.2 0f0fc76
  • chore: release v1.4.3 8acd274
  • chore(deps-dev): bump dotenv-cli from 7.2.1 to 7.3.0 51edc2d
  • chore(deps): bump validator and @types/validator 8170695
  • chore(deps): bump xml2js and @homebridge/dbus-native 545a098
  • chore(deps-dev): bump prettier from 2.8.4 to 3.0.3 88d59fd
  • chore(deps-dev): bump lint-staged from 13.2.0 to 13.2.3 02d6829
  • chore(deps): bump homewizard-energy-api from 1.4.1 to 1.4.2 bd2451b
  • chore(deps): bump undici from 5.20.0 to 5.22.1 b2f6847
  • chore(deps): bump zod from 3.21.4 to 3.22.3 757aa60
  • chore(deps-dev): bump @types/node from 18.14.0 to 20.4.5 2965f6c
  • chore(deps): bump bonjour-service from 1.1.0 to 1.1.1 266687e
  • chore(deps): bump zod from 3.20.6 to 3.21.4 c4a2626
  • chore(deps-dev): bump resolve-tspaths from 0.8.8 to 0.8.13 b83c532
  • chore(deps-dev): bump dotenv-cli from 7.0.0 to 7.2.1 43e4f4e
  • chore(deps-dev): bump word-wrap from 1.2.3 to 1.2.4 1617747
  • chore(deps): bump vm2 from 3.9.17 to 3.9.19 c97a4c4
  • chore(deps): bump yaml from 2.2.1 to 2.2.2 71b4c01
  • chore(deps): bump vm2 from 3.9.12 to 3.9.17 0b54ab8
  • chore: update readme homebridge logo b220417

1.4.2

1 March 2023

  • chore: use istanbul for test coverage bd6602d
  • chore(deps-dev): bump release-it from 15.6.0 to 15.6.1 f0b0df1
  • chore: update dependencies cd598e5
  • chore(deps-dev): bump vitest from 0.26.3 to 0.27.1 70416dc
  • chore(deps-dev): bump vitest from 0.26.2 to 0.26.3 fe68ae1
  • chore(deps-dev): bump vitest from 0.28.5 to 0.29.2 c27c8a3
  • chore(deps-dev): bump vitest from 0.28.4 to 0.28.5 7529e6e
  • chore(deps-dev): bump @typescript-eslint/parser from 5.52.0 to 5.54.0 f865b65
  • chore(deps-dev): bump @typescript-eslint/parser from 5.51.0 to 5.52.0 dabae4a
  • chore(deps-dev): bump @typescript-eslint/parser from 5.48.0 to 5.48.1 9d43757
  • chore(deps-dev): bump @typescript-eslint/parser from 5.47.0 to 5.48.0 2cb0547
  • chore(deps-dev): bump @typescript-eslint/eslint-plugin a2a58e0
  • chore(deps-dev): bump @typescript-eslint/eslint-plugin 829831d
  • chore(deps-dev): bump @typescript-eslint/eslint-plugin 0aa7798
  • chore(deps-dev): bump @typescript-eslint/eslint-plugin af32a6b
  • chore(deps-dev): bump vitest from 0.27.3 to 0.28.3 e403af9
  • chore(deps-dev): bump @vitest/coverage-istanbul from 0.28.4 to 0.28.5 a24da3f
  • chore(deps-dev): bump @vitest/coverage-c8 from 0.26.0 to 0.26.2 93f493a
  • chore: update dependencies 9405451
  • chore(deps-dev): bump @typescript-eslint/parser from 5.48.1 to 5.48.2 b021808
  • chore(deps-dev): bump @typescript-eslint/eslint-plugin d9c67d1
  • chore(deps-dev): bump @typescript-eslint/parser from 5.48.2 to 5.49.0 eef28ff
  • chore(deps-dev): bump eslint from 8.34.0 to 8.35.0 0cc16ba
  • chore(deps-dev): bump @typescript-eslint/parser from 5.49.0 to 5.50.0 0858673
  • chore(deps-dev): bump @vitest/coverage-istanbul from 0.26.3 to 0.28.3 e3e9ed7
  • chore(deps-dev): bump release-it from 15.5.1 to 15.6.0 ac56ff9
  • chore: release v1.4.2 57139e1
  • chore(deps-dev): bump rimraf from 3.0.2 to 4.1.2 7d9a41b
  • chore(deps-dev): bump vitest from 0.27.1 to 0.27.3 7b2d959
  • chore(deps-dev): bump dotenv-cli from 6.0.0 to 7.0.0 dd8e43b
  • chore(deps-dev): bump resolve-tspaths from 0.8.3 to 0.8.8 2f0449c
  • chore: update dependencies db70d2d
  • chore(deps): bump homewizard-energy-api from 1.2.2 to 1.3.1 9888fae
  • chore(deps-dev): bump eslint from 8.30.0 to 8.31.0 bf31c33
  • chore(deps-dev): bump lint-staged from 13.1.1 to 13.1.2 7801d60
  • chore(deps): bump undici from 5.18.0 to 5.19.1 3659337
  • chore(deps): bump homewizard-energy-api from 1.4.0 to 1.4.1 a6f94f9
  • chore(deps-dev): bump prettier from 2.8.3 to 2.8.4 263f88d
  • chore(deps): bump zod from 3.20.2 to 3.20.6 b64250a
  • chore(deps-dev): bump eslint from 8.33.0 to 8.34.0 2ab1511
  • chore(deps): bump cacheable-request from 10.2.3 to 10.2.7 7780504
  • chore(deps-dev): bump eslint from 8.32.0 to 8.33.0 83598b6
  • chore(deps-dev): bump typescript from 4.9.4 to 4.9.5 50568b0
  • chore(deps-dev): bump @types/validator from 13.7.10 to 13.7.11 245237f
  • chore(deps-dev): bump prettier from 2.8.2 to 2.8.3 51346ed
  • chore(deps-dev): bump eslint from 8.31.0 to 8.32.0 893c43d
  • chore(deps): bump bonjour-service from 1.0.14 to 1.1.0 c81d666
  • chore(deps-dev): bump prettier from 2.8.1 to 2.8.2 71015a0
  • chore(deps): bump http-cache-semantics from 4.1.0 to 4.1.1 3cd4fa9
  • chore(deps): bump homewizard-energy-api from 1.2.1 to 1.2.2 8df9183
  • docs: update readme with verified badge c444b3e
  • chore: only show test coverage report in console 062b70c
  • chore: run dependabot monthly 016adff
  • fix: error The "path" argument must be of type string. Received an instance of Array 59b852a
  • chore: update dependabot.yml a2fb54d
  • chore: exclude files from test coverage aee0412

1.4.1

20 December 2022

  • chore: update dependencies 085c3cd
  • chore: release v1.4.1 dfc32f9
  • fix: only set outletinuse in sync method when theres a state update 32ae7f6
  • chore: cleanup code 4a9558a
  • docs: update shields in readme fbec3a0
  • docs: update readme 1731045

1.4.0

19 December 2022

  • chore: update dependencies 7963a8d
  • feat: add config options to use OutletInUse 4d08312
  • refactor: use schema validation using zod to check if config is valid 4fa05c8
  • refactor: better typings and tests b3c9f87
  • feat: use zod for config schema validation 757fd7b
  • chore: remove ts-node dependency 0e5537e
  • feat: use homewizard-energy-api library 6a2eb5a
  • feat: extended API to also fetch the /data endpoint 299e585
  • refactor: improve logging and constructor method of accessory ae89cf1
  • feat: set outlet in use characteristic if active_power_w is greater than 5 854a6d3
  • chore: add types for api data endpoint 5a5edca
  • chore(deps-dev): bump eslint from 8.29.0 to 8.30.0 cac8161
  • refactor: throw different error on api response ac624de
  • test: full test coverage of api 3dde486
  • chore: release v1.4.0 f3deb77
  • feat: keep OutletInUse characteristic in sync with On if outletInUse config is not set 212a439
  • feat: use polling from homewizard-energy-api bfc4006
  • test: make use of api class simpler 81c2635
  • refactor: use correct defaults 8f2ad75
  • chore: update keywords 14f097b
  • test: error thrown on data endpoint cebad14
  • chore(deps): bump homewizard-energy-api from 1.1.1 to 1.2.0 5e193b9
  • chore(deps-dev): bump @types/node from 18.11.15 to 18.11.17 5af67e9
  • refactor: set initial outletinuse value to true when config option is not present e3bf76b
  • refactor: better logging ca7853e
  • test: better settings test 9d37253
  • refactor: make api error response parameters required 791fd3e
  • test: simpler type overwrite for productType param test 75b49fc
  • refactor: use sync method for outletinuse state 3c6ecb7
  • chore: update config content 265d421
  • chore: update funding e001f1e
  • chore: update readme about issue f24aa24
  • chore: update funding 5c68bcd

1.3.2

12 December 2022

  • test: sanity check on config.schema.json type safety 7b01608
  • chore: release v1.3.2 206be1b
  • chore: add paypal for funding 39c3955
  • chore: add author to package.json a6be3bb
  • chore: add funding to package json for verified homebridge plugin 4430324
  • test: extra check on name.required property 4b9ded5
  • chore: add homepage to package.json 4eb4518

1.3.1

12 December 2022

  • feat: use energy sockets from config to skip automatic discovery 708cd58
  • chore: update dependencies a6a3a75
  • chore: release v1.3.1 acc83f4
  • chore: release v1.2.7 390ea76
  • chore: tweak config content de7db4c
  • refactor: build as commonjs module a633973
  • chore: reset version e8e508b
  • chore: update readme 9b9d2f4
  • chore: update readme 77904be

1.3.0

12 December 2022

  • feat: use energy sockets from config to skip automatic discovery d539c7b
  • chore: tweak config content 40a8b06
  • chore: release v1.3.0 6ce2ffd

1.2.7

12 December 2022

  • feat: use energy sockets from config to skip automatic discovery 708cd58
  • chore: no commit limit in changelog.md 84d0896
  • chore: update dependencies a6a3a75
  • chore: release v1.2.7 390ea76
  • chore: tweak config content de7db4c
  • refactor: build as commonjs module a633973
  • chore: update readme 9b9d2f4
  • chore: update readme 77904be

1.2.6

12 December 2022

  • chore: release v1.2.6 1bc912e
  • chore: reset changelog to how it was 1c9cbdf

1.2.5

12 December 2022

  • refactor: get firmware version before setting up accessory f962321
  • chore(deps-dev): bump @typescript-eslint/parser from 5.45.0 to 5.46.0 cc9fd33
  • chore(deps-dev): bump @typescript-eslint/eslint-plugin 7e04dea
  • chore: release v1.2.5 7be6125
  • test: restructure mocks e2ed952
  • chore(deps-dev): bump @vitest/coverage-c8 from 0.25.6 to 0.25.7 9f186d8
  • chore: update readme 838668e
  • chore(deps-dev): bump prettier from 2.8.0 to 2.8.1 146d77d
  • chore(deps-dev): bump @types/node from 18.11.10 to 18.11.13 45b79a7
  • fix: changelog.md missing commits e366257
  • chore: improve debug logging 39eb7e2
  • feat: set default bridge name 250d4cb
  • chore: update readme e51573b
  • chore: update readme ec0cca1

1.2.4

11 December 2022

  • chore: release v1.2.4 81dbdc1
  • fix: show proper info log on state updates 45e3fc3

1.2.3

11 December 2022

  • chore: release v1.2.3 ce54646
  • chore: run lint and type check on pretest 26f8826
  • chore: only run test on pre-commit 1b50e0a
  • chore: remove backfill-limit option from changelog generation d30ee53
  • chore: disable backfill-limit on changelog 7a794a6
  • chore: run lint on commit d6c0568
  • fix: linter error preventing release 14a2510

1.2.2

11 December 2022

  • chore: release v1.2.2 e61c810
  • fix: debug message SET handler returned write response value, though the characteristic doesnt support write response 3324783

1.2.1

11 December 2022

  • fix: run setAsyncCharacteristics on new instance of accessory 5ecaa0a
  • chore: release v1.2.1 6a03062
  • chore: update docs on error we throw 7ca003b
  • chore: add test todo 4c75005

1.2.0

10 December 2022

  • feat: use undici fetch for http requests 275b253
  • chore: restructure project c3ebd82
  • test: up the test coverage for api a07356c
  • test: added unit tests for energy socket accessory ae62555
  • refactor: update homewizard api class db2cdb6
  • test: api server errors 157fc50
  • feat: use request from undici instead of fetch, to also support node 14 84bf634
  • refactor: update http request method with better error handling 36d0e27
  • refactor: better types on put endpoint b6afb57
  • refactor: use default timeout for http requests 70f99fc
  • chore: update readme 537cc34
  • test: make energy socket accessory test simpler 8afacd2
  • chore: release v1.2.0 d69ee96
  • chore: cleanup vite.setup.ts 0f18cc6
  • chore: update readme b320100
  • refactor: api error message ee3c548
  • chore: remove mock dir from build dir be1dd53
  • fix: type error a3d2bb2
  • fix: consistently use displayName 820ccc6
  • chore: update readme a0832c2
  • refactor: return NOT_ALLOWED_IN_CURRENT_STATE when switch_lock = true b2b0056

1.1.0

6 December 2022

  • refactor: remove jest references, we use vitest 04dacc9
  • refactor: use as esm module to allow latest version of node-fetch to be used 7496aca
  • test: mock api endpoints and let unit tests use those endpoints 6082fb3
  • chore: add husky and lint-staged 7a01911
  • refactor: use api class to handle api calls 165f9ff
  • refactor: use native http and https node modules to do api requests 20d4f11
  • fix: put request not having content length 11e2f30
  • chore: update github yml files 45c84ca
  • feat: handle the Identify event from HomeKit when setting up a accessory 02b779a
  • chore: added codeql dab04b1
  • fix: build files not having the resolved alias paths 8c5d076
  • test: add some platform unit tests 75ca082
  • refactor: let httpRequest method use fetch options d66a6c8
  • chore: update types for node-fetch 95899a9
  • refactor: move the types to the api directory 1dffdb2
  • chore: cleanup code a bit e750457
  • chore: update readme cb61b1d
  • chore: use different build config to exclude test files 3711d52
  • chore: tighten type check 26c579e
  • feat: handle setting the state properly when switch_lock is true 15f0e6f
  • fix: response.json() not returning the correct data 91f4a87
  • chore(deps-dev): bump @types/jest from 29.2.3 to 29.2.4 0232206
  • chore: release v1.1.0 1350b8a
  • chore: add dependabot 59714df
  • refactor: use consistent display name cb94011
  • chore: change workflow names e2098ea
  • chore: update readme f954a1a
  • chore: added the api error type 371d429
  • chore: update readme about switch lock setting 9cd1423
  • chore: better debug logging 97a379a
  • chore: rename badge paths to this current project e122ee2
  • chore: do not install husky in ci a229b94
  • chore: update readme 8658fa4
  • chore: added funding.yml 11222a4
  • chore: remove console log 186da0a
  • chore: also test for node 19 3bf00cb
  • chore: exclude test files from build 1b658bb
  • chore(deps-dev): bump @types/jest from 29.2.3 to 29.2.4 a038e31
  • test: fix test having open handles cd18275
  • chore: add todo c76a5ed
  • chore: update readme on switch lock 209aaca
  • chore: update package.json description df9c344
  • chore: update readme d6db4a2
  • chore: update package description 1e052b3
  • chore: add images for docs/wiki 8eca2f1

1.0.9

4 December 2022

  • chore: release v1.0.9 588df3e
  • feat: also use plugin name on platform ec35e40
  • feat: rename platform name 6b4161a

1.0.8

4 December 2022

  • fix: issue where plugin is not registered properly 3f12bde
  • chore: release v1.0.8 1fd5424

1.0.7

4 December 2022

  • chore: release v1.0.7 77ab600
  • chore: move around some settings c9492aa

1.0.6

4 December 2022

  • chore: release v1.0.6 12a182f
  • feat: change config property name 460be45

1.0.5

4 December 2022

1.0.4

4 December 2022

  • chore: change package name to homebridge-homewizard-energy-socket f5b5d31
  • chore: release v1.0.4 e411165
  • chore: update readme 5fb5095

1.0.3

4 December 2022

  • chore: release v1.0.3 1140786
  • chore: removed private: true from package.json to publish on npm 8cd0fe4

1.0.2

4 December 2022

1.0.1

4 December 2022

  • feat: several tweaks to accessory and platform f952b12
  • feat: basic implementation of plugin b52dfcf
  • chore: added release-it f8c23c7
  • chore: update packages c123655
  • chore: update readme 3b2b8f6
  • Initial commit 8e89e4a
  • chore: update readme and types 6bbe96a
  • chore: update readme and package.json 6b1d3d1
  • chore: update readme 6a4d9ff
  • chore: update readme 681ae5f
  • chore: release v1.0.1 97d7eef
  • chore: update package.json 7543609