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

Trying to add a new Sedna Valve (VA4220ZB - 3/4 NPT) #130

Closed patdemers closed 1 year ago

patdemers commented 1 year ago

Hi Claude, I'm not seeing this model in the switch.py file under custom_components. this is what I'm getting in home-assistant.log

{'id': 359312, 'identifier': '588e81fffe95eb92-500b91400003e6c1', 'name': 'VA4220ZB', 'family': '3153', 'signature': {'model': 3153, 'modelCfg': 0, 'softBuildCfg': 0, 'softVersion': {'minor': 2, 'middle': 1, 'major': 0}, 'hardRev': 0}, 'location$id': 44888, 'parentDevice$id': 250543, 'group$id': 154744, 'orderIdx': 0, 'sku': 'VA4220ZB', 'vendor': 'Sinopé', 'url_en': None, 'url_fr': None}

2022-12-29 18:28:12.929 DEBUG (SyncWorker_6) [custom_components.neviweb130] Received signature data: {'signature': {'model': 3153, 'modelCfg': 0, 'softBuildCfg': 0, 'softVersion': {'minor': 2, 'middle': 1, 'major': 0}, 'hardRev': 0, 'protocol': 'sinopcom'}}

I try to add it in the switch.py but I'm getting that error:

2022-12-29 18:28:13.964 DEBUG (MainThread) [custom_components.neviweb130.switch] Setting up neviweb130 switch VA4220ZB: {'id': 359312, 'identifier': '588e81fffe95eb92-500b91400003e6c1', 'name': 'VA4220ZB', 'family': '3153', 'signature': {'model': 3153, 'modelCfg': 0, 'softBuildCfg': 0, 'softVersion': {'minor': 2, 'middle': 1, 'major': 0}, 'hardRev': 0, 'protocol': 'sinopcom'}, 'location$id': 44888, 'parentDevice$id': 250543, 'group$id': 154744, 'orderIdx': 0, 'sku': 'VA4220ZB', 'vendor': 'Sinopé', 'url_en': None, 'url_fr': None}

2022-12-29 18:28:14.699 DEBUG (SyncWorker_7) [custom_components.neviweb130.switch] Updating neviweb130 switch VA4220ZB (0.479 sec): {'onOff': 'on', 'batteryVoltage': 6.2, 'batteryStatus': 'ok', 'rssi': -28} 2022-12-29 18:28:14.905 ERROR (MainThread) [homeassistant.components.switch] neviweb130: Error on device update!

Thanks for your help.

claudegel commented 1 year ago

Hi, did you change something in switch.py so your valve is detected ? In the branch VA4200ZB-2 I've added model 3153 in the zigbee valve so it should be detected as a zigbee valve I need to find out the Error on device update. Is there more info in your log for this error ? You can test de file switch.py in the branch VA4200ZB-2 I'll add some debug on valve alert data

claudegel commented 1 year ago

do you see something about Updating alert for... in your log for your valve ? if yes please post

patdemers commented 1 year ago

Hi, Yes I did change something in switch.py to get the valve detected. Now, I just replace de switch.py from the one in the VA4200ZB-2 Branch. Here is what I got in the log now:

