-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Report soyo inverter status #94
Comments
let me check the code, yes I think we need a nested one... |
Please try CUST_Power=WattsOut no space please. It should work:
|
Good idea! But unfortunately, it still does not work.
|
Will have a look in the next days and then we fix it. |
sounds great! thank you so much! |
I added |
Check line 599 in dbus_service.py elif self.dtuvariant == constants.DTUVARIANT_TEMPLATE:
# logging.debug("JSON data: %s" % meter_data)
power = float(get_nested(meter_data, self.custpower) * float(self.custpower_factor))
pvyield = float(get_nested(meter_data, self.custtotal) * float(self.custtotal_factor))
voltage = float(get_nested(meter_data, self.custvoltage))
dc_voltage = float(get_nested(meter_data, self.custdcvoltage))
current = float(get_nested(meter_data, self.custcurrent))
return (power, pvyield, current, voltage, dc_voltage) Every value goes to the "get_nested" function def get_nested(meter_data, path):
'''Try to extract 'path' from nested array 'meter_data' (derived from json document) and return the found value'''
value = meter_data
for path_entry in path:
try:
value = value[path_entry]
except Exception:
try:
value = value[int(path_entry)]
except Exception:
value = 0
return value which returns This is a good place to start debugging. |
I added some log lines in line 600:
the one line I commented out seems to cause problems, hence, casting e.g. output of above code:
|
Assigning the value of
|
I'm sorry for the trouble. Exactly this type of problem is already fixed in my Pullrequest which is not merged yet. There all values goes to the function like this: @staticmethod
def get_processed_meter_value(meter_data: dict, value: str, default_value: any, factor: int = 1) -> any:
'''return the processed meter value by applying the factor and return a default value due an Exception'''
get_raw_value = get_value_by_path(meter_data, value)
raw_value = convert_to_expected_type(get_raw_value, float, default_value)
if isinstance(raw_value, (float, int)):
value = float(raw_value * float(factor))
else:
value = default_value
return value
|
For reference: This is the mentioned PR which is expected to fix the above problem: #85 |
Hi all
I use Esp-Soyosource-Controller in order to control 2 soyosource inverters with input from shelly3 em. I already made DBUS aware of the AC input for L1-3. Now I also would like to register both soyos (running on L1 and L2) as inverter/pvinverter via opendtu. The config.ini is set to use only templates and the respective config part looks like this:
The idea is to use the json returned when calling 192.168.x.y/data
The json looks like
{ "L1L2L3" : "-4.51" , "ControllerName" : "SOYOSOURCE Controller" , "StartTime" : "Thu Jun 15 12:27:10 2023" , "NotAus" : "0" , "WaitSekunden" : "2" , "MaxPower" : "1000" , "SoyoCount" : "2" , "DCAmps" : "S>1" , "DCVolts" : "S>1" , "DCWatts" : "S>1" , "WattsOut" : "144"}
WattsOut
carries the needed information. However, when I try to useCUST_Power= /WattsOut
in the config, the received value is 0. The device is successfully registered with victron dbus but V/A/W value are all zero. But I would expect that due to setting of CUST_Power that I should see 144W in the victron console or the dashboard. If I ommit the leading slash (CUST_Power= WattsOut
) it does not work at all. Could it be that the parser expects a nested structure and cannot use top level entries of the json?Do you have any suggestion as of how to achieve what I am aming for?
Thank you
Gregor
The text was updated successfully, but these errors were encountered: