Skip to content

Commit 5812e14

Browse files
committed
Merge branch 'dev' into main.
2 parents 2cebc2c + 368b458 commit 5812e14

File tree

4 files changed

+13
-6
lines changed

4 files changed

+13
-6
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## [0.0.3] - 2021-09-19
2+
### Fixes
3+
* Fix issue with addon not restarting when bluetooth adapter is not available on system reboot.

config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Airthings",
3-
"version": "0.0.2",
3+
"version": "0.0.3",
44
"slug": "airthings",
55
"description": "Read sensor values from Airthings Wave environmental monitoring devices",
66
"url": "https://github.com/mjmccans/hassio-addon-airthings",

src/airthings-mqtt.ha.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def __init__(self, scan_interval, devices=None):
5959
# Get info about the devices
6060
if not self.get_device_info():
6161
# Exit if setup fails
62-
_LOGGER.error("Failed to set up Airthings sensors. Exiting.")
62+
_LOGGER.error("\033[31mFailed to set up Airthings sensors. If the watchdog option is enabled, this addon will restart and try again.\033[0m")
6363
sys.exit(1)
6464

6565
_LOGGER.info("Done Airthings setup.")
@@ -93,12 +93,12 @@ def find_devices(self):
9393
# DEVICES[d] = {}
9494
else:
9595
# Exit if no devices found
96-
_LOGGER.warning("No airthings devices found. Exiting.")
96+
_LOGGER.warning("\033[31mNo airthings devices found. If the watchdog option is enabled, this addon will restart and try again.\033[0m")
9797
sys.exit(1)
9898
except SystemExit as e:
9999
sys.exit(e)
100100
except:
101-
_LOGGER.exception("Failed while searching for devices. Is a bluetooth adapter available? Exiting.")
101+
_LOGGER.exception("\033[31mFailed while searching for devices. Is a bluetooth adapter available? If the watchdog option is enabled, this addon will restart and try again.\033[0m")
102102
sys.exit(1)
103103

104104
def get_device_info(self):
@@ -201,7 +201,7 @@ def mqtt_publish(msgs):
201201
CONFIG = json.load(f)
202202
except:
203203
# Exit if there is an error reading config file
204-
_LOGGER.exception("Error reading options.json file. Exiting.")
204+
_LOGGER.exception("\033[31mError reading options.json file. If the watchdog option is enabled, this addon will restart and try again.\033[0m")
205205
sys.exit(1)
206206

207207
# Fill in the remainder of the config values
@@ -297,7 +297,8 @@ def mqtt_publish(msgs):
297297
# Publish the sensor data to mqtt broker
298298
mqtt_publish(msgs)
299299
else:
300-
_LOGGER.error("No sensor values collected. Please check your configuration and make sure your bluetooth adapter is available.")
300+
_LOGGER.error("\033[31mNo sensor values collected. Please check your configuration and make sure your bluetooth adapter is available. If the watchdog option is enabled, this addon will restart and try again.\033[0m")
301+
sys.exit(1)
301302

302303
# Wait for next refresh cycle
303304
_LOGGER.info("Waiting {} seconds.".format(CONFIG["refresh_interval"]))

src/run-local.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
python3 ./airthings-mqtt.ha.py --host hass --username airthings --password 9%G.Af_ZF72H=KvL --config ./options.json

0 commit comments

Comments
 (0)