2022-12-30 13:54:48.199 DEBUG (MainThread) [custom_components.neviweb130.sensor] Setting up neviweb130 sensor GT130: {'id': 250543, 'identifier': '588e81fffe95eb92', 'name': 'GT130', 'family': 'GT130', 'signature': {'model': 130, 'modelCfg': 1, 'softBuildCfg': 0, 'softVersion': {'major': 2, 'middle': 3, 'minor': 0}, 'hardRev': 3, 'protocol': 'sinopcom'}, 'location$id': 44888, 'parentDevice$id': None, 'group$id': 154744, 'orderIdx': 0, 'sku': 'GT130', 'vendor': 'Sinopé', 'url_en': 'https://www.sinopetech.com/produit/passerelle-zigbee/', 'url_fr': 'https://www.sinopetech.com/en/product/gateway-zigbee/'} 2022-12-30 13:54:48.199 DEBUG (MainThread) [custom_components.neviweb130.sensor] Setting up neviweb130 sensor WL4200: {'id': 359454, 'identifier': '588e81fffe95eb92-500b914000040016', 'name': 'WL4200', 'family': '5051', 'signature': {'model': 5051, 'modelCfg': 0, 'softBuildCfg': 0, 'softVersion': {'minor': 3, 'middle': 1, 'major': 1}, 'hardRev': 0, 'protocol': 'sinopcom'}, 'location$id': 44888, 'parentDevice$id': 250543, 'group$id': 154744, 'orderIdx': 0, 'sku': 'WL4200S', 'vendor': 'Sinopé', 'url_en': None, 'url_fr': None} 2022-12-30 13:54:48.199 DEBUG (MainThread) [custom_components.neviweb130.sensor] Setting up neviweb130 sensor WL4200S: {'id': 359751, 'identifier': '588e81fffe95eb92-500b914000037ff0', 'name': 'WL4200S', 'family': '5051', 'signature': {'model': 5051, 'modelCfg': 1, 'softBuildCfg': 0, 'softVersion': {'minor': 3, 'middle': 2, 'major': 1}, 'hardRev': 0, 'protocol': 'sinopcom'}, 'location$id': 44888, 'parentDevice$id': 250543, 'group$id': 155060, 'orderIdx': 0, 'sku': 'WL4200S', 'vendor': 'Sinopé', 'url_en': None, 'url_fr': None} 2022-12-30 13:54:48.723 DEBUG (MainThread) [custom_components.neviweb130.switch] Setting up neviweb130 switch VA4220ZB: {'id': 359312, 'identifier': '588e81fffe95eb92-500b91400003e6c1', 'name': 'VA4220ZB', 'family': '3153', 'signature': {'model': 3153, 'modelCfg': 0, 'softBuildCfg': 0, 'softVersion': {'minor': 3, 'middle': 1, 'major': 0}, 'hardRev': 0, 'protocol': 'sinopcom'}, 'location$id': 44888, 'parentDevice$id': 250543, 'group$id': 154744, 'orderIdx': 0, 'sku': 'VA4220ZB', 'vendor': 'Sinopé', 'url_en': None, 'url_fr': None} 2022-12-30 13:54:48.853 DEBUG (SyncWorker_3) [custom_components.neviweb130] Received devices status: {'status': 'online'} 2022-12-30 13:54:48.853 DEBUG (SyncWorker_3) [custom_components.neviweb130.sensor] Updating neviweb130 sensor GT130 (0.126 sec): {'status': 'online'} 2022-12-30 13:54:49.524 DEBUG (SyncWorker_5) [custom_components.neviweb130] Received devices alert: {'alertLowBatt': 1} 2022-12-30 13:54:49.525 DEBUG (SyncWorker_5) [custom_components.neviweb130.switch] Updating alert for neviweb130 switch VA4220ZB (0.27 sec): {'alertLowBatt': 1} 2022-12-30 13:54:49.525 DEBUG (SyncWorker_5) [custom_components.neviweb130.switch] Updating neviweb130 switch VA4220ZB (0.27 sec): {'onOff': 'on', 'batteryVoltage': 6.3, 'batteryStatus': 'ok', 'rssi': -27} 2022-12-30 13:54:49.544 DEBUG (SyncWorker_2) [custom_components.neviweb130.sensor] Updating neviweb130 sensor WL4200 (0.466 sec): {'batteryVoltage': 3.4, 'batteryStatus': 'ok', 'waterLeakStatus': 'ok', 'roomTemperature': 14.68, 'roomTemperatureAlarmStatus': 'ok', 'rssi': -28, 'alertWaterLeak': True, 'batteryType': 'lithium'} 2022-12-30 13:54:49.634 ERROR (MainThread) [homeassistant.components.switch] neviweb130: Error on device update!

Thanks.

claudegel commented 1 year ago

OK in your Updating alert for neviweb130 switch VA4220ZB (0.27 sec): {'alertLowBatt': 1} there are supposed to have also alertLowTemp: 1. That parameter is missing Maybe it is not activated in neviweb for your valve or it is just missing for that valve. I've made some changes in switch.py so it won't fail if the parameter is missing Please download switch.py and try again

patdemers commented 1 year ago

I did see the VA4220ZB entity... but for some reason, I lost the flow valve in my configuration (FS4220). I don't know if it's related but after a re-add the flow valve, I'm not seing the Sedna valve anymore. Here is the log with your knew switch.py:

