Skip to content

Commit

Permalink
fixed env variables import from systemd + example systemd service
Browse files Browse the repository at this point in the history
  • Loading branch information
escomputers committed Mar 26, 2023
1 parent 4d44501 commit 6ffeb50
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 4 deletions.
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
adafruit-circuitpython-bme280
requests
board
15 changes: 15 additions & 0 deletions sensor.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[Unit]
Description=Air Temperature
Wants=network-online.target
After=network-online.target

[Service]
ExecStart=/usr/bin/python /root/hassio-growbox/sensors/bme280/air-temperature.py
WorkingDirectory=/root/hassio-growbox/sensors/bme280
Environment=PYTHONPATH=/root/hassio-growbox/env/lib/python3.9/site-packages
Restart=on-failure
EnvironmentFile=/etc/environment
#StartLimitIntervalSec=0

[Install]
WantedBy=multi-user.target
2 changes: 1 addition & 1 deletion sensors/bme280/air-humidity.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

syslog.openlog(facility=syslog.LOG_LOCAL0)

LLA_TOKEN = os.environ["TOKEN"]
LLA_TOKEN = os.getenv("TOKEN")

i2c = board.I2C()
bme280 = adafruit_bme280.Adafruit_BME280_I2C(i2c)
Expand Down
2 changes: 1 addition & 1 deletion sensors/bme280/air-pressure.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

syslog.openlog(facility=syslog.LOG_LOCAL0)

LLA_TOKEN = os.environ["TOKEN"]
LLA_TOKEN = os.getenv("TOKEN")

i2c = board.I2C()
bme280 = adafruit_bme280.Adafruit_BME280_I2C(i2c)
Expand Down
2 changes: 1 addition & 1 deletion sensors/bme280/air-temperature.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

syslog.openlog(facility=syslog.LOG_LOCAL0)

LLA_TOKEN = os.environ["TOKEN"]
LLA_TOKEN = os.getenv("TOKEN")

i2c = board.I2C()
bme280 = adafruit_bme280.Adafruit_BME280_I2C(i2c)
Expand Down

0 comments on commit 6ffeb50

Please sign in to comment.