nicolasberthel / hass-becker-component

Becker Cover custom component for Home Assistant
MIT License
11 stars 8 forks source link

support for multiple units #3

Open w0vka opened 4 years ago

w0vka commented 4 years ago

hi nicolas, first of all, very interesting project! Ole has now the support for multiple units to support more then 7 channels. Do you plan to support it too? or is it already possible?

thanks in advance

nicolasberthel commented 4 years ago

Hello @w0vka it should already be supported by the component, did you face some issue with this ? Nicolas

w0vka commented 4 years ago

Hi, sorry for the delayed answer. Yes i have tested it and received an error in the hass log. (see below) how should be the syntax for the channel looks like? You describe in the readme, that the channel has to be an integer. if i try it with channel "1" it works perfectly but my test with channel "1:1" throws following errors in the log, probably because it's not an int:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 178, in _async_setup_platform
    await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
    return fut.result()
  File "/config/custom_components/hass-becker-component/cover.py", line 95, in async_setup_platform
    PyBecker.becker, friendly_name, int(channel), state_template, entity_ids
ValueError: invalid literal for int() with base 10: '1:1'

thanks in advance

w0vka commented 4 years ago

hi nicolas, any updates on it?

nicolasberthel commented 4 years ago

Hi @w0vka I had some busy times, my last commit on cover.py should fix your problem, It was not a big stuff but I had to spot it :D Thank you for your feedback

w0vka commented 4 years ago

Hi @nicolasberthel,

thank you so much for your update. Now i'm able to define multiple units, but unfortunately only the first unit is working fine. The units 2-5 (1737c, 1737d, 1737e, 1737f) seems to be unknown and throw following error in the hass-logs:

Protokolldetails ( ERROR )
Logger: pybecker.becker
Source: custom_components/hass-becker-component/cover.py:157
First occurred: 11:39:47 (4 occurrences)
Last logged: 11:41:14

The unit 1737f is not configured
The unit 1737e is not configured
The unit 1737d is not configured
The unit 1737c is not configured

can it be that you still have to define them?

Many thanks

w0vka commented 3 years ago

Hi @nicolasberthel,

thank you so much for your update. Now i'm able to define multiple units, but unfortunately only the first unit is working fine. The units 2-5 (1737c, 1737d, 1737e, 1737f) seems to be unknown and throw following error in the hass-logs:

Protokolldetails ( ERROR )
Logger: pybecker.becker
Source: custom_components/hass-becker-component/cover.py:157
First occurred: 11:39:47 (4 occurrences)
Last logged: 11:41:14

The unit 1737f is not configured
The unit 1737e is not configured
The unit 1737d is not configured
The unit 1737c is not configured

can it be that you still have to define them?

Many thanks

Hi @nicolasberthel, what do you mean, is there any chance to get it working

best reagards

nullinger commented 3 years ago

Hi,

I’d also like to know how to configure additional units. Any news on this topic?

Thank you

nicolasberthel commented 3 years ago

Hello @w0vka, some updates.

I made a try on my side with this configuration

- platform: becker covers: test_cover: friendly_name: "Play Room" channel: "1:6"

And it work Could you try to call the service "becker.log_units" from development tools / services and check the logs ? you should see something like the following :

2021-02-15 14:07:53 INFO (MainThread) [custom_components.becker.rf_device] Configured Becker centronix units:
2021-02-15 14:07:53 INFO (MainThread) [custom_components.becker.rf_device] Unit id 1, unit code 1737b, increment 250

I know I already asked you but can you double check that in your custom component folder you have the following in manifest file

{ "domain": "becker", "name": "Becker", "documentation": "", "config_flow": true, "requirements": ["pybecker==1.0.5"], "dependencies": [], "codeowners": ["@nicolasberthel"] }

w0vka commented 3 years ago

Hi @nicolasberthel, thank you for your feedback.