2022-12-30 16:28:40.015 DEBUG (SyncWorker_1) [custom_components.neviweb130] Received signature data: {'signature': {'model': 130, 'modelCfg': 1, 'softBuildCfg': 0, 'softVersion': {'major': 2, 'middle': 3, 'minor': 0}, 'hardRev': 3, 'protocol': 'sinopcom'}} 2022-12-30 16:28:40.136 DEBUG (SyncWorker_1) [custom_components.neviweb130] Received signature data: {'signature': {'model': 3153, 'modelCfg': 0, 'softBuildCfg': 0, 'softVersion': {'minor': 3, 'middle': 1, 'major': 0}, 'hardRev': 0, 'protocol': 'sinopcom'}} 2022-12-30 16:28:40.484 DEBUG (SyncWorker_1) [custom_components.neviweb130] Received signature data: {'signature': {'model': 5051, 'modelCfg': 0, 'softBuildCfg': 0, 'softVersion': {'minor': 3, 'middle': 1, 'major': 1}, 'hardRev': 0, 'protocol': 'sinopcom'}} 2022-12-30 16:28:40.585 DEBUG (SyncWorker_1) [custom_components.neviweb130] Received signature data: {'signature': {'model': 5051, 'modelCfg': 1, 'softBuildCfg': 0, 'softVersion': {'minor': 3, 'middle': 2, 'major': 1}, 'hardRev': 0, 'protocol': 'sinopcom'}} 2022-12-30 16:28:40.585 DEBUG (SyncWorker_1) [custom_components.neviweb130] Setting scan interval to: 0:06:00 2022-12-30 16:28:40.590 DEBUG (SyncWorker_1) [custom_components.neviweb130] Setting Homekit mode to: False 2022-12-30 16:28:40.591 DEBUG (SyncWorker_1) [custom_components.neviweb130] Setting stat interval to: 1800 2022-12-30 16:28:42.187 DEBUG (MainThread) [custom_components.neviweb130.switch] Setting up neviweb130 switch VA4220ZB: {'id': 359312, 'identifier': '588e81fffe95eb92-500b91400003e6c1', 'name': 'VA4220ZB', 'family': '3153', 'signature': {'model': 3153, 'modelCfg': 0, 'softBuildCfg': 0, 'softVersion': {'minor': 3, 'middle': 1, 'major': 0}, 'hardRev': 0, 'protocol': 'sinopcom'}, 'location$id': 44888, 'parentDevice$id': 250543, 'group$id': 154744, 'orderIdx': 0, 'sku': 'VA4220ZB', 'vendor': 'Sinopé', 'url_en': None, 'url_fr': None} 2022-12-30 16:28:42.189 DEBUG (MainThread) [custom_components.neviweb130.sensor] Setting up neviweb130 sensor GT130: {'id': 250543, 'identifier': '588e81fffe95eb92', 'name': 'GT130', 'family': 'GT130', 'signature': {'model': 130, 'modelCfg': 1, 'softBuildCfg': 0, 'softVersion': {'major': 2, 'middle': 3, 'minor': 0}, 'hardRev': 3, 'protocol': 'sinopcom'}, 'location$id': 44888, 'parentDevice$id': None, 'group$id': 154744, 'orderIdx': 0, 'sku': 'GT130', 'vendor': 'Sinopé', 'url_en': 'https://www.sinopetech.com/produit/passerelle-zigbee/', 'url_fr': 'https://www.sinopetech.com/en/product/gateway-zigbee/'} 2022-12-30 16:28:42.189 DEBUG (MainThread) [custom_components.neviweb130.sensor] Setting up neviweb130 sensor WL4200: {'id': 359454, 'identifier': '588e81fffe95eb92-500b914000040016', 'name': 'WL4200', 'family': '5051', 'signature': {'model': 5051, 'modelCfg': 0, 'softBuildCfg': 0, 'softVersion': {'minor': 3, 'middle': 1, 'major': 1}, 'hardRev': 0, 'protocol': 'sinopcom'}, 'location$id': 44888, 'parentDevice$id': 250543, 'group$id': 154744, 'orderIdx': 0, 'sku': 'WL4200S', 'vendor': 'Sinopé', 'url_en': None, 'url_fr': None} 2022-12-30 16:28:42.189 DEBUG (MainThread) [custom_components.neviweb130.sensor] Setting up neviweb130 sensor WL4200S: {'id': 359751, 'identifier': '588e81fffe95eb92-500b914000037ff0', 'name': 'WL4200S', 'family': '5051', 'signature': {'model': 5051, 'modelCfg': 1, 'softBuildCfg': 0, 'softVersion': {'minor': 3, 'middle': 2, 'major': 1}, 'hardRev': 0, 'protocol': 'sinopcom'}, 'location$id': 44888, 'parentDevice$id': 250543, 'group$id': 155060, 'orderIdx': 0, 'sku': 'WL4200S', 'vendor': 'Sinopé', 'url_en': None, 'url_fr': None} 2022-12-30 16:28:42.800 DEBUG (SyncWorker_5) [custom_components.neviweb130] Received devices status: {'status': 'online'} 2022-12-30 16:28:42.800 DEBUG (SyncWorker_5) [custom_components.neviweb130.sensor] Updating neviweb130 sensor GT130 (0.147 sec): {'status': 'online'} 2022-12-30 16:28:43.383 DEBUG (SyncWorker_8) [custom_components.neviweb130] Received devices alert: {'alertLowBatt': 1} 2022-12-30 16:28:43.383 DEBUG (SyncWorker_8) [custom_components.neviweb130.switch] Updating alert for neviweb130 switch VA4220ZB (0.612 sec): {'alertLowBatt': 1} 2022-12-30 16:28:43.383 DEBUG (SyncWorker_8) [custom_components.neviweb130.switch] Updating neviweb130 switch VA4220ZB (0.612 sec): {'onOff': 'on', 'batteryVoltage': 6.3, 'batteryStatus': 'ok', 'rssi': -30} 2022-12-30 16:28:43.402 WARNING (MainThread) [slixmpp.stringprep] Using slower stringprep, consider compiling the faster cython/libidn one. 2022-12-30 16:28:43.915 ERROR (MainThread) [homeassistant.components.switch] neviweb130: Error on device update!

