Closed CarstenGrohmann closed 2 hours ago
What do you think about returning False here?
No, False
indicates an unsuccessful write.
Rather this code should be moved to process
method
now = datetime.now()
delta = now - self.__last_update_ts
if delta.total_seconds() < 5 * 60:
return
This is not always necessary. What is your opinion on setting the logger time only once a day or when it changes from unavailable to available?
The main purpose of this feature is to let the microinverter reset the energy meter on a daily basis. In the initial implementation the time was set only when the logger became online. Later, I discovered, that some microinverters ignore the set-time command despite the write was successful, so I decided to change the implementation to the current one. It greatly increases the reliability of this feature for the price of a bit more modbus traffic, which is in my opinion acceptable. So I'm against the change that you propose.
Sound reasonable.
Does this also reset the daily energy counter every 5 minutes? Where is this reset implemented?
Does this also reset the daily energy counter every 5 minutes? Where is this reset implemented?
This is inverter's internal energy counter. The reset functionality is implemented inside of the inverter's firmware. When an inverter is connected to the internet then it synchronizes its internal clock with the solarman servers. This is especially important for an inverter that shuts down itself for the night. However, if you disconnect the inverter from the internet, then it's no longer capable to sync its internal clock. That is why this feature is needed. We update the clock, and the inverter resets its energy counter once it detects a date (not time) difference.
Thanks for the explanation. I now understand why the values are not zeroed at every set time.
Describe the bug
DeyeSetTimeProcessor.__set_time()
returns a boolean value based on the signature.https://github.com/kbialek/deye-inverter-mqtt/blob/ef72887383e3a2e0bc7a3e4a55b5574ebcf65bb5/src/deye_set_time_processor.py#L57-L61
What do you think about returning False here?
Currently the time is set once every 5 minutes.
This is not always necessary. What is your opinion on setting the logger time only once a day or when it changes from unavailable to available?