mchwalisz / home-assistant-senec

SENEC Battery integration for Home Assistant
Apache License 2.0
46 stars 23 forks source link

No connection after recent update #47

Open electricdelicate opened 1 year ago

electricdelicate commented 1 year ago

After the recent firmware update, my Senec Home 2.1 becomes unavailable immediatly in home assistant. Nothing helps.

Please fix it.

Thank you.

marq24 commented 1 year ago

[EDIT] To provide everybody with a fix - without the need to read though this issue - here is a suggested solution:

With the Update to the SENEC Application v825, the integration can not communicate via http - https is required! - there is a confirmed fix available here: https://github.com/marq24/ha-senec-v3/releases/tag/3.0.5

Detailed Info & Instruction when you want to change to this fixed version

Please note, that with v0825 Senec has (temp) removed STATISTICS so that some Sensors are currently not available. A possible alternative (right now) is discussed here: https://github.com/marq24/ha-senec-v3/issues/4

[ORIGINAL] I assume you have already tried to remove the integration completely - and reinstalled it afterwards?...

When you open the original web-interface of your senec -> can you share some information what you see in the Browser DeveloperTools Network section?

electricdelicate commented 1 year ago

I assume you have already tried to remove the integration completely - and reinstalled it afterwards?...

When you open the original web-interface of your senec -> can you share some information what you see in the Browser DeveloperTools Network section?

Hi,

no remove but the reinstall option. I guess the issue is come from the http to https change. http:// ** dont work anymore but https://**

marq24 commented 1 year ago

... so you say, that after a system update your senec device is ONLY accessible via https - even from your LAN?

electricdelicate commented 1 year ago

... so you say, that after a system update your senec device is ONLY accessible via https - even from your LAN?

Of course from my LAN.

marq24 commented 1 year ago

give me a short while to add a http/https switch

bastian1607 commented 1 year ago

Exact the same error here. HTTPS working locally.

neubi4 commented 1 year ago

The switch to HTTPS is part of the recent senec update which apparently is rolling out to all systems since yesterday.

The guys over at solectrus already fixed this, there are more infos in this thread: https://github.com/solectrus/senec-collector/issues/224

It seems there are also changes in lala.cgi json response. At the moment i am on the old version, as soon as i get the update i can post the full json from my v2.1 if you need it.

marq24 commented 1 year ago

as soon as i get the update i can post the full json from my v2.1 if you need it. that would be hightly appriciated! - so you are able to deal with postman I guess - cool!

marq24 commented 1 year ago

If you like you can have a look here for an updated version -> https://github.com/marq24/ha-senec-v3/issues/3

Just as reminder - all you do, you do on your own risk!

neubi4 commented 1 year ago

I just got an update on my v2.1 to version 0825. Webinterface is still http, and this integration still works.

But this version seems to be a bit broken. Display.html (whith uppercase D) stays blank.

Log.html (with uppercase L) is completely broken, it tries to fetch the logfile with path log/2023/08/30.log (lowercase L) which does not work (Unauthorized error), but by hand with uppercase L Log/2023/08/30.log this works.

Maybe this is just an step to the next version...

neubi4 commented 1 year ago

After an hour, the webinterface updated itself and i now get the version with https.

@marq24 json responses of all three requestst from your master branch. Interesting are these VARIABLE_NOT_FOUND values, i think they are now in different fields.