as i mentioned it in the post from 9th of July, i'm now completely fine with the syntax and with the first unit. There's no problem at all with that unit. My problem is to configure the units 2-5.

When i configure the channel to e.g. 5:1 i receive this error: The unit 1737f is not configured

I have called the service "becker.log_units" but i don't receive any log entries.

that is my manifest file: { "domain": "becker", "name": "Becker", "documentation": "", "requirements": ["pybecker==1.0.5"], "dependencies": [], "codeowners": ["@nicolasberthel"] }

btw: i have now recreated the custom_component several times but unfortunately always with the same result

nicolasberthel commented 3 years ago

Strange you should get the logs;

can you make sure that you're not hiding some logs by setting the following in your home assistant configuration

` logger:

default: info `

w0vka commented 3 years ago

OK, thanks for your hint. now i have the log output:

2021-02-16 11:15:13 INFO (MainThread) [custom_components.hass-becker-component.rf_device] Configured Becker centronic units:
2021-02-16 11:15:13 INFO (MainThread) [custom_components.hass-becker-component.rf_device] Unit id 1, unit code 1737b, increment 71

I think it looks like what we expect, right? And this unit is working fine, but not the other ones. So, now the question arises how or where to configure the missing units:

The unit 1737f is not configured
The unit 1737e is not configured
The unit 1737d is not configured
The unit 1737c is not configured

thanks

NorbertBauer commented 3 years ago

Hi

I have the same problem, but when I use pybecker direct for example by the following commmand, the additional units work as expected: pybecker -a UP -c 2:1

when using the HA component, i get the error "ERROR (MainThread) [pybecker.becker] The unit 1737c is not configured"

any ideas?

thomaskonrad commented 3 years ago

The pybecker library keeps a local SQLite database with configured devices, because it needs to store a device-specific number that is incremented each time a command is sent to the shutter. From what I can see here, the device is only added to the database when the TRAIN command is sent to it. So sending the TRAIN command once from the command line on Home Assistant could do the trick.

I have not tested this myself yet, but I will (I face the same problem).

thomaskonrad commented 3 years ago

Here is the code that writes the The unit %s is not configured log line.

thomaskonrad commented 3 years ago

One more comment: The shutters won‘t react if the counter is out of sync. Sending HALT three times in a row (supposedly from an in-sync unit) will reset the counter in the shutter. It will accept any counter then.

NorbertBauer commented 3 years ago

Hi Thomas

I know the train command, that's why I already can open and close the shutter on the command line with pybecker, but it is not possible to use them in the HA component.

RainerStaude commented 2 years ago

I had the same isssues, but now it works fine. You can use Home Assistent Developer Tools - Services - Becker: pair to issue the Train command. This will add the unit to the SQL Database. Check the result using Becker: log_units to verify that the unit has added to the Database. Now send three commands from Home Assistent (e.g. press the stop button of your cover) to sync.

thomaskonrad commented 2 years ago

I didn't know about the service, thanks Rainer!

The only thing is, the SQLite database of the pybecker library is stored in the library folder, which I think is not mapped out of the Home Assistant Core Docker container. Therefore, it does not survive a reboot when running Home Assistant in Docker.

RainerStaude commented 2 years ago

I also run Home Assistant in Docker. I did a few changes to overcome this issue: copy the pybecker folder into the folder of your hass becker component in rf_device.py change the import to: from .pybecker.becker import Becker in manifest.json change "requirements" to: "requirements": [] Now after reboot the pybecker library should be no longer be installed. The Database file will be created in your pybecker folder within your hass becker component.

RainerStaude commented 2 years ago

Maybe your want to have a look at my updated implementation: hass-becker-component It should be compatible to @nicolasberthel implementation. I fixed the template issue. Added travel time to track the position of the cover. Added support to receive commands from your Becker Remote. The database will be stored in the config folder. All configured covers will be restored in case the database gets lost. See the readme file for more information. Also available on HACS ...