config1 config2

claudegel commented 1 year ago

Ok we will have to go into Neviweb dev consol. Which browser are you using ? firefox or chrome. To open the dev consol just push F12 on your keyboard when your in neviweb and then open you valve config. You should see in the consol a lot of line like this console chrome firefox console

claudegel commented 1 year ago

As your valve support the flow meter there are many new parameters that we need to add. Also neviweb report the flow level in the statistic which are normally used for the energy stat for other devices. This is probably the problem we are facing now.

patdemers commented 1 year ago

Sorry, I should have mentioned the flow valve at the beginning :-( Here is the response:

{"onOff":"on","batteryStatus":"ok","batteryVoltage":6.3,"waterLeakStatus":"ok","flowMeterMeasurementConfig":{"multiplier":4546,"offset":30600,"divisor":1}}

image

claudegel commented 1 year ago

Great I changed switch.py please test Sometimes Sinopé is changing the device model if some fonction are missing. Can you check if whenthere are no flow meter, the valve model change. (3153 with flow meter and 3151 ?? without flow meter) also I.ll need the attributes name for the folowing:

patdemers commented 1 year ago

Hi Claude, This is looking good :-) I can see (and control) the valve in HA now. Doesn't look like the model is changing with or without the flow meter.

Those are the attributes with the flow meter:

{"signature":{"model":3153,"modelCfg":0,"softBuildCfg":0,"softVersion":{"minor":3,"middle":1,"major":0},"hardRev":0,"protocol":"sinopcom"},"rssi":-34,"flowMeterMeasurementConfig":{"multiplier":4546,"offset":30600,"divisor":1},"flowMeterAlarmDisableTimer":0,"alarm1FlowThreshold":1,"alarm1Length":60,"alarm1Period":3600,"alarm1Options":{"triggerAlarm":true,"closeValve":true}}

And those are without:

{"signature":{"model":3153,"modelCfg":0,"softBuildCfg":0,"softVersion":{"minor":3,"middle":1,"major":0},"hardRev":0,"protocol":"sinopcom"},"rssi":-34,"flowMeterMeasurementConfig":{"multiplier":0,"offset":0,"divisor":1},"flowMeterAlarmDisableTimer":0,"alarm1FlowThreshold":1,"alarm1Length":60,"alarm1Period":3600,"alarm1Options":{"triggerAlarm":true,"closeValve":true}}

claudegel commented 1 year ago

Good, I'll be able to add the missing attributes. Could you try to change flow meter type and send me what is passed to neviweb

