claudegel / sinope-130

Neviweb130 custom component for Home Assistant to manage devices connected via a GT130 and wifi devices from Sinopé
GNU General Public License v3.0
73 stars 15 forks source link

fix: Fail at start when using ACT4220WF-M #145

Closed dr1rrb closed 1 year ago

dr1rrb commented 1 year ago

When using with a ACT4220WF-M sedna multi-residential valve 2gen, the integration fails to start with this in the log:

2023-03-28 22:40:32.761 ERROR (MainThread) [homeassistant.components.switch] neviweb130: Error on device update!
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 493, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 715, in async_device_update
    await task
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/neviweb130/switch.py", line 865, in update
    self._flowmeter_threshold = device_data[ATTR_FLOW_THRESHOLD]
KeyError: 'alarm1FlowThreshold'

dumping the device_data in the log shows:

{
    "onOff": "on",
    "batteryVoltage": 6.9,
    "batteryStatus": "ok",
    "stm8Error": {
        "motorJam": false,
        "motorPosition": false,
        "motorLimit": false
    },
    "waterLeakStatus": "flowMeter",
    "flowMeterMeasurementConfig": {
        "multiplier": 0,
        "offset": 0,
        "divisor": 1
    },
    "flowMeterAlarmDisableTimer": 0
}

Note: This is only a quick patch that fixes the issue on my side, probably not the right way to do that. Note2: Reverting back to 1.9.7 fixes the issue.

claudegel commented 1 year ago

Thanks for reporting this. Can you tell me what you have in device_data when you set flowMeterAlarmDisableTimer to 1 or «on» In that case does the other parameters show up

claudegel commented 1 year ago

I'll create a branch to fix this flow-timer-fix just download switch.py to replace yours and restart HA.

claudegel commented 1 year ago

Can you check in your log for the model number of your valve. it should be model 3155. check near the beginning for line [custom_components.neviweb130] Received gateway data: The error you are showing should be normally for zigbee valve and yours is wifi

dr1rrb commented 1 year ago

Thanks for reporting this. Can you tell me what you have in device_data when you set flowMeterAlarmDisableTimer to 1 or «on» In that case does the other parameters show up

I don't know how to turn that on and actually there isn't any flow-meter on those valves ... pretty sure that this flowMeterAlarmDisableTimer is wrongly sent by the API but is irrelevant for my valves.

Can you check in your log for the model number of your valve. it should be model 3155. check near the beginning for line [custom_components.neviweb130] Received gateway data: The error you are showing should be normally for zigbee valve and yours is wifi

Well it might be the ACT4220ZB-M (I've one of each), didn't validated properly which one is causing the issue. I don't have the "gateway data" is my logs (probably just a matter of logging level), but I assume it didn't changed a lot since https://github.com/claudegel/sinope-130/pull/97#issuecomment-1270932777

I'll create a branch to fix this flow-timer-fix just download switch.py to replace yours and restart HA.

Thanks, but no rush: it's already working with my "patch" :)

claudegel commented 1 year ago

Did you test my patch https://github.com/claudegel/sinope-130/tree/flow-timer-fix/custom_components/neviweb130 By the way I've checked on Neviweb and there are new options for the wifi valve and probably the zigbee also so I'll add those in this patch. Let me know if you have time to test my fix

claudegel commented 1 year ago

to see the gateway data line you must activate log level to debug for neviweb130 in configuration.yaml custom_components.neviweb130: debug

claudegel commented 1 year ago

I've updated branch flow-timer-fix. so if you test you will need to download also file const.py I've added specific attributes for wifi valves

claudegel commented 1 year ago

I'm closing that PR and will push a new version with your fix and some new attributes for wifi valve. Feel free to contact me again if any problem with neviweb130. Thank's for your help