File: example-get-chargers.py

package info (click to toggle)
python-wallbox 0.7.0-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 116 kB
  • sloc: python: 277; sh: 5; makefile: 4
file content (21 lines) | stat: -rw-r--r-- 594 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from wallbox import Wallbox, Statuses
from dotenv import load_dotenv
import os


if "WALLBOX_USER" not in os.environ:
  load_dotenv()

wallboxUsername = os.getenv("WALLBOX_USER")
wallboxPassword = os.getenv("WALLBOX_PASS")

w = Wallbox(wallboxUsername, wallboxPassword)

# Authenticate with the credentials above
w.authenticate()

# Print a list of chargers in the account
print(f"Chargers under the account {wallboxUsername}: {w.getChargersList()}")

for chargerId in w.getChargersList():
  print(f"Charger status for {chargerId}: {Statuses(w.getChargerStatus(chargerId)['status_id']).name}")