fsantini / python-e3dc

Python API for querying E3/DC systems through the manufacturer's portal
MIT License
71 stars 23 forks source link

def get_db_data - data for additional external power #44

Open MacSchierer opened 2 years ago

MacSchierer commented 2 years ago

It is possible to expand the dictionary with the additional external power?

mdhom commented 2 years ago

I opened a support ticket to retrieve the wallbox data within the db_data, maybe I can get infos on how to retrieve external power too! I'll keep this issue updated regarding the support ticket.

1tomtom commented 4 months ago

i use the python pye3dc - with the follow script and this should be give me the additional power also :

CONFIG ={"pvis": [{"index": 0,"strings": 2,"phases": 3}],"powermeters": [{"index": 0,"type": 1,"typeName": "PM_TYPE_ROOT","name": "Root PM"},{"index": 1,"type": 2,"typeN>

print("local connection")
e3dc_obj = E3DC(E3DC.CONNECT_LOCAL, username=USERNAME, password=PASS, ipAddress = TCP_IP, key = KEY, configuration = CONFIG)
# The following connections are performed through the RSCP interface
print(e3dc_obj.get_db_data(keepAlive=True))
e3dc_values=(e3dc_obj.get_db_data(keepAlive=True))
#print(e3dc_obj.get_pvi_data(keepAlive=True))
e3dc_obj.disconnect()

import requests

# Die Basis-URL, zu der die Werte gesendet werden sollen
base_url = 'http://xxx.xxx.xxx.xxx.xxx:8083/set/0_userdata.0.e3dc.pyscript.'

# Iteriere über die Schlüssel-Wert-Paare im Dictionary
for key, value in e3dc_values.items():
    # Erstelle die vollständige URL für jeden Wert
    url = f"{base_url}{key}?value={value}"

    # Sende den GET-Request an die URL
    response = requests.get(url)

    # Überprüfe die Antwort (optional)
    if response.status_code == 200:
        print(f"Wert für '{key}' erfolgreich gesendet.")

This should give me the json output to standard ... (i write the values in iobroker datapoints).

But i get only this:

local connection
{'autarky': 57.75890350341797, 'bat_power_in': 1593.5, 'bat_power_out': 893.0, 'consumed_production': 98.61620330810547, 'consumption': 12215.0, 'grid_power_in': 99.0, 'grid_power_out': 5159.75, 'solarProduction': 6267.0, 'startDate': datetime.date(2024, 2, 17), 'stateOfCharge': 42.19599914550781, 'timespan': 'DAY', 'timespanSeconds': 86400}

I don't get it, because should give me the addiotional power, but don't. as far as i know py3edc is the base from hacs-e3dc - so should work...

Sorry, in the case i wrote in the wrong thread.