read_version ```json { "FACTORY": { "SYS_TYPE": "u8_0F", "COUNTRY": "u8_00", "DEVICE_ID": "st_33424081110462489540422709" }, "WIZARD": { "APPLICATION_VERSION": "st_0825", "FIRMWARE_VERSION": "st_2307", "INTERFACE_VERSION": "st_0966" }, "BAT1": { "TYPE": "u8_03" }, "SYS_UPDATE": { "NPU_VER": "u1_000A", "NPU_IMAGE_VERSION": "u1_0905" } } ```
read_senec_v21 ```json { "ENERGY": { "STAT_STATE": "u8_0D", "GUI_BAT_DATA_POWER": "fl_C099C4DA", "GUI_INVERTER_POWER": "fl_44FF8000", "GUI_HOUSE_POW": "fl_4412C2E6", "GUI_GRID_POW": "fl_C4B6B852", "GUI_BAT_DATA_FUEL_CHARGE": "fl_428C0000", "GUI_CHARGING_INFO": "u8_00", "GUI_BOOSTING_INFO": "u8_00", "GUI_BAT_DATA_VOLTAGE": "fl_42559168", "GUI_BAT_DATA_CURRENT": "fl_BDB851EC", "GUI_BAT_DATA_OA_CHARGING": "VARIABLE_NOT_FOUND", "STAT_LIMITED_NET_SKEW": "u8_00" }, "STATISTIC": { "LIVE_BAT_CHARGE": "VARIABLE_NOT_FOUND", "LIVE_BAT_DISCHARGE": "VARIABLE_NOT_FOUND", "LIVE_GRID_EXPORT": "VARIABLE_NOT_FOUND", "LIVE_GRID_IMPORT": "VARIABLE_NOT_FOUND", "LIVE_HOUSE_CONS": "VARIABLE_NOT_FOUND", "LIVE_PV_GEN": "VARIABLE_NOT_FOUND" }, "TEMPMEASURE": { "BATTERY_TEMP": "fl_42100000", "CASE_TEMP": "fl_42187102", "MCU_TEMP": "fl_42635A55" }, "PV1": { "POWER_RATIO": "fl_42C80000" }, "PWR_UNIT": { "POWER_L1": [ "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000" ], "POWER_L2": [ "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000" ], "POWER_L3": [ "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000" ] }, "PM1OBJ1": { "FREQ": "fl_4247E147", "U_AC": [ "fl_4372B333", "fl_43738000", "fl_4373CCCD" ], "I_AC": [ "fl_400D70A4", "fl_3FD99999", "fl_402E147B" ], "P_AC": [ "fl_C3F090A3", "fl_C3A690A4", "fl_C421DF5C" ], "P_TOTAL": "fl_C4B6B852" }, "PM1OBJ2": { "FREQ": "fl_00000000", "U_AC": [ "fl_00000000", "fl_00000000", "fl_00000000" ], "I_AC": [ "fl_00000000", "fl_00000000", "fl_00000000" ], "P_AC": [ "fl_00000000", "fl_00000000", "fl_00000000" ], "P_TOTAL": "fl_00000000" } } ```
read_senec_v21_all ```json { "STATISTIC": {}, "ENERGY": { "CAPTESTMODULE": [ "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000" ], "GUI_BAT_DATA_COLLECTED": "u8_01", "GUI_BAT_DATA_CURRENT": "fl_BE2E147B", "GUI_BAT_DATA_FUEL_CHARGE": "fl_428C0000", "GUI_BAT_DATA_MAX_CELL_VOLTAGE": "u1_0EE9", "GUI_BAT_DATA_MIN_CELL_VOLTAGE": "u1_0EE1", "GUI_BAT_DATA_POWER": "fl_C1113943", "GUI_BAT_DATA_VOLTAGE": "fl_42558F5C", "GUI_BOOSTING_INFO": "u8_00", "GUI_CAP_TEST_STATE": "u8_00", "GUI_CHARGING_INFO": "u8_00", "GUI_GRID_POW": "fl_C5408FD7", "GUI_HOUSE_POW": "fl_4522A162", "GUI_INIT_CHARGE_START": "u8_00", "GUI_INIT_CHARGE_STOP": "u8_00", "GUI_INVERTER_POWER": "fl_45B15000", "GUI_TEST_CHARGE_STAT": "u8_00", "GUI_TEST_DISCHARGE_STAT": "u8_00", "INIT_CHARGE_ACK": "u8_00", "INIT_CHARGE_DIFF_VOLTAGE": "fl_00000000", "INIT_CHARGE_MAX_CURRENT": "fl_00000000", "INIT_CHARGE_MAX_VOLTAGE": "fl_00000000", "INIT_CHARGE_MIN_VOLTAGE": "fl_00000000", "INIT_CHARGE_RERUN": "u8_00", "INIT_CHARGE_RUNNING": "u8_00", "INIT_CHARGE_STATE": "u8_00", "INIT_CHARGE_TIMER": "u6_0000000000000000", "INIT_DISCHARGE_MAX_CURRENT": "fl_00000000", "LI_STORAGE_MODE_RUNNING": "u8_00", "LI_STORAGE_MODE_START": "u8_00", "LI_STORAGE_MODE_STOP": "u8_00", "SAFE_CHARGE_FORCE": "u8_00", "SAFE_CHARGE_PROHIBIT": "u8_00", "SAFE_CHARGE_RUNNING": "u8_00", "STAT_HOURS_OF_OPERATION": "u3_00003575", "STAT_LIMITED_NET_SKEW": "u8_00", "STAT_STATE": "u8_0D", "ZERO_EXPORT": "u8_00" }, "FEATURES": { "CAR": "u8_00", "CLOUDREADY": "u8_01", "ECOGRIDREADY": "u8_01", "HEAT": "u8_00", "ISLAND": "u8_00", "ISLAND_PRO": "u8_00", "PEAKSHAVING": "u8_00", "SGREADY": "u8_00", "SHKW": "u8_00", "SOCKETS": "u8_00" }, "LOG": { "LOG_IN_BUTT": "u8_00", "LOG_IN_NOK_COUNT": "u8_00", "LOG_OUT_BUTT": "u8_00", "PASSWORD": "st_", "USERNAME": "st_", "USER_LEVEL": "u8_00" }, "SYS_UPDATE": { "FSM_STATE": "u8_01", "MISC": [ "u8_00", "u8_00", "u8_00", "u8_00", "u8_00", "u8_00" ], "NPU_IMAGE_VERSION": "u1_0905", "NPU_VER": "u1_000A", "UPDATE_AVAILABLE": "u8_00", "USER_REBOOT_DEVICE": "u8_00", "USER_REQ_UPDATE": "u8_00" }, "WIZARD": { "APPLICATION_HASH": "st_478e9310f37c4f8adafd861cc723904796885136", "APPLICATION_VERSION": "st_0825", "BATT_IPU_MISMATCH": "u8_00", "BOOT": "u8_01", "CHARGE_PRIO": "u8_00", "CONFIG_CHECKSUM": "u1_98EE", "CONFIG_LOADED": "u8_01", "CONFIG_MODIFIED_BY_USER": "u8_00", "CONFIG_WRITE": "u8_00", "DEVICE_BATTERY_TYPE": "u8_03", "DEVICE_INVERTER_TYPE": "u8_42", "DEVICE_INV_ENABLED": [ "u8_01", "u8_00", "u8_00", "u8_00", "u8_00", "u8_00" ], "DEVICE_INV_PHASES_ARR": [ "u8_04", "u8_04", "u8_04", "u8_04", "u8_04", "u8_04" ], "DEVICE_INV_SLAVE_ADRESS": [ "u8_01", "u8_04", "u8_05", "u8_06", "u8_07", "u8_08" ], "DEVICE_PM_GRID_ENABLED": "u8_01", "DEVICE_PM_HOUSE_ENABLED": "u8_00", "DEVICE_PM_TYPE": "u8_01", "DEVICE_WB_TYPE": "u8_00", "FEATURECODE_ENTERED": "u8_00", "FIRMWARE_VERSION": "st_2307", "GRID_CONNECTION_TYPE": "u8_02", "GUI_LANG": "u8_00", "HEAT_CONN_TYPE": "u8_02", "INSULATION_RESISTANCE": "u3_000003E8", "INTERFACE_VERSION": "st_0966", "LOGGER_SEVERITY": "u8_08", "MAC_ADDRESS_BYTES": [ "u8_14", "u8_1F", "u8_BA", "u8_21", "u8_3F", "u8_67" ], "MASTER_SLAVE_ADDRESSES": [ "u8_00", "u8_00", "u8_00", "u8_00", "u8_00", "u8_00" ], "MASTER_SLAVE_MODE": "u8_00", "PS_ENABLE": "u8_00", "PS_HOUR": "u8_00", "PS_MINUTE": "u8_00", "PS_RESERVOIR": "u8_00", "PV_CONFIG": [ "u8_01", "u8_01" ], "PWRCFG_PEAK_PV_POWER": "fl_46091C00", "SETUP_ABS_POWER": "u3_00000000", "SETUP_HV_PHASE": "u8_00", "SETUP_NUMBER_WALLBOXES": "u8_00", "SETUP_PM_GRID_ADR": "u8_01", "SETUP_PM_HOUSE_ADR": "u8_02", "SETUP_POWER_RULE": "u8_46", "SETUP_PV_INV_IP0": "u3_00000000", "SETUP_PV_INV_IP1": "u3_00000000", "SETUP_PV_INV_IP2": "u3_00000000", "SETUP_PV_INV_IP3": "u3_00000000", "SETUP_PV_INV_IP4": "u3_00000000", "SETUP_PV_INV_IP5": "u3_00000000", "SETUP_RCR_STEPS": [ "u1_0000", "u1_001E", "u1_003C", "u1_0064" ], "SETUP_USED_PHASE": "u8_01", "SETUP_USE_ABS_POWER": "u8_00", "SETUP_USE_DRM0": "u8_00", "SETUP_USE_RCR": "u8_00", "SETUP_WALLBOX_SERIAL0": "st_", "SETUP_WALLBOX_SERIAL1": "st_", "SETUP_WALLBOX_SERIAL2": "st_", "SETUP_WALLBOX_SERIAL3": "st_", "SG_READY_CURR_MODE": "u8_01", "SG_READY_ENABLED": "u8_00", "SG_READY_ENABLE_OVERWRITE": "u8_00", "SG_READY_EN_MODE1": "u8_00", "SG_READY_OVERWRITE_RELAY": [ "u8_00", "u8_00" ], "SG_READY_POWER_COMM": "u1_FFFF", "SG_READY_POWER_NORMAL": "u1_0000", "SG_READY_POWER_PROP": "u1_FFFF", "SG_READY_TIME": "u1_02D0", "ZEROMODULE": "u8_00" }, "BMS": { "ALARM_STATUS": [ "u1_0000", "u1_0000", "u1_0000", "u1_0000" ], "BATTERY_STATUS": [ "u1_0000", "u1_0000", "u1_0000", "u1_0000" ], "BL": [ "u1_30C0", "u1_30C0", "u1_30C0", "u1_0000" ], "BMS_READY_FLAG": "u8_01", "BMS_STATUS": "u8_01", "BMS_STATUS_TIMESTAMP": "i3_64EF4239", "CELL_BALANCE_STATUS": [ "u1_0000", "u1_0000", "u1_0000", "u1_0000" ], "CELL_TEMPERATURES_MODULE_A": [ "i8_21", "i8_21", "i8_23", "i8_22", "i8_23", "i8_22" ], "CELL_TEMPERATURES_MODULE_B": [ "i8_21", "i8_22", "i8_23", "i8_23", "i8_23", "i8_22" ], "CELL_TEMPERATURES_MODULE_C": [ "i8_22", "i8_23", "i8_23", "i8_23", "i8_24", "i8_23" ], "CELL_TEMPERATURES_MODULE_D": [ "i8_00", "i8_00", "i8_00", "i8_00", "i8_00", "i8_00" ], "CELL_VOLTAGES_MODULE_A": [ "u1_0EE6", "u1_0EE6", "u1_0EE7", "u1_0EE4", "u1_0EE7", "u1_0EE4", "u1_0EE6", "u1_0EE5", "u1_0EE5", "u1_0EE6", "u1_0EE5", "u1_0EE5", "u1_0EE6", "u1_0EE8" ], "CELL_VOLTAGES_MODULE_B": [ "u1_0EE5", "u1_0EE5", "u1_0EE6", "u1_0EE6", "u1_0EE7", "u1_0EE6", "u1_0EE5", "u1_0EE2", "u1_0EE4", "u1_0EE5", "u1_0EE4", "u1_0EE6", "u1_0EE6", "u1_0EE7" ], "CELL_VOLTAGES_MODULE_C": [ "u1_0EE9", "u1_0EE7", "u1_0EE8", "u1_0EE6", "u1_0EE7", "u1_0EE7", "u1_0EE5", "u1_0EE1", "u1_0EE4", "u1_0EE7", "u1_0EE6", "u1_0EE7", "u1_0EE1", "u1_0EE7" ], "CELL_VOLTAGES_MODULE_D": [ "u1_0000", "u1_0000", "u1_0000", "u1_0000", "u1_0000", "u1_0000", "u1_0000", "u1_0000", "u1_0000", "u1_0000", "u1_0000", "u1_0000", "u1_0000", "u1_0000" ], "CHARGED_ENERGY": [ "u3_1F9B3133", "u3_1F9DD6F3", "u3_1F908EBB", "u3_00000000" ], "CHARGE_CURRENT_LIMIT": [ "fl_40C00000", "fl_40C00000", "fl_40C00000", "fl_00000000" ], "COMMERRCOUNT": "u1_0000", "CURRENT": [ "fl_BD4CCCCD", "fl_BD4CCCCD", "fl_BD8F5C29", "fl_00000000" ], "CYCLES": [ "u1_003A", "u1_003A", "u1_003A", "u1_0000" ], "DERATING": "u8_00", "DISCHARGED_ENERGY": [ "u3_2338A9FE", "u3_2339B455", "u3_23669B5C", "u3_00000000" ], "DISCHARGE_CURRENT_LIMIT": [ "fl_C1400000", "fl_C1400000", "fl_C1400000", "fl_00000000" ], "ERROR": "u8_00", "FAULTLINECOUNT": "u1_0002", "FW": [ "u1_9AD5", "u1_9AD5", "u1_9AD5", "u1_0000" ], "HW_EXTENSION": [ "u1_0002", "u1_0002", "u1_0002", "u1_0000" ], "HW_MAINBOARD": [ "u1_0BBA", "u1_0BBA", "u1_0BBA", "u1_0000" ], "MANUFACTURER": "u8_02", "MAX_CELL_VOLTAGE": [ "u1_0EE8", "u1_0EE7", "u1_0EE9", "u1_0000" ], "MAX_TEMP": "i1_0168", "MIN_CELL_VOLTAGE": [ "u1_0EE4", "u1_0EE2", "u1_0EE1", "u1_0000" ], "MIN_TEMP": "i1_014A", "MODULES_CONFIGURED": "u8_03", "MODULE_COUNT": "u8_03", "NOM_CHARGEPOWER_MODULE": "fl_441C4000", "NOM_DISCHARGEPOWER_MODULE": "fl_449C4000", "NR_INSTALLED": "u8_03", "PROTOCOL": "u1_0000", "RECOVERLOCKED": "u8_00", "SERIAL": [ "st_", "st_", "st_", "st_" ], "SN": [ "u3_029F7507", "u3_029F7509", "u3_029F7505", "u3_00000000" ], "SOC": [ "u1_0043", "u1_0043", "u1_0043", "u1_0000" ], "SOH": [ "u8_63", "u8_63", "u8_63", "u8_00" ], "STATUS": [ "u3_00000001", "u3_00000001", "u3_00000001", "u3_00000000" ], "SYSTEM_SOC": "u1_029E", "TEMP_MAX": [ "i8_23", "i8_23", "i8_24", "i8_00" ], "TEMP_MIN": [ "i8_21", "i8_21", "i8_22", "i8_00" ], "TF_ERROR": "u8_00", "VOLTAGE": [ "fl_42559168", "fl_42558B44", "fl_42559375", "fl_00000000" ], "WIZARD_ABORT": "u8_01", "WIZARD_CONFIRM": "u8_00", "WIZARD_DCCONNECT": "u1_0000", "WIZARD_START": "u8_00", "WIZARD_STATE": "u8_00" }, "BAT1": { "CEI_LIMIT": "u1_0000", "DRM0_ASSERT": "u8_00", "ISLAND_ENABLE": "u8_00", "NSP2_FW": "u1_00F3", "NSP_FW": "u1_00F3", "RESET": "u8_00", "SELFTEST_ACT": [ "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000" ], "SELFTEST_LIMIT": [ "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000" ], "SELFTEST_OFF": [ "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000" ], "SELFTEST_OVERALL_STATE": "u8_00", "SELFTEST_STATE": [ "u8_00", "u8_00", "u8_00", "u8_00", "u8_00", "u8_00", "u8_00", "u8_00" ], "SELFTEST_STEP": [ "st_", "st_", "st_", "st_", "st_", "st_", "st_", "st_" ], "SELFTEST_TIME": [ "u1_0000", "u1_0000", "u1_0000", "u1_0000", "u1_0000", "u1_0000", "u1_0000", "u1_0000" ], "SERIAL": "st_", "SPARE_CAPACITY": "u8_00", "TRIG_ITALY_SELF": "u8_00", "TYPE": "u8_03" }, "BAT1OBJ1": { "COMM": "u8_00", "I_DC": "fl_3DCCCCCD", "P": "i1_0000", "Q": "i1_0000", "S": "i1_0000", "SW_VERSION": "u3_00000294", "SW_VERSION2": "u3_000000F3", "SW_VERSION3": "u3_000000F3", "TEMP1": "u1_001F", "TEMP2": "u1_001F", "TEMP3": "u1_0024", "TEMP4": "u1_0000", "TEMP5": "u1_0000", "U_DC": "fl_42540000" }, "BAT1OBJ2": { "OBJECT_NOT_FOUND": "" }, "BAT1OBJ3": { "OBJECT_NOT_FOUND": "" }, "BAT1OBJ4": { "OBJECT_NOT_FOUND": "" }, "PWR_UNIT": { "ADRESS": [ "u8_00", "u8_00", "u8_00", "u8_00", "u8_00", "u8_00" ], "CONNPWR": [ "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000" ], "CONNPWR_1": [ "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000" ], "CONNPWR_2": [ "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000" ], "CONNPWR_3": [ "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000" ], "CURRENTTEMP_MAX": [ "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000" ], "CURRENTTEMP_MAX_HW": [ "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000" ], "CURRENTTEMP_MIN": [ "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000" ], "CURRENTTEMP_MIN_HW": [ "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000" ], "ENFLURI": [ "u8_00", "u8_00", "u8_00", "u8_00", "u8_00", "u8_00" ], "FW_VER": [ "u1_0000", "u1_0000", "u1_0000", "u1_0000", "u1_0000", "u1_0000" ], "HW_REV": [ "u1_0000", "u1_0000", "u1_0000", "u1_0000", "u1_0000", "u1_0000" ], "POWER": [ "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000" ], "POWER_L1": [ "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000" ], "POWER_L2": [ "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000" ], "POWER_L3": [ "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000" ], "PU_MISSING": "u8_01", "REQ_POWER": [ "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000" ], "SERIAL": [ "st_", "st_", "st_", "st_", "st_", "st_" ], "STATUS": [ "u3_00000000", "u3_00000001", "u3_00000002", "u3_00000003", "u3_00000004", "u3_00000005" ], "TEMPMAX": [ "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000" ], "TEMPMIN": [ "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000" ], "TEMPTARGET": [ "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000", "fl_00000000" ], "TEMP_COUNT": [ "u1_0000", "u1_0000", "u1_0000", "u1_0000", "u1_0000", "u1_0000" ], "TEMP_LIMIT_LOWER": "fl_00000000", "TEMP_LIMIT_UPPER": "fl_42C80000", "TYPE": [ "u8_00", "u8_00", "u8_00", "u8_00", "u8_00", "u8_00" ], "WATERVOL": [ "u1_0000", "u1_0000", "u1_0000", "u1_0000", "u1_0000", "u1_0000" ] }, "PV1": { "ERROR_STATE_INT": [ "u3_00000000", "u3_00000000" ], "INTERNAL_INV_ERROR_TEXT": [ "st_", "st_" ], "INTERNAL_INV_ERR_STATE_VALID": [ "u8_00", "u8_00" ], "INTERNAL_INV_STATE": [ "u8_05", "u8_05" ], "INTERNAL_MD_AVAIL": [ "u8_00", "u8_00" ], "INTERNAL_MD_MANUFACTURER": [ "st_", "st_" ], "INTERNAL_MD_MODEL": [ "st_", "st_" ], "INTERNAL_MD_SERIAL": [ "st_", "st_" ], "INTERNAL_MD_VERSION": [ "st_", "st_" ], "INTERNAL_PV_AVAIL": "u8_00", "INV_MODEL": [ "st_", "st_END_OF_ARRAY" ], "INV_SERIAL": [ "st_", "st_END_OF_ARRAY" ], "INV_VERSIONS": [ "st_", "st_END_OF_ARRAY" ], "MPP_AVAIL": "u8_00", "MPP_CUR": [ "fl_00000000", "fl_00000000", "fl_00000000" ], "MPP_POWER": [ "fl_00000000", "fl_00000000", "fl_00000000" ], "MPP_VOL": [ "fl_00000000", "fl_00000000", "fl_00000000" ], "POWER_RATIO": "fl_42C80000", "POWER_RATIO_L1": "fl_42C80000", "POWER_RATIO_L2": "fl_42C80000", "POWER_RATIO_L3": "fl_42C80000", "PV_MISSING": "u8_00", "P_TOTAL": "fl_C5B15000", "STATE_INT": [ "u3_00000000", "u3_00000000" ], "TYPE": "u8_42" } } ```
marq24 commented 1 year ago

