rosswarren / epevermodbus

Python library for communicating with EPever solar charge controllers
MIT License
43 stars 18 forks source link

Add temperature limit readings #3

Open hrford opened 2 years ago

hrford commented 2 years ago

There are four documented temperature readings starting at 0x9017, Read/Write functions 0x03/0x10: "Batt Hi temp limit" "Batt Lo temp limit" "Device over temp" "Device recovery temp"

source https://www.img4.cz/i4wifi/attach/StoItem/7069/MODBUS-Protocol-v25.pdf page 16

I haven't tried, but I have a suspicion they need to be written as a block like the battery voltages. I will experiment...

hrford commented 2 years ago

Test script:

controller.set_battery_upper_temperature_limit(65.1)
controller.set_battery_lower_temperature_limit(-40.1)
controller.set_device_over_temperature(85.1)
controller.set_device_recovery_temperature(75.1)

Created a nice mess:

Battery upper temperature limit: 65.09
Battery lower temperature limit: -40.1
Device over temperature: 85.1
Device recovery temperature: 75.09

I guess the 0.09 may be to do with the device's internal rounding.

FYI Setting the battery temp limit to -65.0 turns off the output and returns why:

Battery temperature: 21.75°C
Battery status: {'wrong_identifaction_for_rated_voltage': False, 'battery_inner_resistence_abnormal': False, 'temperature_warning_status': 'OVER_TEMP', 'battery_status': 'NORMAL'}
Battery upper temperature limit: -66.0

Functionality to get/set temp limits did not require to be written as a block like the battery voltages. However, if desired, this functionality can be added (in addition to the individual functions) so users could set all at once. (I would follow the same dict approach as the battery voltages)