Jarno Rankinen
f4eb787a10
gh-5 Fetch register data from bus
...
- goburrow/modbus' ReadHoldingRegisters can only fetch 125 registers at a
time, so updateRegisters does several readings
- modbus.ReadHoldingRegisters returns a []byte, where each even byte represents
the MSB of a int16/uint16 and every odd byte is the LSB
- updateRegisters loops through each response slice forming the 16-bit
integers
Still need to figure out a way to properly handle the signed/unsigned
values, and also the enumerations and bitfields. Perhaps changing the
'signed' boolean to a byte and making that a bitfield representing the
value type would be a good way to go. The value can then be properly
formed when fetching it from the in-memory pingvinKL struct, while being
stored as an int(64) internally.
2023-02-01 00:03:47 +02:00
Jarno Rankinen
9f2d4b0c29
gh-5 Register data structure
...
Created preliminary struct for register data, create hreg slice
based on registers.csv
2023-01-31 23:01:09 +02:00
Jarno Rankinen
76d7dd424d
#5 Remove extra newlines from registers.csv
2023-01-31 22:59:55 +02:00
Jarno Rankinen
1a8cfe891d
gh-5 Created registers.csv from Enervent provided xlsx, change csv delimiter to semicolon
2023-01-31 22:57:14 +02:00
Jarno Rankinen
a3bb7aa22e
#10 /api/v1/coils content-type to application/json
2023-01-29 23:43:36 +02:00
Jarno Rankinen
c45af6d1dd
Tidy up log error output
2023-01-29 23:34:43 +02:00
Jarno Rankinen
c16f94c6d4
Closes #9 Update coil values on startup. #10 /api/v1/coils route started
2023-01-29 23:31:21 +02:00
Jarno Rankinen
876123e518
#9 Mutex locking for bus operations
2023-01-29 22:09:37 +02:00
Jarno Rankinen
8143414c39
#9 Function to update all coil values
2023-01-29 21:56:22 +02:00
Jarno Rankinen
3fab63f60f
#9 Go: Get single coil
2023-01-29 14:42:03 +02:00
Jarno Rankinen
7a8a7ec7bb
Python: Fix Lock import
2023-01-29 14:41:25 +02:00
Jarno Rankinen
ddfbc4610d
Initial steps of go implementation, prime coil data from CSV file
2023-01-28 23:28:37 +02:00
Jarno Rankinen
f9035d64c7
Use Lock() instead of Semaphore()
2023-01-20 13:02:52 +02:00
Jarno Rankinen
843cda4b6d
Only log bg data update if debug==True
2023-01-18 23:29:08 +02:00
Jarno Rankinen
2a6877cb35
Reduced timeouts, web view page is updated each second and bg data update occurs every 2 seconds. Fired API calls to flip a coil repeatedly with very short intervals, no errors were produced. Closes #2 , closes #4
2023-01-18 23:26:24 +02:00
Jarno Rankinen
9cfae44a2f
Use plain logging.xxx instead of a class property
2023-01-18 23:14:40 +02:00
Jarno Rankinen
1ae3db957b
Switched to serving with Waitress
2023-01-18 23:11:22 +02:00
Jarno Rankinen
eb878072d2
#2 Background data updates
2023-01-18 22:57:00 +02:00
Jarno Rankinen
d2eeaa1ba0
#4 first implementation of locking for bus communication
2023-01-18 21:25:30 +02:00
Jarno Rankinen
762961e53d
Started using GitHub issues & project for keeping track of features, removed TODO comments
2023-01-17 22:13:01 +02:00
Jarno Rankinen
88b17e496f
Possibility to use curl to get values in plaintext from document root. Plan is to prepend register list to the output.
2023-01-17 22:08:09 +02:00
Jarno Rankinen
66481d8404
Cleanup
2023-01-17 21:51:24 +02:00
Jarno Rankinen
3fd6669687
Renamed variables, clarified structure
2023-01-17 21:05:31 +02:00
Jarno Rankinen
a4a19458f6
/coils and /registers pages symlink to same index.html
2023-01-17 20:44:49 +02:00
Jarno Rankinen
535a6f69e3
Separated html, js and css, moved things to appropriate folders. Need to figure out how to use the same html template for two paths without copying
2023-01-17 20:40:30 +02:00
Jarno Rankinen
6833d9f4d2
NGINX configuration
2023-01-16 23:55:36 +02:00
Jarno Rankinen
1d10a5bbb0
Added index.html, NGINX required
2023-01-16 23:55:02 +02:00
Jarno Rankinen
52ff27b146
Class renaming 2
2023-01-15 23:37:18 +02:00
Jarno Rankinen
c2bf84bf90
Renamed class
2023-01-15 23:35:03 +02:00
Jarno Rankinen
595b94a896
PUT /api/v1/coils/<int:address> to flip a coil
2023-01-15 23:32:49 +02:00
Jarno Rankinen
609ae0b97f
include_reserved and live moved to query parameters, Coils class is now subscriptable, added a missing reserved coil, Coil class has an individual get() function
2023-01-15 21:46:14 +02:00
Jarno Rankinen
327c3ecd36
minimalmodbus is an attribute of the PingvinKL class now, needs to be passed on to instances of Coil class, Flask routes for reading all coils
2023-01-15 21:05:28 +02:00
Jarno Rankinen
5a9b5a697f
First steps for Flask API, print returns a string instead of printing, get() function to get values as JSON array, serialize() function to get values as Python list object
2023-01-15 19:58:30 +02:00
Jarno Rankinen
0b167c31d5
Global debug flag for enervent-logger.py
2023-01-15 15:44:26 +02:00
Jarno Rankinen
74694a6268
Commenting
2023-01-15 15:41:49 +02:00
Jarno Rankinen
281f28fc93
print() function for Coils class
2023-01-15 15:35:41 +02:00
Jarno Rankinen
159b5ec01e
Logging tuning
2023-01-15 15:29:52 +02:00
Jarno Rankinen
70976e5bdf
updateValue->fetchValue for clarity
2023-01-15 15:25:27 +02:00
Jarno Rankinen
616a25ac4e
value and updateValue (read from bus) functions in Coils class
2023-01-15 15:20:21 +02:00
Jarno Rankinen
4826d62477
Rethinking class structure
2023-01-15 14:57:49 +02:00
Jarno Rankinen
0b06729da0
Refine EnerventCoil __init__
2023-01-15 14:52:48 +02:00
Jarno Rankinen
b4ba69e505
Separate function for updating coil values
2023-01-15 14:47:35 +02:00
Jarno Rankinen
38d3bd722d
EPingvincoils class, reads values from bus on init
2023-01-15 14:44:00 +02:00
Jarno Rankinen
23bc11e769
Version variable
2023-01-15 13:18:23 +02:00
Jarno Rankinen
7aeb601700
Initial commit
2023-01-15 13:15:05 +02:00