homebridge-tasmota 0.1.12 → 0.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/DEVICES.md +38 -5
  2. package/gh-md-toc +40 -30
  3. package/package.json +4 -4
package/DEVICES.md CHANGED
@@ -1,11 +1,44 @@
1
1
  <H1>Sample Device Configurations ( My personal collection )</H1>
2
2
 
3
3
  <!--ts-->
4
-
5
-
6
- <!-- Created by https://github.com/ekalinin/github-markdown-toc -->
7
- <!-- Added by: sgracey, at: Sun 9 Jun 2024 20:59:46 EDT -->
8
-
4
+ * [Sample Device Configurations ( My personal collection )](#sample-device-configurations--my-personal-collection-)
5
+ * [My standard config after setting name and device configuration ](#my-standard-config-after-setting-name-and-device-configuration-)
6
+ * [Tasmota Configuration](#tasmota-configuration)
7
+ * [Sonoff IFAN03](#sonoff-ifan03)
8
+ * [Tasmota Configuration](#tasmota-configuration-1)
9
+ * [configuration override of discovery object to create a FAN ( post version 0.1.0 )](#configuration-override-of-discovery-object-to-create-a-fan--post-version-010-)
10
+ * [configuration override of discovery object to create a FAN ( pre version 0.1.0 )](#configuration-override-of-discovery-object-to-create-a-fan--pre-version-010-)
11
+ * [Slave a FEIT Wifi Dimmer Wall Switch to an iFan as a light switch](#slave-a-feit-wifi-dimmer-wall-switch-to-an-ifan-as-a-light-switch)
12
+ * [BME280 Temperature Sensor - <a href="docs/MCUIOT.md">MCUIOT</a>](docs/MCUIOT.md)
13
+ * [DHT11 Temperature Sensor - <a href="docs/MCUIOT.md">MCUIOT</a>](docs/MCUIOT.md)
14
+ * [Water Leak Sensor with On/Off control](#water-leak-sensor-with-onoff-control)
15
+ * [LEAK Tasmota configuration - <a href="docs/MCUIOT.md#dht-yl">DHT11</a>](docs/MCUIOT.md#dht-yl)
16
+ * [Leak Tasmota configuration - <a href="docs/MCUIOT.md#dht-yl">BME280</a>](docs/MCUIOT.md#dht-yl)
17
+ * [Motion + BME280 Temperature Sensor](#motion--bme280-temperature-sensor)
18
+ * [PIR Motion + BME280 Temperature Sensor + BH1750 Lux Illuminance Sensor](#pir-motion--bme280-temperature-sensor--bh1750-lux-illuminance-sensor)
19
+ * [ZMAi-90 Current Sensor Switch](#zmai-90-current-sensor-switch)
20
+ * [MCULED Device with RGB+W Strip](#mculed-device-with-rgbw-strip)
21
+ * [MCULED Device with RGB+W Strip - Version 2 ( Basement )](#mculed-device-with-rgbw-strip---version-2--basement-)
22
+ * [MCULED Device with RGB+W Strip - Version 2 ( Cottage Sink )](#mculed-device-with-rgbw-strip---version-2--cottage-sink-)
23
+ * [Tuya Dimmer Module as a FAN](#tuya-dimmer-module-as-a-fan)
24
+ * [Trailer Relay Board](#trailer-relay-board)
25
+ * [Gowfeel EN71 Water Valve](#gowfeel-en71-water-valve)
26
+ * [Homebrew Doorbutton Button](#homebrew-doorbutton-button)
27
+ * [Homebrew Garage Door Opener](#homebrew-garage-door-opener)
28
+ * [CE SMART Wifi Dimmer](#ce-smart-wifi-dimmer)
29
+ * [FEIT Wifi Dimmer](#feit-wifi-dimmer)
30
+ * [Using a FEIT Wifi Dimmer as a remote switch to OpenBK RGBCCT Potlights](#using-a-feit-wifi-dimmer-as-a-remote-switch-to-openbk-rgbcct-potlights)
31
+ * [Turn off after 30 minutes](#turn-off-after-30-minutes)
32
+ * [Hampton Bay Fan/Light RF Remote Control ( 303.9 Mhz )](#hampton-bay-fanlight-rf-remote-control--3039-mhz-)
33
+ * [Valor Fireplace Remote ( 315 Mhz )](#valor-fireplace-remote--315-mhz-)
34
+ * [Treatlife DS03 Fan Controller and Light Dimmer](#treatlife-ds03-fan-controller-and-light-dimmer)
35
+ * [OpenMQTTGateway devices](#openmqttgateway-devices)
36
+ * [Hampton Bay Light](#hampton-bay-light)
37
+ * [Hampton Bay FAN](#hampton-bay-fan)
38
+ * [openMQTTGateway / PiLight temperature sensor](#openmqttgateway--pilight-temperature-sensor)
39
+ * [Internet Connection WatchDog](#internet-connection-watchdog)
40
+ * [Version 1 ( Uses node-red to monitor google.com and turn off the plug )](#version-1--uses-node-red-to-monitor-googlecom-and-turn-off-the-plug-)
41
+ * [Version 2](#version-2)
9
42
  <!--te-->
10
43
 
11
44
  # My standard config after setting name and device configuration <!-- omit in toc -->
package/gh-md-toc CHANGED
@@ -23,7 +23,7 @@
23
23
  # substr($0, match($0, "href=\"[^\"]+?\" ")+6, RLENGTH-8)
24
24
  #
25
25
 
26
- gh_toc_version="0.8.0"
26
+ gh_toc_version="0.10.0"
27
27
 
28
28
  gh_user_agent="gh-md-toc v$gh_toc_version"
29
29
 
@@ -55,15 +55,15 @@ gh_toc_md2html() {
55
55
 
56
56
  URL=https://api.github.com/markdown/raw
57
57
 
58
- if [ ! -z "$GH_TOC_TOKEN" ]; then
58
+ if [ -n "$GH_TOC_TOKEN" ]; then
59
59
  TOKEN=$GH_TOC_TOKEN
60
60
  else
61
61
  TOKEN_FILE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/token.txt"
62
62
  if [ -f "$TOKEN_FILE" ]; then
63
- TOKEN="$(cat $TOKEN_FILE)"
63
+ TOKEN="$(cat "$TOKEN_FILE")"
64
64
  fi
65
65
  fi
66
- if [ ! -z "${TOKEN}" ]; then
66
+ if [ -n "${TOKEN}" ]; then
67
67
  AUTHORIZATION="Authorization: token ${TOKEN}"
68
68
  fi
69
69
 
@@ -72,7 +72,7 @@ gh_toc_md2html() {
72
72
  if grep -Fxq "<!--te-->" "$gh_src"; then
73
73
  # cut everything before the toc
74
74
  gh_tmp_file_md=$gh_file_md~~
75
- sed '1,/<!--te-->/d' $gh_file_md > $gh_tmp_file_md
75
+ sed '1,/<!--te-->/d' "$gh_file_md" > "$gh_tmp_file_md"
76
76
  fi
77
77
  fi
78
78
 
@@ -84,7 +84,7 @@ gh_toc_md2html() {
84
84
  -H "$AUTHORIZATION" \
85
85
  "$URL")
86
86
 
87
- rm -f $gh_file_md~~
87
+ rm -f "${gh_file_md}~~"
88
88
 
89
89
  if [ "$?" != "0" ]; then
90
90
  echo "XXNetworkErrorXX"
@@ -152,7 +152,8 @@ gh_toc(){
152
152
  echo
153
153
  fi
154
154
  else
155
- local rawhtml=$(gh_toc_md2html "$gh_src" "$skip_header")
155
+ local rawhtml
156
+ rawhtml=$(gh_toc_md2html "$gh_src" "$skip_header")
156
157
  if [ "$rawhtml" == "XXNetworkErrorXX" ]; then
157
158
  echo "Parsing local markdown file requires access to github API"
158
159
  echo "Please make sure curl is installed and check your network connectivity"
@@ -165,7 +166,8 @@ gh_toc(){
165
166
  echo "or place GitHub auth token here: ${TOKEN_FILE}"
166
167
  exit 1
167
168
  fi
168
- local toc=`echo "$rawhtml" | gh_toc_grab "$gh_src_copy" "$indent"`
169
+ local toc
170
+ toc=`echo "$rawhtml" | gh_toc_grab "$gh_src_copy" "$indent"`
169
171
  echo "$toc"
170
172
  if [ "$need_replace" = "yes" ]; then
171
173
  if grep -Fxq "<!--ts-->" "$gh_src" && grep -Fxq "<!--te-->" "$gh_src"; then
@@ -176,14 +178,16 @@ gh_toc(){
176
178
  fi
177
179
  local ts="<\!--ts-->"
178
180
  local te="<\!--te-->"
179
- local dt=`date +'%F_%H%M%S'`
181
+ local dt
182
+ dt=$(date +'%F_%H%M%S')
180
183
  local ext=".orig.${dt}"
181
184
  local toc_path="${gh_src}.toc.${dt}"
182
185
  local toc_createdby="<!-- Created by https://github.com/ekalinin/github-markdown-toc -->"
183
- local toc_footer="<!-- Added by: `whoami`, at: `date` -->"
186
+ local toc_footer
187
+ toc_footer="<!-- Added by: `whoami`, at: `date` -->"
184
188
  # http://fahdshariff.blogspot.ru/2012/12/sed-mutli-line-replacement-between-two.html
185
189
  # clear old TOC
186
- sed -i${ext} "/${ts}/,/${te}/{//!d;}" "$gh_src"
190
+ sed -i"${ext}" "/${ts}/,/${te}/{//!d;}" "$gh_src"
187
191
  # create toc file
188
192
  echo "${toc}" > "${toc_path}"
189
193
  if [ "${no_footer}" != "yes" ]; then
@@ -218,6 +222,8 @@ gh_toc(){
218
222
  # $2 - number of spaces used to indent.
219
223
  #
220
224
  gh_toc_grab() {
225
+
226
+ href_regex="/href=\"[^\"]+?\"/"
221
227
  common_awk_script='
222
228
  modified_href = ""
223
229
  split(href, chars, "")
@@ -237,26 +243,25 @@ gh_toc_grab() {
237
243
  }
238
244
  print sprintf("%*s", (level-1)*'"$2"', "") "* [" text "](" gh_url modified_href ")"
239
245
  '
240
- if [ `uname -s` == "OS/390" ]; then
246
+ if [ "`uname -s`" == "OS/390" ]; then
241
247
  grepcmd="pcregrep -o"
242
248
  echoargs=""
243
249
  awkscript='{
244
- level = substr($0, length($0), 1)
245
- text = substr($0, match($0, /a>.*<\/h/)+2, RLENGTH-5)
246
- href = substr($0, match($0, "href=\"([^\"]+)?\"")+6, RLENGTH-7)
250
+ level = substr($0, 3, 1)
251
+ text = substr($0, match($0, /<\/span><\/a>[^<]*<\/h/)+11, RLENGTH-14)
252
+ href = substr($0, match($0, '$href_regex')+6, RLENGTH-7)
247
253
  '"$common_awk_script"'
248
254
  }'
249
255
  else
250
256
  grepcmd="grep -Eo"
251
257
  echoargs="-e"
252
258
  awkscript='{
253
- level = substr($0, length($0), 1)
254
- text = substr($0, match($0, /a>.*<\/h/)+2, RLENGTH-5)
255
- href = substr($0, match($0, "href=\"[^\"]+?\"")+6, RLENGTH-7)
259
+ level = substr($0, 3, 1)
260
+ text = substr($0, match($0, /">.*<\/h/)+2, RLENGTH-5)
261
+ href = substr($0, match($0, '$href_regex')+6, RLENGTH-7)
256
262
  '"$common_awk_script"'
257
263
  }'
258
264
  fi
259
- href_regex='href=\"[^\"]+?\"'
260
265
 
261
266
  # if closed <h[1-6]> is on the new line, then move it on the prev line
262
267
  # for example:
@@ -265,8 +270,11 @@ gh_toc_grab() {
265
270
  # became: The command <code>foo1</code></h1>
266
271
  sed -e ':a' -e 'N' -e '$!ba' -e 's/\n<\/h/<\/h/g' |
267
272
 
273
+ # Sometimes a line can start with <span>. Fix that.
274
+ sed -e ':a' -e 'N' -e '$!ba' -e 's/\n<span/<span/g' |
275
+
268
276
  # find strings that corresponds to template
269
- $grepcmd '<a.*id="user-content-[^"]*".*</h[1-6]' |
277
+ $grepcmd '<h.*class="heading-element".*</a' |
270
278
 
271
279
  # remove code tags
272
280
  sed 's/<code>//g' | sed 's/<\/code>//g' |
@@ -275,7 +283,7 @@ gh_toc_grab() {
275
283
  sed 's/<g-emoji[^>]*[^<]*<\/g-emoji> //g' |
276
284
 
277
285
  # now all rows are like:
278
- # <a id="user-content-..." href="..."><span ...></span></a> ... </h1
286
+ # <h1 class="heading-element">title</h1><a href="..."><span>..</span></a>
279
287
  # format result line
280
288
  # * $0 - whole string
281
289
  # * last element of each row: "</hN" where N in (1,2,3,...)
@@ -301,8 +309,8 @@ show_version() {
301
309
  echo
302
310
  for tool in curl wget grep awk sed; do
303
311
  printf "%-5s: " $tool
304
- if `type $tool &>/dev/null`; then
305
- echo `$tool --version | head -n 1`
312
+ if type $tool &>/dev/null; then
313
+ $tool --version | head -n 1
306
314
  else
307
315
  echo "not installed"
308
316
  fi
@@ -310,7 +318,8 @@ show_version() {
310
318
  }
311
319
 
312
320
  show_help() {
313
- local app_name=$(basename "$0")
321
+ local app_name
322
+ app_name=$(basename "$0")
314
323
  echo "GitHub TOC generator ($app_name): $gh_toc_version"
315
324
  echo ""
316
325
  echo "Usage:"
@@ -355,17 +364,18 @@ gh_toc_app() {
355
364
  if [ "$1" = "-" ]; then
356
365
  if [ -z "$TMPDIR" ]; then
357
366
  TMPDIR="/tmp"
358
- elif [ -n "$TMPDIR" -a ! -d "$TMPDIR" ]; then
367
+ elif [ -n "$TMPDIR" ] && [ ! -d "$TMPDIR" ]; then
359
368
  mkdir -p "$TMPDIR"
360
369
  fi
361
370
  local gh_tmp_md
362
- if [ `uname -s` == "OS/390" ]; then
363
- local timestamp=$(date +%m%d%Y%H%M%S)
371
+ if [ "`uname -s`" == "OS/390" ]; then
372
+ local timestamp
373
+ timestamp=$(date +%m%d%Y%H%M%S)
364
374
  gh_tmp_md="$TMPDIR/tmp.$timestamp"
365
375
  else
366
- gh_tmp_md=$(mktemp $TMPDIR/tmp.XXXXXX)
376
+ gh_tmp_md=$(mktemp "$TMPDIR/tmp.XXXXXX")
367
377
  fi
368
- while read input; do
378
+ while read -r input; do
369
379
  echo "$input" >> "$gh_tmp_md"
370
380
  done
371
381
  gh_toc_md2html "$gh_tmp_md" | gh_toc_grab "" "$indent"
@@ -408,4 +418,4 @@ gh_toc_app() {
408
418
  #
409
419
  # Entry point
410
420
  #
411
- gh_toc_app "$@"
421
+ gh_toc_app "$@"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "Tasmota",
3
3
  "name": "homebridge-tasmota",
4
- "version": "0.1.12",
4
+ "version": "0.1.13",
5
5
  "description": "Homebridge plugin for Tasmota devices leveraging home assistant auto discovery.",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
@@ -22,7 +22,7 @@
22
22
  "watch": "nodemon",
23
23
  "build": "rimraf ./dist && tsc",
24
24
  "prepublishOnly": "npm run lint && npm run build",
25
- "document": "./gh-md-toc --insert DEVICES.md"
25
+ "document": "./gh-md-toc --hide-footer DEVICES.md"
26
26
  },
27
27
  "nodemonConfig": {
28
28
  "watch": [
@@ -50,10 +50,10 @@
50
50
  "@types/node": "^14.18.42",
51
51
  "@typescript-eslint/eslint-plugin": "^3.9.0",
52
52
  "@typescript-eslint/parser": "^3.9.0",
53
- "documentation": "^14.0.1",
53
+ "documentation": "^14.0.3",
54
54
  "eslint": "^7.22.0",
55
55
  "homebridge": "^1.3.9",
56
- "nodemon": "^2.0.7",
56
+ "nodemon": "^3.1.3",
57
57
  "rimraf": "^3.0.2",
58
58
  "ts-node": "^9.1.1",
59
59
  "typescript": "^4.2.3"