Skip to content

Commit

Permalink
Bump TheengsGateway to v1.0.0 (#25)
Browse files Browse the repository at this point in the history
Bump TheengsGateway to v1.0.0
Update run.sh

convert boolean to integer
  • Loading branch information
1technophile authored May 1, 2023
1 parent 6bff874 commit f29321f
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 26 deletions.
10 changes: 10 additions & 0 deletions theengsgateway/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
## [1.7.0]
## What's Changed
* Fix diagnose and run diagnostics when log level is DEBUG by @koenvervloesem in https://github.com/theengs/gateway/pull/122
* Add APPLE_CONT and APPLE_CONTAT to default discovery filter by @koenvervloesem in https://github.com/theengs/gateway/pull/123
* Run ruff and mypy in pre-commit by @koenvervloesem in https://github.com/theengs/gateway/pull/125
* Add publish_advdata option by @koenvervloesem in https://github.com/theengs/gateway/pull/127
* [RMAC] Filter random mac devices by @1technophile in https://github.com/theengs/gateway/pull/128
* [TD] Update TheengsDecoder requirement version to 1.4.0 by @1technophile in https://github.com/theengs/gateway/pull/129
* [RMAC] Remove unnecessary filters by @1technophile in https://github.com/theengs/gateway/pull/130

## [1.6.1]
## What's Changed
* Filter APPLE_CONT devices by @1technophile in https://github.com/mihsu81/addon-theengsgw/pull/23
Expand Down
46 changes: 24 additions & 22 deletions theengsgateway/DOCS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,29 @@
6. Start the Add-on.

## Parameters
Option | Type | Required | Description
--- | --- | --- | ---
MQTT_HOST | string | Yes | MQTT host address, i.e. the IP/hostname of your Moquitto Broker Add-on
MQTT_USERNAME | string | Yes | MQTT username
MQTT_PASSWORD | string | Yes | MQTT password
MQTT_PORT | integer | Yes | MQTT host port, defaults to `1883`
MQTT_PUB_TOPIC | string | No | MQTT publish topic, defaults to `home/TheengsGateway/BTtoMQTT`
MQTT_SUB_TOPIC | string | No | MQTT subscribe topic, defaults to `home/+/BTtoMQTT/undecoded`
PRESENCE | boolean | No | Publish room presence detection, defaults to `no`
MQTT_PRE_TOPIC | string | No | MQTT presence topic, defaults to `home/presence/TheengsGateway`
PUBLISH_ALL | boolean | No | Publish all beacons if true, defaults to `yes`
SCAN_DUR | int | No | BLE scan duration (seconds), defaults to `60`
TIME_BETWEEN | int | No | Seconds to wait between scans, defaults to `60`
LOG_LEVEL | string | No | TheengsGateway log level, defaults to `WARNING`
DISCOVERY | boolean | No | Activate discovery or not `true`
DISCOVERY_TOPIC | string | No | Home Assistant discovery topic`homeassistant/sensor`
DISCOVERY_DEVICE_NAME | string | No | Device name `TheengsGateway`
DISCOVERY_FILTER | string | No | Excluded BLE devices models `[IBEACON,GAEN,MS-CDP,APPLE_CONT]`
ADAPTER | string | No | Bluetooth adapter (e.g. hci1 on Linux)
SCANNING_MODE | string | No | Change scanning mode between `active` and `passive`, defaults to `active`
TIME_SYNC | string | No | Addresses of BLE devices to synchronize time (defaults to the empty list `[]`)
TIME_FORMAT | boolean | No | Use 12-hour (`yes`) or 24-hour (`no`) time format for clocks (defaults to `no`)

| Option | Type | Required | Description |
| --------------------- | ------- | -------- | ------------------------------------------------------------------------------- |
| MQTT_HOST | string | Yes | MQTT host address, i.e. the IP/hostname of your Moquitto Broker Add-on |
| MQTT_USERNAME | string | Yes | MQTT username |
| MQTT_PASSWORD | string | Yes | MQTT password |
| MQTT_PORT | integer | Yes | MQTT host port, defaults to `1883` |
| MQTT_PUB_TOPIC | string | No | MQTT publish topic, defaults to `home/TheengsGateway/BTtoMQTT` |
| MQTT_SUB_TOPIC | string | No | MQTT subscribe topic, defaults to `home/+/BTtoMQTT/undecoded` |
| PRESENCE | boolean | No | Publish room presence detection, defaults to `no` |
| MQTT_PRE_TOPIC | string | No | MQTT presence topic, defaults to `home/presence/TheengsGateway` |
| PUBLISH_ALL | boolean | No | Publish all beacons if true, defaults to `yes` |
| PUBLISH_ADVDATA | boolean | No | Publish advertisements data if true, defaults to `no` |
| SCAN_DUR | int | No | BLE scan duration (seconds), defaults to `60` |
| TIME_BETWEEN | int | No | Seconds to wait between scans, defaults to `60` |
| LOG_LEVEL | string | No | TheengsGateway log level, defaults to `WARNING` |
| DISCOVERY | boolean | No | Activate discovery or not `true` |
| DISCOVERY_TOPIC | string | No | Home Assistant discovery topic`homeassistant/sensor` |
| DISCOVERY_DEVICE_NAME | string | No | Device name `TheengsGateway` |
| DISCOVERY_FILTER | string | No | Excluded BLE devices models `[IBEACON,GAEN,MS-CDP,APPLE_CONT]` |
| ADAPTER | string | No | Bluetooth adapter (e.g. hci1 on Linux) |
| SCANNING_MODE | string | No | Change scanning mode between `active` and `passive`, defaults to `active` |
| TIME_SYNC | string | No | Addresses of BLE devices to synchronize time (defaults to the empty list `[]`) |
| TIME_FORMAT | boolean | No | Use 12-hour (`yes`) or 24-hour (`no`) time format for clocks (defaults to `no`) |

For more details please refer to [TheengsGateway](https://theengs.github.io/gateway/).
4 changes: 2 additions & 2 deletions theengsgateway/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
ARG BUILD_FROM
FROM $BUILD_FROM
LABEL io.hass.version="1.6.1" io.hass.type="addon" io.hass.arch="armv7|armhf|aarch64|i386|amd64"
LABEL io.hass.version="1.7.0" io.hass.type="addon" io.hass.arch="armv7|armhf|aarch64|i386|amd64"
RUN apt-get update && apt-get upgrade -y && \
apt-get install --no-install-recommends -y build-essential bluez python3-pip python3-dev && \
pip3 install --extra-index-url=https://www.piwheels.org/simple TheengsGateway==0.9.0
pip3 install --extra-index-url=https://www.piwheels.org/simple TheengsGateway==1.0.0
ENV current /root
ENV HOME $current
WORKDIR $current
Expand Down
6 changes: 4 additions & 2 deletions theengsgateway/config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "TheengsGateway",
"version": "1.6.1",
"version": "1.7.0",
"slug": "theengsgw",
"description": "TheengsGateway HA Add-on",
"url": "https://github.com/mihsu81/addon-theengsgw",
Expand All @@ -23,13 +23,14 @@
"MQTT_PRE_TOPIC": "home/presence/TheengsGateway",
"PRESENCE": false,
"PUBLISH_ALL": true,
"PUBLISH_ADVDATA": false,
"SCAN_DUR": 10,
"TIME_BETWEEN": 60,
"LOG_LEVEL": "WARNING",
"DISCOVERY": true,
"DISCOVERY_TOPIC": "homeassistant/sensor",
"DISCOVERY_DEVICE_NAME": "TheengsGateway",
"DISCOVERY_FILTER": "[IBEACON,GAEN,MS-CDP,APPLE_CONT]",
"DISCOVERY_FILTER": "[IBEACON]",
"ADAPTER": "",
"SCANNING_MODE": "active",
"TIME_SYNC": "[]",
Expand All @@ -44,6 +45,7 @@
"MQTT_SUB_TOPIC": "str?",
"MQTT_PRE_TOPIC": "str?",
"PUBLISH_ALL": "bool?",
"PUBLISH_ADVDATA": "bool?",
"PRESENCE": "bool?",
"SCAN_DUR": "int?",
"TIME_BETWEEN": "int?",
Expand Down
9 changes: 9 additions & 0 deletions theengsgateway/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ MQTT_SUB_TOPIC=$(bashio::config 'MQTT_SUB_TOPIC')
MQTT_PRE_TOPIC=$(bashio::config 'MQTT_PRE_TOPIC')
PRESENCE=$(bashio::config 'PRESENCE')
PUBLISH_ALL=$(bashio::config 'PUBLISH_ALL')
PUBLISH_ADVDATA=$(bashio::config 'PUBLISH_ADVDATA')
SCAN_DUR=$(bashio::config 'SCAN_DUR')
TIME_BETWEEN=$(bashio::config 'TIME_BETWEEN')
LOG_LEVEL=$(bashio::config 'LOG_LEVEL')
Expand All @@ -26,6 +27,13 @@ ADAPTER=$(bashio::config 'ADAPTER')
TIME_SYNC=$(bashio::config 'TIME_SYNC')
TIME_FORMAT=$(bashio::config 'TIME_FORMAT')

# Convert the booleans to integers (1 for true, 0 for false) in single lines
PRESENCE=$( [ "$PRESENCE" = "true" ] && echo 1 || echo 0 )
PUBLISH_ALL=$( [ "$PUBLISH_ALL" = "true" ] && echo 1 || echo 0 )
PUBLISH_ADVDATA=$( [ "$PUBLISH_ADVDATA" = "true" ] && echo 1 || echo 0 )
DISCOVERY=$( [ "$DISCOVERY" = "true" ] && echo 1 || echo 0 )
TIME_FORMAT=$( [ "$TIME_FORMAT" = "true" ] && echo 1 || echo 0 )

{
echo "{"
echo " \"host\": \"${MQTT_HOST}\","
Expand All @@ -37,6 +45,7 @@ TIME_FORMAT=$(bashio::config 'TIME_FORMAT')
echo " \"presence_topic\": \"${MQTT_PRE_TOPIC}\","
echo " \"presence\": ${PRESENCE},"
echo " \"publish_all\": ${PUBLISH_ALL},"
echo " \"publish_advdata\": ${PUBLISH_ADVDATA},"
echo " \"ble_scan_time\": ${SCAN_DUR},"
echo " \"ble_time_between_scans\": ${TIME_BETWEEN},"
echo " \"log_level\": \"${LOG_LEVEL}\","
Expand Down

0 comments on commit f29321f

Please sign in to comment.