@marq24 json responses of all three requestst from your master branch. Interesting are these VARIABLE_NOT_FOUND values... I hope you are one the "development" branch [when you used the pre3.0.5https...

But I read the positive message - that it works in general... right? -> would be cool, if we can continue the discussion then in the fork repo ;-)

neubi4 commented 1 year ago

I am currently at work and only did the three post tests. Today in the evening i will switch to your fork and will give you an response there.

Basti-Fantasti commented 1 year ago

I can confirm the change to htps on the latest version on my v2.1. http is no longer available.

EDIT: I just checked on the SENEC webinterface if there's any chance to enable http again - but no. There is no parameter available.

marq24 commented 1 year ago

So to "close" this issue here and provide some additional information;

With the Update to the SENEC Application v825, the integration can not communicate via http - https is required! - there is a confirmed fix available here: https://github.com/marq24/ha-senec-v3/releases/tag/3.0.5

A short tutorial how to switch to the other fork is available here

Please note, that with v825 Senec has (temp) removed STATISTICS so that some Sensors are currently not available.

Kuechenfenster commented 1 year ago

Hi, so I've 3.0.5 set, but still have the "VARIABLE_NOT_FOUND" at some of the sensors, how to fix that?

neubi4 commented 1 year ago

@Kuechenfenster there is no fix for that because it seems Senec removed this variables at least in Senec Home V2.1.

