MarcusRoeckrath / fbtr64toolbox

Command line tool (bash script) for the TR-064 interface of fritzboxes
GNU General Public License v2.0
37 stars 4 forks source link

grep for ain in function homeautoswitch not ok #6

Closed h6e6l6l closed 10 months ago

h6e6l6l commented 10 months ago

Hello Marcus,

grep for an AIN in function homeautoswitch is not OK. I'm using latest version of fbtr64toolbox.sh. I'm using Kubuntu 23.10 and Ubuntu Server 22,04 LTS to run something like this fbtr64toolbox.sh homeautoswitch "08761 0404911" --active --experimental [command to turn on a Fritz.Dect 200 device] command in line 1919 of fbtr64toolbox.sh will produce an error from grep, in a german system as: grep: Das Ende des angegebenen Intervalls ist nicht gültig this will result in fbtr64toolbox.sh telling that I did not provide an AIN at all :-(

This error occurs due to order of the regexed chars you want to allow.

Correct grep at end of line 1919 is like this: grep -Eq "^[ :0-9a-xA-X-]+$" blank and : before numbers, small chars, uppercase Chars then -.

Another small typo happened in line 1666 of your script in help/usage output: --actice should be --active ;-)

And yes, fbtr64toolbox.sh is great!

Is it possible to discuss, why you do not want to accept AIN with Z? All my Zigbee things AINs start with Z, even if I change fbtr64toolbox.sh to allow AIN with Z, fritz.box does not like this. Only a group build out of Ikea Tädfri LED is able to be switched on & off with a command, but naturally that group does not contain z or Z: fbtr64toolbox.sh homeautoswitch "grp6DFE41-3F40FBBCB" --active --experimental after I repaired line 1919 as above.

Best regards Jens

MarcusRoeckrath commented 10 months ago

Hi Jens,

Am Mittwoch, 6. Dezember 2023 21:04 schrieb h6e6l6l:

Thanks for your coments and suggestions.

grep for an AIN in function homeautoswitch is not OK. Correct grep of line 1919 is like this: grep -Eq "^[ :0-9a-xA-X-]+$" blank and : before numbers, small chars, uppercase Chars then -.

You are right, I don't have any home automation device so that I never called this function.

I do not remeber why I restricted it to X (x) as last character of the alphabet; maybe it was a typo long time ago.

The avm documentation https://avm.de/fileadmin/user_upload/Global/Service/Schnittstellen/x_homeauto.pdf says for this parameter "0123456789ABCDEFabcdef :-grptmp".

Do you know what is meaned by grptmp?

Another small typo happened in line 1666 of you script inhelp output: --actice should be --active ;-)

Thanks you very much.

And yes, fbtr64toolbox.sh is great!

Thanks for the flowers.

Is it possible to discuss, why you do not want to accept AIN with Z?

see above: I extended to a-zA-Z.

Please test new version is available on github.

Comments are welcome.

-- Gruß Marcus

h6e6l6l commented 10 months ago

Hi Marcus,

in home Automation AVM created templates aka Vorlagen; this one would receive an AIN like this

5:AIN : tmp6DFE41-3F6148E7E 5:Product name : Template 5:Device name : Rollo.Sonnenschutz

I never tried to run --active/--inactive on such a template.

Then there could be a group, AVM restricts members of a group to special devices. In my AVM hw collection it's possible to create a group out of Steckdosen und/oder LED-Lampen Heizkörperregler (text copied from fritz.box UI) I had created a group out of 5 Ikea Tädfri LED into "led.Wohnzimmer" that group's AIN is: 18:AIN : grp6DFE41-3F40FBBCB 18:Product name : Group 18:Device name : led.Wohnzimmer

That AIN works and switches Wohnzimmer-Deckenlampe.

I did not create a Szenario with my box and my smart Gateway.

All actors for my Rollläden are nexentros. I had contact with AVM before buying those and they said this would work with smart Gateway although they were not yet listed on compatibility list.