patdemers commented 1 year ago

Sure, If I change the Flow meter to the 1 inch model (FS4221)

{"signature":{"model":3153,"modelCfg":0,"softBuildCfg":0,"softVersion":{"minor":3,"middle":1,"major":0},"hardRev":0,"protocol":"sinopcom"},"rssi":-34,"flowMeterMeasurementConfig":{"multiplier":9887,"offset":87372,"divisor":1},"flowMeterAlarmDisableTimer":0,"alarm1FlowThreshold":1,"alarm1Length":60,"alarm1Period":3600,"alarm1Options":{"triggerAlarm":true,"closeValve":true}}

image

{"signature":{"model":3153,"modelCfg":0,"softBuildCfg":0,"softVersion":{"minor":3,"middle":1,"major":0},"hardRev":0,"protocol":"sinopcom"},"rssi":-34,"flowMeterMeasurementConfig":{"multiplier":4546,"offset":30600,"divisor":1},"flowMeterAlarmDisableTimer":0,"alarm1FlowThreshold":0,"alarm1Length":0,"alarm1Period":3600,"alarm1Options":{"triggerAlarm":false,"closeValve":false}}

image

{"signature":{"model":3153,"modelCfg":0,"softBuildCfg":0,"softVersion":{"minor":3,"middle":1,"major":0},"hardRev":0,"protocol":"sinopcom"},"rssi":-33,"flowMeterMeasurementConfig":{"multiplier":4546,"offset":30600,"divisor":1},"flowMeterAlarmDisableTimer":0,"alarm1FlowThreshold":1,"alarm1Length":60,"alarm1Period":10800,"alarm1Options":{"triggerAlarm":true,"closeValve":true}}

Looks like nothing change if I change the value or Action en cas de piles faibles:

image

{"signature":{"model":3153,"modelCfg":0,"softBuildCfg":0,"softVersion":{"minor":3,"middle":1,"major":0},"hardRev":0,"protocol":"sinopcom"},"rssi":-34,"flowMeterMeasurementConfig":{"multiplier":4546,"offset":30600,"divisor":1},"flowMeterAlarmDisableTimer":0,"alarm1FlowThreshold":1,"alarm1Length":60,"alarm1Period":10800,"alarm1Options":{"triggerAlarm":true,"closeValve":true}}

patdemers commented 1 year ago

I forgot the image for the first log:

image

claudegel commented 1 year ago

That's good but what I need is a little more specific. When you change a parameter like Numero de model, in the consol you will see a line like this https://neviweb.com/api/device/258170/attribute (258170 is the valve id) open that line and check the request that is sent to Neviweb (requête) I'll need that for each parameter

claudegel commented 1 year ago

for piles faibles it is alertLowBatt': 1 or alertLowBatt': 0 in the console it is line like this https://neviweb.com/api/device/258170/alert

claudegel commented 1 year ago

attribute

patdemers commented 1 year ago

Those are the PUT Attribute and Alert:

image

Attribute {"flowMeterMeasurementConfig":{"multiplier":0,"offset":0,"divisor":1},"flowMeterEnabled":false} Alert {"alertLowBatt":0}

image

Attribute {"alertLowBatt":true} Alert {"alertLowBatt":1}

image

{"alarm1Options":{"triggerAlarm":false,"closeValve":false},"alarm1Length":0,"alarm1FlowThreshold":0,"flowMeterMeasurementConfig":{"multiplier":4546,"offset":30600,"divisor":1},"flowMeterEnabled":true}

image

{"alarm1Period":5400}

image

{"alarm1Options":{"triggerAlarm":true,"closeValve":true},"alarm1Length":60,"alarm1FlowThreshold":1}

image

{"alarm1Options":{"triggerAlarm":false,"closeValve":false},"alarm1Length":0,"alarm1FlowThreshold":0,"flowMeterMeasurementConfig":{"multiplier":9887,"offset":87372,"divisor":1},"flowMeterEnabled":true}

image

{"alarm1Options":{"triggerAlarm":true,"closeValve":true},"alarm1Length":60,"alarm1FlowThreshold":1}

And in "Action en cas de débit inhabituel" Only "Fermer la valve et envoyer une alerte et Aucune action" are working. Choosing "Envoyer une alerte seulement et Fermer la valve seulement" always put the config back to "Fermer la valve et envoyer une alerte"

image

