add-on repo

This commit is contained in:
lolouk44 2020-07-06 14:08:56 +01:00
parent 89ee8545af
commit 40ce443732
18 changed files with 690 additions and 593 deletions

View File

@ -54,15 +54,15 @@ USER1_SEX | string | Yes | male / female
USER1_NAME | string | Yes | Name of the user
USER1_HEIGHT | int | Yes | Height (in cm) of the user
USER1_DOB | string | Yes | DOB (in yyyy-mm-dd format)
USER2_LT | int | No | If the weight is less than this number, we'll assume that we're weighing User #2
USER2_SEX | string | No | male / female
USER2_NAME | string | No | Name of the user
USER2_HEIGHT | int | No |Height (in cm) of the user
USER2_DOB | string | No | DOB (in yyyy-mm-dd format)
USER3_SEX | string | No | male / female
USER3_NAME | string | No | Name of the user
USER3_HEIGHT | int | No |Height (in cm) of the user
USER3_DOB | string | No | DOB (in yyyy-mm-dd format)
USER2_LT | int | No | If the weight is less than this number, we'll assume that we're weighing User #2. Defaults to USER1_GT Value
USER2_SEX | string | No | male / female. Defaults to female
USER2_NAME | string | No | Name of the user. Defaults to Serena
USER2_HEIGHT | int | No |Height (in cm) of the user. Defaults to 95
USER2_DOB | string | No | DOB (in yyyy-mm-dd format). Defaults to 1990-01-01
USER3_SEX | string | No | male / female. Defaults to female
USER3_NAME | string | No | Name of the user. Defaults to Missy
USER3_HEIGHT | int | No |Height (in cm) of the user. Defaults to 150
USER3_DOB | string | No | DOB (in yyyy-mm-dd format). Defaults to 1990-01-01
7. Start the add-on

View File

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

View File

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