In https://github.com/marq24/ha-senec-v3/issues/4 is an workaround documented using Home Assistans Helpers with Riemann sum integral to get this long time stats.

bobthebuilder4711 commented 1 year ago

You should stay away from Riemann sum integrals if you can since those can with time differ wildly from what the battery reports itself.

The totals in kWh are still there to download from mein-senec.de und updated there every 5 minutes, so I would prefer using that. @mstuettgen wrote a basic but working python script to bring these numbers into home assistant via MQTT (I helped): https://github.com/mstuettgen/homeassistant-addons/tree/main/senecweb2mqtt

I would prefer to use those numbers if possible instead of calculating them myself. Because every time your calculation routine is interrupted, it starts differing from what the battery calculates itself. And you will also never get the temporal resolution to accurately calculate the numbers in changing weather.

marq24 commented 1 year ago

You should stay away from Riemann sum integrals if you can since those can with time differ wildly from what the battery reports itself....

I am in contact with mstuettgen and the "plan" is (not a promise) to integrate the mein-senec web-access in the integration... but of course we need some time

LoreTru commented 1 year ago

Senec Home V2 and V3 firmware was updated. You can identify the new version with the MCU: 825; GUI: 966; NPU:2309; bootloader: 2307 versions numbers. With this new release the web server will not longer respond in HTTP, but only in HTTPS.