patdemers commented 1 year ago

And for the "Durée du débit anormal avant alerte" you've got 15, 30, 45, 60, 75, 90, 3h, 6h, 12h, and 24h

{"alarm1Period":900} {"alarm1Period":1800} {"alarm1Period":2700} {"alarm1Period":3600} {"alarm1Period":4500} {"alarm1Period":5400} {"alarm1Period":10800} {"alarm1Period":21600} {"alarm1Period":43200} {"alarm1Period":86400}

image

If you need anything else, please let me know.

Thanks for your help :-)

claudegel commented 1 year ago

Ok thank you. I think I've enough to start working on services to set some attributes directly from HA. First I'll make a release to support your valve. Then I'll add some services. I'll let you lnow if I need to check anything else

claudegel commented 1 year ago

I've created version 1.9.6 and push a new release. this branch is merged into the master. I'll create a new branch VA4220ZB-services to add the services we need to set the valve parameters. I'll probably need some testing and I'll let you know. So, happy new year and thank you for all your help in supporting that valve.

patdemers commented 1 year ago

Hi Claude, The valve became unavailable with the 1.9.6

2022-12-31 13:09:47.527 DEBUG (SyncWorker_0) [custom_components.neviweb130.switch] Updating neviweb130 switch VA4220ZB (0.297 sec): {'onOff': 'on', 'batteryVoltage': 6.3, 'batteryStatus': 'ok', 'waterLeakStatus': 'ok', 'flowMeterMeasurementConfig': {'multiplier': 4546, 'offset': 30600, 'divisor': 1}} 2022-12-31 13:09:48.606 ERROR (MainThread) [homeassistant.components.switch] neviweb130: Error on device update!

It was working fine with that version of the switch.py

switch.py.txt

claudegel commented 1 year ago

do you have a message in your log about Updating alert for «your valve»

claudegel commented 1 year ago

I've open a new branch VA4220ZB-debug to fix that try switch.py

patdemers commented 1 year ago

yes I have the log for Updating alert:

2022-12-31 13:09:47.527 DEBUG (SyncWorker_0) [custom_components.neviweb130.switch] Updating alert for neviweb130 switch VA4220ZB (0.297 sec): {'alertLowBatt': 1} 2022-12-31 13:09:47.527 DEBUG (SyncWorker_0) [custom_components.neviweb130.switch] Updating neviweb130 switch VA4220ZB (0.297 sec): {'onOff': 'on', 'batteryVoltage': 6.3, 'batteryStatus': 'ok', 'waterLeakStatus': 'ok', 'flowMeterMeasurementConfig': {'multiplier': 4546, 'offset': 30600, 'divisor': 1}} 2022-12-31 13:09:48.606 ERROR (MainThread) [homeassistant.components.switch] neviweb130: Error on device update!

patdemers commented 1 year ago

It's working with the switch.py in the new branch :-)

claudegel commented 1 year ago

Ok I've remove the alertLowTemp because there are none for your valve. That was the problem. I'll push another release in case other need this for the VA4220ZB

claudegel commented 1 year ago

version 1.9.7 is out Thank you for pointing this error

patdemers commented 1 year ago

It's working now :-)

Thanks for all your help Claude. Happy New Year.

Do you have a Paypal.me or a Buy me a coffee link or something?

claudegel commented 1 year ago

Yes I have a paypal account on my website phyto.qc.ca. I don't know if it work outside of the website but this is it: https://www.paypal.me/phytoressources?utm_source=unp&utm_medium=email&utm_campaign=PPC000628&utm_unptid=3b202a84-d120-11e9-a328-441ea14ea960&ppid=PPC000628&cnac=CA&rsta=fr_CA&cust=MCZB33C6E2SUJ&unptid=3b202a84-d120-11e9-a328-441ea14ea960&calc=63e7621dc26ce&unp_tpcid=ppme-social-user-profile-created&page=main:email:PPC000628:::&pgrp=main:email&e=cl&mchn=em&s=ci&mail=sys

patdemers commented 1 year ago

Thanks for everything.

If you want me to test other things, just ask

claudegel commented 1 year ago

Thank you for the coffee :) I<ll let you know when valve services will be ready for testing

claudegel commented 1 year ago

