13
13
14
14
# Ensure these are setup in settings.toml
15
15
# Requires Steam Developer API key
16
- ssid = os .getenv (' AP_SSID' )
17
- appw = os .getenv (' AP_PASSWORD' )
18
- steam_usernumber = os .getenv (' steam_id' )
19
- steam_apikey = os .getenv (' steam_api_key' )
16
+ ssid = os .getenv (" AP_SSID" )
17
+ appw = os .getenv (" AP_PASSWORD" )
18
+ steam_usernumber = os .getenv (" steam_id" )
19
+ steam_apikey = os .getenv (" steam_api_key" )
20
20
21
21
# Initialize WiFi Pool (There can be only 1 pool & top of script)
22
22
pool = socketpool .SocketPool (wifi .radio )
27
27
28
28
# Deconstruct URL
29
29
# http://api.steampowered.com/IPlayerService/GetOwnedGames/v0001/?key=XXXXXXXXXXXXXXXXXXXXX&steamid=XXXXXXXXXXXXXXXX&format=json
30
- Steam_OwnedGames_URL = ("http://api.steampowered.com/IPlayerService/GetOwnedGames/v0001/?"
31
- + "key="
32
- + steam_apikey
33
- + "&steamid="
34
- + steam_usernumber
35
- + "&format=json"
36
- )
30
+ Steam_OwnedGames_URL = (
31
+ "http://api.steampowered.com/IPlayerService/GetOwnedGames/v0001/?"
32
+ + "key="
33
+ + steam_apikey
34
+ + "&steamid="
35
+ + steam_usernumber
36
+ + "&format=json"
37
+ )
37
38
38
39
if sleep_time < 60 :
39
40
sleep_time_conversion = "seconds"
86
87
# Print Keys to Serial
87
88
steam_debug_keys = True # Set True to print Serial data
88
89
if steam_debug_keys :
89
-
90
90
game_count = steam_response ["response" ]["game_count" ]
91
91
print ("Total Games: " , game_count )
92
92
total_minutes = 0
93
-
93
+
94
94
for game in steam_response ["response" ]["games" ]:
95
95
total_minutes += game ["playtime_forever" ]
96
- total_hours = total_minutes / 60
97
- total_days = total_minutes / 60 / 24
98
- print (f' Total Hours: { total_hours } ' )
99
- print (f' Total Days: { total_days } ' )
100
-
96
+ total_hours = total_minutes / 60
97
+ total_days = total_minutes / 60 / 24
98
+ print (f" Total Hours: { total_hours } " )
99
+ print (f" Total Days: { total_days } " )
100
+
101
101
print ("Monotonic: " , time .monotonic ())
102
102
103
103
print ("\n Finished!" )
109
109
print ("Failed to get data, retrying\n " , e )
110
110
time .sleep (60 )
111
111
continue
112
- time .sleep (sleep_time )
112
+ time .sleep (sleep_time )
0 commit comments