-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathlux2.py
36 lines (27 loc) · 1.26 KB
/
lux2.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from luxtronik import Luxtronik
# Create a Luxtronik instance with the IP and port
l = Luxtronik('192.168.1.53', 8889)
# Open a file in write mode
with open('luxtronik.txt', 'w') as file:
# Function to write to file instead of printing
def write_to_file(content):
file.write(content + '\n')
# Write parameters
write_to_file("=" * 80)
write_to_file('{:^80}'.format(' Parameters '))
write_to_file("=" * 80)
for n, p in l.parameters.parameters.items():
write_to_file(f"Number: {n:<5} Name: {p.name:<60} Type: {p.__class__.__name__:<20} Value: {p.value}")
# Write calculations
write_to_file("=" * 80)
write_to_file('{:^80}'.format(' Calculations '))
write_to_file("=" * 80)
for n, c in l.calculations.calculations.items():
write_to_file(f"Number: {n:<5} Name: {c.name:<60} Type: {c.__class__.__name__:<20} Value: {c.value}")
# Write visibilities
write_to_file("=" * 80)
write_to_file('{:^80}'.format(' Visibilities '))
write_to_file("=" * 80)
for n, v in l.visibilities.visibilities.items():
write_to_file(f"Number: {n:<5} Name: {v.name:<60} Type: {v.__class__.__name__:<20} Value: {v.value}")
print("Data has been written to luxtronik.txt")