Yes, I did already change regex to allow anything as AIN, then running that towards the zigbee steckdose and then fritz.box does not react good: fbtr64toolbox.sh homeautoswitch "ZA4C138EF75654CFE" --active --experimental Switching home automation device ZA4C138EF75654CFE (FRITZ!Box 7590 Release 154.07.57@fritz.box) Error on communication with fritzbox I attached the debug information. all_homeAutomation_devices.txt debug_output_for_AIN_with_Z.txt

I attached a complete output of "fbtr64toolbox.sh homeautoinfo --searchhomeautodevicename" here.

Thanks, Jens

h6e6l6l commented 10 months ago

Hi Marcus, a template switching my zigbee steckdose fails, too. I think we need to talk with AVM.

Bye, Jens

MarcusRoeckrath commented 10 months ago

Hi Jens,

Am Donnerstag, 7. Dezember 2023 08:19 schrieb h6e6l6l:

in home Automation AVM created templates aka Vorlagen; this one would receive an AIN like this

5:AIN : tmp6DFE41-3F6148E7E 18:AIN : grp6DFE41-3F40FBBCB

Ok, I understand. grp and tmp are "full" words which the AIN could start with.

Yes, I did already change regex to allow anything as AIN, then running that towards the zigbee steckdose and then fritz.box does not react good: fbtr64toolbox.sh homeautoswitch "ZA4C138EF75654CFE" --active --experimental Switching home automation device ZA4C138EF75654CFE (FRITZ!Box 7590 Release @.***) Error on communication with fritzbox

I misunderstood your first post; It sounds to me that you have had success after allowing the Z character in the regexp.

I attached the debug information. debug_output_for_AIN_with_Z.txt

The fritzbox does not accept the AIN. Possibly we have to face that the documentation from avm I quoted is correct only allowing

0123456789ABCDEFabcdef :-grptmp

With your explanations from above the regexp should be

^(grp|tmp)?[ :0-9a-fA-F-]+$

so that numbers and chars build hex values.

I attached a complete output of "fbtr64toolbox.sh homeautoinfo --searchhomeautodevicename" here.

Have you forgotten to attach that file? I can't see one.

-- Gruß Marcus

MarcusRoeckrath commented 10 months ago

Hi Jens,

Am Donnerstag, 7. Dezember 2023 08:33 schrieb h6e6l6l:

a template switching my zigbee steckdose fails, too. I think we need to talk with AVM.

I have reported some bugs and errors to avm but very rare I got sufficient answers.

Will you try to ask avm for support of zigbee devices allowing the char Z as part of the AIN?

-- Gruß Marcus

MarcusRoeckrath commented 10 months ago

Hi Jens,

Am Donnerstag, 7. Dezember 2023 08:19 schrieb h6e6l6l:

Yes, I did already change regex to allow anything as AIN, then running that towards the zigbee steckdose and then fritz.box does not react good: fbtr64toolbox.sh homeautoswitch "ZA4C138EF75654CFE" --active --experimental Switching home automation device ZA4C138EF75654CFE

Maybe it is a good idea, if the LUA Interface of fritzboxes is more tolerant on the ain value.

I found this project

https://www.mengelke.de/Projekte/FritzBox-Tools

you can give a try.

-- Gruß Marcus

h6e6l6l commented 10 months ago

Hello Marcus,

thanks for your advice, I knew about Mengelke already, I once used his website to make my box talk https on port 666 instead of 443, I do like numbers 666 and 777 ;-)

I installed his package and yes, it's switching Zigbee things!

hell@pi666:~$ fb_tools xxx:yyy@fritz.box smarthome aus ZA4C138EF75654CFE01 str.TV wurde aus geschaltet!

Thanks aus Ascheberg, Jens _

MarcusRoeckrath commented 10 months ago

Hi Jens,

Am Donnerstag, 7. Dezember 2023 18:49 schrieb h6e6l6l:

thanks for your advice, I knew about Mengelke already, I once used his website to make my box talk https on port 666 instead of 443, I do like numbers 666 and 777 ;-)

I installed his package and yes, it's switching Zigbee things!