bobthebuilder4711 commented 1 year ago

You should stay away from Riemann sum integrals if you can since those can with time differ wildly from what the battery reports itself....

I am in contact with mstuettgen and the "plan" is (not a promise) to integrate the mein-senec web-access in the integration... but of course we need some time

You really only have to tell the Senec class in pysenec/init.py the login data for mein-senec.de and then poll the values every 5 minutes and overwrite the values in self._raw["STATISTIC"], so that nothing really changes for the rest of the integration.

I don't really want to create yet another fork of this integration and then do a hack job with adding the polling since I don't really have much experience with python in home assistant. So I'd prefer if you did this.

But it doesn't seem that big of a deal. I added polling of the lala.cgi to the script from mstuettgen and have been using that for the last 24 hours without any problems (and will probably even stick to that for the foreseeable future). So adding the polling of mein-senec.de to the integration shouldn't be that time consuming if you know your way around integrations.

Edit: If I find the time, I might just do that hack job and make a pull request on your repo.

marq24 commented 1 year ago

I spend almost the complete afternoon trying to get a working version of https://github.com/mstuettgen/homeassistant-addons/blob/main/senecweb2mqtt/senec_webgrabber.py with aiohttp (instead of request - since aiohttp is the core engine in HA - at least in the current senec-intg)...