I've set a new branch https://github.com/claudegel/sinope-130/tree/VA4220ZB-services I've added three new services for the VA4220ZB to set flow meter model set flow meter delay and set flow meter options If you want to test you will need to load all files as there are changes in init.py, const.py, services.yaml, switch.py Let me know if you have time to test Thank you

patdemers commented 1 year ago

Hi Claude, I just tested the new version, I tried to change the value of alarm1Period to 45 min.

image

And I get an Unknown error from the Browser:

image

This is what I found in the log;

File "/config/custom_components/neviweb130/switch.py", line 449, in set_flow_meter_delay_service switch.set_flow_meter_delay(value) File "/config/custom_components/neviweb130/switch.py", line 1265, in set_flow_meter_delay delay = [v for k, v in HA_TO_NEVIWEB_DELAY.items() if k == val][0] IndexError: list index out of range

claudegel commented 1 year ago

I've fix many bugs. the two other services look ok but I can't test completely as I don't have a flow meter. I still have to find out the list index out of range error. I've done changes in init.py, switch.py and services.yaml

patdemers commented 1 year ago

Hi Claude, The good news is that the set_flow_meter_options is working.

for the set_flow_meter_model, the result is the same. The command is being accepted, but all the options are giving the same result: "Aucun capteur de débit" Even if there is one selected already. If use: set to FS4220, or FS4221 or No flow meter as a FlowModel, the result became: "Aucun capteur de débit"

for the set_flow_meter_delay, it's still doesn't work The command is giving an Unknown error. Home-assistant.log: 2023-01-11 20:47:57.062 DEBUG (SyncWorker_0) [custom_components.neviweb130] Received devices alert: {'alertLowBatt': 1} 2023-01-11 20:47:57.062 DEBUG (SyncWorker_0) [custom_components.neviweb130.switch] Updating alert for neviweb130 switch VA4220ZB (0.665 sec): {'alertLowBatt': 1} 2023-01-11 20:47:57.062 DEBUG (SyncWorker_0) [custom_components.neviweb130.switch] Updating neviweb130 switch VA4220ZB (0.665 sec): {'onOff': 'off', 'batteryVoltage': 6.2, 'batteryStatus': 'ok', 'waterLeakStatus': 'ok', 'flowMeterMeasurementConfig': {'multiplier': 4546, 'offset': 30600, 'divisor': 1}, 'flowMeterAlarmDisableTimer': 0, 'alarm1FlowThreshold': 1, 'alarm1Period': 2700, 'alarm1Length': 60, 'alarm1Options': {'triggerAlarm': True, 'closeValve': True}} 2023-01-11 20:48:09.465 ERROR (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Error executing script. Unexpected error for call_service at pos 1: list index out of range

claudegel commented 1 year ago

I'm still working to debug the set_flow_meter_delay, I've a strange bug but I'll find it. For set_flow_meter_model it look like I need to pass another parameter and this need to be fix. I'll check in Neviweb debug console to find how the other parameter is passed

claudegel commented 1 year ago

I've found my bug for the delay services and also the other services. changes in services.yaml and switch.py

Please test, thank you

patdemers commented 1 year ago

Hi Claude, This is working great now. Perfect for the flow_meter_delay and the flow_meter_model

For the flow_meter_options, the is four options available. Aucune action Fermer la valve seulement Envoyer une alerte seulement Fermer la valve et envoyer une alerte

This is buggy, even with the Neviweb interface. With Neviweb

image

As you can see, even with the native Neviweb, there is only two output.

With HA and your flow meter options service:

image

I did double check with Neviweb and when I choose "Envoyer une alerte seulement" that attribute is being passed: {"alarm1Options":{"triggerAlarm":true,"closeValve":true},"alarm1Length":60,"alarm1FlowThreshold":1}

So there's a little bug on their side. With Neviweb even with four choices, it's either: {"triggerAlarm":true,"closeValve":true} or {"triggerAlarm":false,"closeValve":false}

claudegel commented 1 year ago

Ok thank you for testing this. For meter options we will have to wait for Sinope to fix this on there side and after it should work on HA side. So if it is working I think I can push a new release as I did fix a lot of other small bugs in this branch. Is it ok for you ?

patdemers commented 1 year ago

Of course, Great job Claude, Thanks for all your help and support in that branch. I would have no Sinope devices if it wasn't for your development on this integration ;-)

Sincerely.

claudegel commented 1 year ago

I've push a new release 1.9.8 Thank you for your help