@.:~$ fb_tools @. smarthome aus ZA4C138EF75654CFE01 str.TV wurde aus geschaltet!

AVM has to change their checkings of the AIN value in the TR64 functions on the fritzbox.

Because of the upcoming (enhanced) matter and zigbee support in 2024 reported by heise I assume that this possibly would be done on newer boxes and firmwares.

(https://www.heise.de/news/AVM-laessts-krachen-Fritzboxen-bekommen-Wi-Fi-7-Zigbee-und-Matter-7524241.htmlsupport)

-- Gruß Marcus

h6e6l6l commented 10 months ago

Hi Marcus,

thanks for the update plans of AVM. Here are all my devices, ZigBees do start with Z, all AVM Dect devices do match to ^(grp|tmp)?[ :0-9a-fA-F-]+$ Please merge that into next version of fbtr64toolbox.sh.

Bye, Jens

MarcusRoeckrath commented 10 months ago

Hi Jens,

Am Samstag, 9. Dezember 2023 11:31 schrieb h6e6l6l:

thanks for the update plans of AVM.

Thats not my plans because I'm not involved in AVM company and there decisions. It's a hope that AVM will do full support of TR64 interface in the future, but I'm not sure if it part of AVMs plans.

For example the TR64 devicelog submits only parts of the fritzbox log while the lua - use fb_tools from mengelke - prints out the full log like it could be seen on the webinterface.

Here are all my devices, ZigBees do start with Z, all AVM Dect devices do match to ^(grp|tmp)?[ :0-9a-fA-F-]+$ Please merge that into next version of fbtr64toolbox.sh.

What do yo mean exactly:

^(grp|tmp)?[ :0-9a-fA-F-]+$

because this is the way AVM seams to restrict to nowadays or including Z for possible upcoming full ZigBee support as reported by heise.

-- Gruß Marcus

h6e6l6l commented 10 months ago

Hi Marcus,

sorry to bother you again. I'm working with around 100 developers often forgetting to merge fixes into branches of products.

You just changed version/comments in .sh file, you changed usage and .txt file. grep in line 1919 of .sh file is still identical to grep in version 3.2.6

If someone else besides me wants to use fbtr64toolbox.sh it will still complain about nothing; if they're without smart Gateway and ZigBee devices. So never mind.

Command homeautoswitch is OK for an AVM Device ./fbtr64toolbox.sh homeautoswitch "08761 0404911" --active --experimental and for a group with an AIN like AVM told us ./fbtr64toolbox.sh homeautoswitch "grp6DFE41-3F40FBBCB" --inactive --experimental

I changed my version of fbtr64toolbox.sh to contain "^(grp|tmp)?[ :0-9a-fA-F-]+$" in line 1919, so that's clean, you can do a merge from trunk to release 3.2.x, that's what'll happen in my job.

Keep in mind, c`t did mention your project, that's why I'm here. If someone else asks for homeautoswitch support ... keep past few days in your memory or in a FAQ.

Thanks for all, Jens

MarcusRoeckrath commented 10 months ago

Hi,

Am Samstag, 9. Dezember 2023 12:44 schrieb h6e6l6l:

sorry to bother you again. I'm working with around 100 developers often forgetting to merge fixes into branches of products.

You just changed version/comments in .sh file, you changed usage and .txt file. grep in line 1919 of .sh file is still identical to grep in version 3.2.6

Are you sure?

in 3.2.6: ^[0-9a-xA-X:- ]+$ which gives an grep error

in 3.2.7: ^[ :0-9a-zA-Z-]+$ which you supposed as bug fix and allowing yYzZ also

I do not see that I have forgotten to release a changed line 1919.

I changed my version of fbtr64toolbox.sh to contain "^(grp|tmp)?[ :0-9a-fA-F-]+$" in line 1919

O,k that's what I am thinking about and I will change this into this regexp and this will fit AVMs check; if AVM will allow more characters in the future I can change this again.

-- Gruß Marcus

MarcusRoeckrath commented 10 months ago

Closed, can be reopened if AVM will make changes in their fritzbox firmwares.