Here is my 'failing' code... https://gist.github.com/marq24/38939eede1b710bbbf532361b4729058

the login/auth is not working for what ever reason... Looking forward for a working version...

electricdelicate commented 1 year ago

I spend almost the complete afternoon trying to get a working version of https://github.com/mstuettgen/homeassistant-addons/blob/main/senecweb2mqtt/senec_webgrabber.py with aiohttp (instead of request - since aiohttp is the core engine in HA - at least in the current senec-intg)...

Here is my 'failing' code... https://gist.github.com/marq24/38939eede1b710bbbf532361b4729058

the login/auth is not working for what ever reason... Looking forward for a working version...

And what about the suggestion above from Bobthebuilder4711?

marq24 commented 1 year ago

And what about the suggestion above from Bobthebuilder4711?

without going into the details... if it would had been 'that easy' (for me), than I would not had spend 8h+ trying to get exactly THAT to work - but I had no success... (but this does not mean anything - I am python newbee) - So any HELP is hightly appriciated - I do this in my free time.

Everybody is invited to contribute to the existing sources and create a PR if he has a working solution.

bobthebuilder4711 commented 1 year ago

@electricdelicate The integration should be done properly and if aiohttp is the way to go with home assistant then trying it in a much simpler test program seems like the right path to that goal.

I'll have a go at it myself and will then probably write @marq24 an email if he checks the one I've found.

marq24 commented 1 year ago

@electricdelicate The integration should be done properly and if aiohttp is the way to go with home assistant then... I'll have a go at it myself and will then probably write @marq24 an email if he checks the one I've found.

looking forward to this - as I said - this code here is IMHO the 'aiohttp' version of the 'senec_webgrabber.py' https://gist.github.com/marq24/38939eede1b710bbbf532361b4729058 - but this code does not work...

neubi4 commented 1 year ago

@marq24 i created a quick POC based on your code, but using the senec App API. https://gist.github.com/neubi4/8545db537531e90f3ad5f0f11306a3f7

Its only quick and dirty and gets the current today data which are in Wh, so there needs more work to be done, but maybe this helps. I also have more time next week if you need more help. There is a bit of documentation for the App API here: https://documenter.getpostman.com/view/10329335/UVCB9ihW

What seems to be missing is the total data of the complete lifetime from an system. You can view this in the App using a custom time range, so it also should be possible using the API, it just needs to be sniffed in the network traffic.

