-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support kwh and much more logging (#12)
* Add additional logging with undecoded and decoded data received, for future compatibility of new models * Add debug logging for model * Make baudrates variable and add module for probing possible ports * Remove baudrate option from main * Make try_baudrates a little more efficient * Adding break on timeout to shorten trying baudrates * Set version to 0.5.2 * Increase timeout to 30 seconds * More debug logging * More debug logging and add tests * More debug logging * Timeout to 60 seconds * Add support and conversion for kWh * Remove try_baudrates * Simplify kwh test * Make timeout variable through CLI * Fix kwh-conversion and add more logging * Set version to 0.5.7 * Fix debugging statement
- Loading branch information
Showing
11 changed files
with
185 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
!LUGCUH50 | ||
6.8(0071813*kWh)6.26(01084.58*m3)9.21(70376057) | ||
6.26*01(00898.98*m3)6.8*01(0059059*kWh) | ||
F(0)9.20(70376057)6.35(60*m) | ||
6.6(0026.3*kW)6.6*01(0026.3*kW)6.33(000.300*m3ph)9.4(114.9*C&090.8*C)\ | ||
6.31(0032214*h)6.32(0000000*h)9.22(R)9.6(000&70376057&0&000&70376057&0) | ||
9.7(20000)6.32*01(0000000*h)6.36(01-01&00:00)6.33*01(000.300*m3ph) | ||
6.8.1()6.8.2()6.8.3()6.8.4()6.8.5() | ||
6.8.1*01()6.8.2*01()6.8.3*01() | ||
6.8.4*01()6.8.5*01() | ||
9.4*01(114.9*C&083.9*C) | ||
6.36.1(2021-02-11)6.36.1*01(2021-02-11) | ||
6.36.2(2021-02-11)6.36.2*01(2021-02-11) | ||
6.36.3(2021-02-11)6.36.3*01(2021-02-11) | ||
6.36.4(2023-03-25)6.36.4*01(2020-09-06) | ||
6.36.5()6.36*02(01&00:00)9.36(2023-08-20&10:22:22)9.24(1.5*m3ph) | ||
9.17(0)9.18()9.19()9.25() | ||
9.1(0&1&0&0000&CECV&CECV&1&5.24&5.24&F&101008&1>1>04&08&0&00&:5&00&20) | ||
9.2(&&)9.29()9.31(0016196*h) | ||
9.0.1(00000000)9.0.2(00000000)9.34.1(000.00000*m3)9.34.2(000.00000*m3) | ||
8.26.1(00000000*m3)8.26.2(00000000*m3) | ||
8.26.1*01(00000000*m3)8.26.2*01(00000000*m3) | ||
6.26.1()6.26.4()6.26.5() | ||
6.26.1*01()6.26.4*01()6.26.5*01()0.0(70376057) | ||
! | ||
h | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from datetime import datetime | ||
import os | ||
import unittest | ||
from unittest.mock import patch | ||
from ultraheat_api import FileReader, UltraheatReader, HeatMeterService | ||
|
||
DUMMY_FILE = 'LUGCUH50_dummy_utf8_kwh.txt' | ||
DUMMY_PORT = 'DUMMY' | ||
path = os.path.abspath(os.path.dirname(__file__)) | ||
dummy_file_path = os.path.join(path, DUMMY_FILE) | ||
|
||
# Create a list from the dummy file to use as mock for reading the port | ||
with open(dummy_file_path, "rb") as f: | ||
mock_readline = f.read().splitlines(keepends=True) | ||
|
||
class HeatMeterTest(unittest.TestCase): | ||
|
||
def assert_response_data(self, response_data): | ||
# check the response dummy data | ||
self.assertEqual('LUGCUH50', response_data.model) | ||
self.assertEqual(71.813, response_data.heat_usage_mwh) | ||
self.assertEqual(1084.58, response_data.volume_usage_m3) | ||
self.assertEqual(59.059, response_data.heat_previous_year_mwh) | ||
|
||
def test_heat_meter_read_file(self): | ||
heat_meter_service = HeatMeterService( | ||
FileReader(dummy_file_path) | ||
) | ||
response_data = heat_meter_service.read() | ||
self.assert_response_data(response_data) | ||
|
||
if __name__ == '__main__': | ||
unittest.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
"""Define constants for ultraheat""" | ||
DEFAULT_BAUDRATE_WAKE_UP = 300 | ||
DEFAULT_BAUDRATE_DATA_STREAM = 2400 | ||
DEFAULT_TIMEOUT = 60 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.