@ -17,8 +17,8 @@
"MISCALE_MAC": "00:00:00:00:00:00",
"MQTT_PREFIX": "miScale",
"MQTT_HOST": "192.168.0.1",
"MQTT_USERNAME": "",
"MQTT_PASSWORD": "",
"MQTT_USERNAME": "user",
"MQTT_PASSWORD": "passwd",
"MQTT_PORT": 1883,
"TIME_INTERVAL": 30,
"MQTT_DISCOVERY": true,
@ -43,16 +43,16 @@
},
"schema": {
"HCI_DEV": "str",
"HCI_DEV": "str?",
"MISCALE_MAC": "str",
"MQTT_PREFIX": "str",
"MQTT_PREFIX": "str?",
"MQTT_HOST": "str",
"MQTT_USERNAME": "str",
"MQTT_PASSWORD": "str",
"MQTT_PORT": "int",
"TIME_INTERVAL": "int",
"MQTT_DISCOVERY": "bool",
"MQTT_DISCOVERY_PREFIX": "str",
"MQTT_USERNAME": "str?",
"MQTT_PASSWORD": "str?",
"MQTT_PORT": "int?",
"TIME_INTERVAL": "int?",
"MQTT_DISCOVERY": "bool?",
"MQTT_DISCOVERY_PREFIX": "str?",
"USER1_GT": "int",
"USER1_SEX": "str",

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

Before

Width:  |  Height:  |  Size: 9.2 KiB

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

@ -28,34 +28,126 @@ try:
with open('/data/options.json') as json_file:
sys.stdout.write(f"{datetime.now().strftime('%Y-%m-%d %H:%M:%S')} - Loading Config From Add-On Options...\n")
data = json.load(json_file)
try:
MISCALE_MAC = data["MISCALE_MAC"]
MQTT_USERNAME = None if(data["MQTT_USERNAME"] == "") else data["MQTT_USERNAME"]
MQTT_PASSWORD = None if(data["MQTT_PASSWORD"] == "") else data["MQTT_PASSWORD"]
except:
sys.stderr.write(f"{datetime.now().strftime('%Y-%m-%d %H:%M:%S')} - MAC Address not provided...\n")
raise
try:
MQTT_USERNAME = data["MQTT_USERNAME"]
except:
MQTT_USERNAME = None
pass
try:
MQTT_PASSWORD = data["MQTT_PASSWORD"]
except:
MQTT_PASSWORD = None
pass
try:
MQTT_HOST = data["MQTT_HOST"]
except:
sys.stderr.write(f"{datetime.now().strftime('%Y-%m-%d %H:%M:%S')} - MQTT Host not provided...\n")
raise
try:
MQTT_PORT = int(data["MQTT_PORT"])
except:
MQTT_PORT = 1883
pass
try:
MQTT_PREFIX = data["MQTT_PREFIX"]
except:
MQTT_PREFIX = "miScale"
pass
try:
TIME_INTERVAL = int(data["TIME_INTERVAL"])
except:
TIME_INTERVAL = 30
pass
try:
MQTT_DISCOVERY = data["MQTT_DISCOVERY"]
except:
MQTT_DISCOVERY = True
pass
try:
MQTT_DISCOVERY_PREFIX = data["MQTT_DISCOVERY_PREFIX"]
except:
MQTT_DISCOVERY_PREFIX = "homeassistant"
pass
try:
HCI_DEV = data["HCI_DEV"][-1]
# User Variables...
except:
HCI_DEV = "hci0"[-1]
pass
try:
USER1_GT = int(data["USER1_GT"])
except:
sys.stderr.write(f"{datetime.now().strftime('%Y-%m-%d %H:%M:%S')} - USER1_GT not provided...\n")
raise
try:
USER1_SEX = data["USER1_SEX"]
except:
sys.stderr.write(f"{datetime.now().strftime('%Y-%m-%d %H:%M:%S')} - USER1_SEX not provided...\n")
raise
try:
USER1_NAME = data["USER1_NAME"]
except:
sys.stderr.write(f"{datetime.now().strftime('%Y-%m-%d %H:%M:%S')} - USER1_NAME not provided...\n")
raise
try:
USER1_HEIGHT = int(data["USER1_HEIGHT"])
except:
sys.stderr.write(f"{datetime.now().strftime('%Y-%m-%d %H:%M:%S')} - USER1_HEIGHT not provided...\n")
raise
try:
USER1_DOB = data["USER1_DOB"]
except:
sys.stderr.write(f"{datetime.now().strftime('%Y-%m-%d %H:%M:%S')} - USER1_DOB not provided...\n")
raise
try:
USER2_LT = int(data["USER2_LT"])
except:
USER2_LT = USER1_GT
pass
try:
USER2_SEX = data["USER2_SEX"]
except:
USER2_SEX = "female"
pass
try:
USER2_NAME = data["USER2_NAME"]
except:
USER2_NAME = "Serena"
pass
try:
USER2_HEIGHT = int(data["USER2_HEIGHT"])
except:
USER2_HEIGHT = 95
pass
try:
USER2_DOB = data["USER2_DOB"]
except:
USER2_DOB = "1990-01-01"
pass
try:
USER3_SEX = data["USER3_SEX"]
except:
USER3_SEX = "female"
pass
try:
USER3_NAME = data["USER3_NAME"]
except:
USER3_NAME = "Missy"
pass
try:
USER3_HEIGHT = int(data["USER3_HEIGHT"])
except:
USER3_HEIGHT = 150
pass
try:
USER3_DOB = data["USER3_DOB"]
except:
USER3_DOB = "1990-01-01"
pass
sys.stdout.write(f"{datetime.now().strftime('%Y-%m-%d %H:%M:%S')} - Config Loaded...\n")
# Failed to open options.json, Loading Config From Environment (Not HA Add-On)

5
repository.json Normal file
View File

@ -0,0 +1,5 @@
{
"name": "Lolouk44 Add-Ons",
"url": "https://github.com/lolouk44/hassio-addons",
"maintainer": "lolouk44"
}