❯ python ./run.py
DEBUG:asyncio:Using selector: EpollSelector
DEBUG:__main__:***** update(self) ********
DEBUG:__main__:***** authenticate(self) ********
INFO:__main__:Login successful
DEBUG:__main__:***** get_devices(self) ********
DEBUG:__main__:***** update(self) ********
DEBUG:__main__:***** update_stats(self) ********
DEBUG:__main__:Results:
DEBUG:__main__:********* energy_entities ***************
DEBUG:__main__:stromerzeugung: 4693.359375
DEBUG:__main__:stromverbrauch: 4800.0
DEBUG:__main__:netzeinspeisung: 856.4453125
DEBUG:__main__:netzbezug: 222.16796875
DEBUG:__main__:speicherbeladung: 1894.04296875
DEBUG:__main__:speicherentnahme: 2638.671875
DEBUG:__main__:wallbox: 0.0
DEBUG:__main__:********* power_entities *****************
DEBUG:__main__:********* battery_entities *****************
DEBUG:__main__:speicherfuellstand: 13.244443893432617
DEBUG:__main__:autarkie: 95.38
marq24 commented 1 year ago

Thanks @neubi4 - I am sorry that I did not mentioned this detail here - using the (mobilApp?)-API (getting a token and use that with the (via the postman "documented") API is working... That was one thing I also tried during my session yesterday - even tried to use the token with the alternative requests... also tried different encoding schemes - none of them has been successful... my-integration-wip-code

I'll keep this "documented"-API as fallback scenario - IMHO the code from @mstuettgen "have-to" work with the aiohttp client - even if this means, that aiohttp needs an update...

[WARNING-NERD-STUFF ON] when you are enable the redirect logging, then you can compare 'request' vs 'aiohttp'... When you reqeust (initialy) https://mein-senec.de/auth/login

at a certain point you will receive a 302 to https://mein-senec.de/oauth2/authorization/login-portal - and this request will be responded with another redirect to https://mein-senec.de/auth/oauth2/authorize?response_type=code&client_id=login-portal&scope=user&state=[RANDOM-STRING-HERE]%3D&redirect_uri=https://mein-senec.de/login/oauth2/code/login-portal - and THIS redirect will be handled (IMHO) different by aiohtto (compared to request...

The Location header of this last request includes a parm-encoded 'redirect_uri' (https://mein-senec.de/login/oauth2/code/login-portal) itself - IMHO request processing this Location instruction correctly... while aiohttp does not - I even tried to patch my aiohttp-client to handle the redirect_uri attr -> but without success - in between a additional code has to be calculated/read - and this is then failing also with a 401.

So you see - I tried already 'some' stuff... [WARNING-NERD-STUFF OFF]

bobthebuilder4711 commented 1 year ago

I've been trying with a minimal example that just tries to login, but I'm always just getting error code 401 back, no matter what I try.

Is there a reason why the requests library can't be used in an integration? Is it not available in hass?

marq24 commented 1 year ago

I've been trying with a minimal example that just tries to login, but I'm always just getting error code 401 back, no matter what I try.

welcome to my world (of yesterday)... at least we can agree, that's not just as simple as though...

Is there a reason why the requests library can't be used in an integration? Is it not available in hass?

I am far away from being a hass expect - all what I can say right now is, that in all the integrations I have here locally the integration get a web-session object from hass - and this object is always a aiohttp... There might be the possibility to create a own session within the integration...

marq24 commented 1 year ago

... in the meantime I can at least confirm, that aiohttp causing/have a cookie issue... with a patched CookieJar I have some working code

bobthebuilder4711 commented 1 year ago

I've looked into how other integrations do this and the spotify integration uses OAuth2Session, so I googled that and landed here: https://developers.home-assistant.io/docs/api_lib_auth/ where it says: "If you are using requests,..." with examples.

So there is nothing stopping you from just creating your own session with requests. Just won't run asynchronously. But is that really important?

marq24 commented 1 year ago

So there is nothing stopping you from just creating your own session with requests. Just won't run asynchronously. But is that really important?

nothing is stopping you either... When the Spotify integration works flawless for you and if you believe it's a smart move when running requests with 10+ redirects synchronously on your ha installation then that's fine.

For some strange reason I am currently interested in the root cause of the issue with aiohttp (and provide a fixed version)... which is the cookie handling (finding the "best-matching" cookie instead of the last-received-matching cookie).

... and beside that - sun is shining - so I probably will spend some time on the bike too ;-)

bobthebuilder4711 commented 1 year ago

As I previously said: I'm currently happy with just using the modified MQTT script and doubt I'll be changing that in the foreseeable future. I have to use MQTT anyway since I've also got a bluetti battery that sends its values to HA that way. (Which is the reason why we came up with that solution for the senec home v4 in the first place.)

I just didn't want you to get hung up on problems with aiohttp if you don't really have to. If you still want to then go for it.

Edit: And it seems like our home v2.1 forgot that it is supposed to poll our external inverters. Since yesterday morning it thinks that the sun exploded. Guess I'll have to call the installer again on Monday and hope he wants to visit us again. In the meantime I can at least get the data directly from the inverters with the SMA integration...

marq24 commented 1 year ago

For those who does not like to use riemann-sum-integral platform - I just released an 'working' mein-senec.de web-api integration-addon... when you like to give it a try -> https://github.com/marq24/ha-senec-v3/issues/3#issuecomment-1698659083 [switch-fork-instructions]

Ich-h4lt commented 1 year ago

Sounds great! Thank you for your work! Will it be possible to only use the values from Mein-Senec? I own a v4 and as you know, I can’t connect to it locally.

marq24 commented 1 year ago

Sounds great! Thank you for your work! Will it be possible to only use the values from Mein-Senec? I own a v4 and as you know, I can’t connect to it locally.

Of course you can... just select 'SENEC.Home V4/SENEC.Home V4 hybrid' from the initial combo box and you will be guided through the setup process...

Ich-h4lt commented 1 year ago

First Tests are positive. Setup was super easy 👍 great work! The values are correct but within the wrong range. So I get values in W but they should be kW instead. See a screenshot attached. What else I can provide you for debugging?

IMG_9304

Best greetings

marq24 commented 1 year ago

First Tests are positive. Setup was super easy 👍 great work! The values are correct but within the wrong range. So I get values in W but they should be kW instead.

upsi - please find an update version here... https://github.com/marq24/ha-senec-v3/releases/tag/3.0.6-test-04

I guess you have to remove & reinstall the integration to get finally the correct values

Ich-h4lt commented 1 year ago

I was able to change the units within the entities of the device directly. But thanks for fixing.

jnsness commented 1 year ago

Works for me - anyone knows why the energy dashboard in HA still has the old values of the old integration (cache was already cleaned)? And how can I provide the new entities to it? The dropdown does not provide the correct list of values

marq24 commented 1 year ago

@jnsness please have a look here - https://github.com/marq24/ha-senec-v3/issues/4 in th https imp by SENEC the statistics data is missing - there are two possible solutions...

FreedomTears commented 1 year ago

does anyone see a chance that we get a fix for the http/https issue in this repository as well?

bobthebuilder4711 commented 1 year ago

does anyone see a chance that we get a fix for the http/https issue in this repository as well?

Only if you get the author of this repository to become active again. He might be on vacation currently or something like that but if nothing happens in the next few weeks then you can consider this repository as abandoned.

If I were you, I would switch to the integration of @marq24 and then use template sensors (example here: https://github.com/marq24/ha-senec-v3/issues/4#issuecomment-1704052799 The text is in German, but the example template sensor should be self-explanatory). Then use the template sensors where ever you want to use them and if that integration ever gets abandoned you can always just change the sensors that the template sensors get their data from.

Just be aware that some sensors are in W and some are in kW. But you can just divide the template's state by 1000 or multiply it by 1000 to get the desired result.

jnsness commented 1 year ago

Migrating to @marq24 solution and using templates sensors for the dashboard I did but needed to rollback to the last backup because I lost all statistic / history data. How can we prevent that? Just use the same entity ID?

marq24 commented 1 year ago

Migrating to @marq24 solution and using templates sensors for the dashboard I did but needed to rollback to the last backup because I lost all statistic / history data. How can we prevent that? Just use the same entity ID?

would that help https://github.com/marq24/ha-senec-v3/issues/11 ? But your assumption is also valid - as @bobthebuilder4711 has suggested using template sensors (to archive the final matching)...

bobthebuilder4711 commented 1 year ago

would that help marq24#11 ? But your assumption is also valid - as @bobthebuilder4711 has suggested using template sensors (to archive the final matching)...

I myself have done both. I have deactivated (not deleted!) the old integration so that the energy dashboard still knows about that data.

And then I have set up templates so that in the future the data source can change if it has to. I've added the new sensors into the templates and then have added the templates to the energy dashboard.


In the future I will probably play around with the database and write an SQL script to migrate the historical data of the old integration over to the templates. But for now I'm fine with the old integration simply being deactivated.

jnsness commented 1 year ago

Alright - then I will aim for that. Do you want to provide the template scripts? I think you are using total_increasing at every template?

bobthebuilder4711 commented 1 year ago

The first one is an example for one of the "total" sensors. If your source sensor isn't in kWh but in Wh but you want the template sensor in kWh then the state should look like this: {{ float(states('sensor.the_source_sensor')) / 1000 }}. The unique_id is needed internally by Home Assistant (see here why: https://www.home-assistant.io/faq/unique_id/). The entity_id will be constructed from the name and will be (in this case) sensor.never_changing_sensor_pv_production_total.

The second one is an example for the "now" sensors and has different unit, device and state class entries. You don't need these for the HA energy dashboard, but they're good if you want to construct something like the now defunct display.html.

template:
  - sensor:
    - name: "Never Changing Sensor PV Production Total"
      unique_id: "something unique like a UUID: https://www.uuidgenerator.net/"
      unit_of_measurement: kWh
      device_class: energy
      state_class: total_increasing
      state: >
        {{ float(states('sensor.the_source_sensor')) }}
  - sensor:
    - name: "Never Changing Sensor PV Production Now"
      unique_id: "something unique like a UUID: https://www.uuidgenerator.net/"
      unit_of_measurement: kW
      device_class: power
      state_class: measurement
      state: >
        {{ float(states('sensor.the_source_sensor')) }}

This code needs to be written to the configuration.yaml. You can do that with the File Editor Addon.

The templates need a reboot to become active. And please test this first with one template.

coro1404 commented 1 year ago

does anyone see a chance that we get a fix for the http/https issue in this repository as well?

this might be a valid option as the guys over at solaranzeige.de managed to get their integration working again by just changing their data collector to https (php, libcurl, https://solaranzeige.de/phpBB3/viewtopic.php?p=29873&sid=94fb769eaa6e45bf00bbb7003fbad6fa#p29873). Furthermore it might be worth investigating establishing a http to https proxy running as MITM (will investigate over the weekend) - however Senec will probably introduce more breaking changes (obviously they don't care about community projects) so the proxy might not be a final solution. Has anyone tried to fix this repository by just switching it to https wherever possible?