Closed victordz closed 3 years ago
Same here, with accent:
Seems to be the same with Scandinavian letters, ä, ö, å. Did you find a way to fix it with the above function?
The current approach is rather simple purely using an asci character set. Implementing a more modern and hence more forgiving character set is in the plan.
@chatainsim Hi dtgbot has not crashed in your case, it is saying the command does not exist. Please could you give me more detail as to how you thought a command entrée should exist. @odelma I assume dtgbot has not crashed for you, but you can not use Scandinavian letters in devices etc. and @victordz function would make many Scandinavian words the same.
Currently dtgbot does not handle devices with non-ASCI characters correctly, as it removes the characters but it does not crash (for me). I do not want to solve one issue if there is another related issues I miss or if I create another. Currently in order to make dtgbot forgiving about capitalisation, it is ignored, as I am expecting most use to be on a smartphone. I don't believe I can treat accented / special language characters in the same way as ä needs to be different from å, in a way that currently A is not different from a in dtgbot.
@steps39 It was a one time error. Entrée is the name of one of my room and no crash, yes.
@odelma I assume dtgbot has not crashed for you, but you can not use Scandinavian letters in devices etc. and @victordz function would make many Scandinavian words the same.
@steps39 - correct, no crash. Actually, the scandis do not usually ”mix and match”. E.g. Keittö is kitchen but keittiö or keittiå do not mean anything. And keittio neither. So if it could command a device named keittiö in Domoticz by replacing ö with o (=keittio) I don’t think there actually would be any confusions between words.
Hi, was wondering if anyone has solved this? It seems I can not get rid of scandis...😄
Hi, was wondering if anyone has solved this? It seems I can not get rid of scandis...
Hi, I have a fix it is stable for me. I need to just get myself reconnected to github, so it will not break the git. I will add it in the next 48 hours.
Excellent! 🙂
Hi, was wondering if anyone has solved this? It seems I can not get rid of scandis...
Hi, I have a fix it is stable for me. I need to just get myself reconnected to github, so it will not break the git. I will add it in the next 48 hours.
I have a fix tested for both DTGBOT and DTGMENU too, so will see what you have done and merge that into the DTGMENU versions.
Hi, was wondering if anyone has solved this? It seems I can not get rid of scandis...
Hi, I have a fix it is stable for me. I need to just get myself reconnected to github, so it will not break the git. I will add it in the next 48 hours.
I have a fix tested for both DTGBOT and DTGMENU too, so will see what you have done and merge that into the DTGMENU versions.
With the latest commit DTGBOT should now be ok with non-asci characters.
Thank you! I tested with trying to turn on a device with letter ä in its name. After sending the "On" command it still got stuck. In the errors log I can see:
/usr/bin/lua5.2: /home/pi/dtgbot/dtg_domoticz.lua:324: attempt to index field '?' (a nil value) stack traceback: /home/pi/dtgbot/dtg_domoticz.lua:324: in function 'sSwitchName' /home/pi/dtgbot/lua/dtgmenu.lua:1080: in function 'handler' /home/pi/dtgbot/dtgbot.lua:309: in function 'HandleCommand' /home/pi/dtgbot/dtgbot.lua:494: in function 'on_msg_receive' /home/pi/dtgbot/dtgbot.lua:651: in main chunk [C]: in ?
That is because the fix by @steps39 is only for the commandline commands and not for DTGMENU. I have just made the same fix to DTGMENU.lua so hope it will also work for you now.
Hmm, this is quite strange. Now I get stuck in sending commands to any device (ok, after last change I did not test that, but now I did). Error refers to bit different lines:
/usr/bin/lua5.2: /home/pi/dtgbot/dtg_domoticz.lua:324: attempt to index field '?' (a nil value) stack traceback: /home/pi/dtgbot/dtg_domoticz.lua:324: in function 'sSwitchName' /home/pi/dtgbot/lua/dtgmenu.lua:1082: in function 'handler' /home/pi/dtgbot/dtgbot.lua:309: in function 'HandleCommand' /home/pi/dtgbot/dtgbot.lua:494: in function 'on_msg_receive' /home/pi/dtgbot/dtgbot.lua:651: in main chunk [C]: in ?
But probably because of the latest commit. It seems it is not getting the DeviceName back.
2020-11-19 23:14:50 - dtgbot: dtgmenu ended and text send ...return:200 2020-11-19 23:14:50 - Succesfully handled incoming request .2020-11-19 23:14:56 - WhiteList: 2020-11-19 23:14:56 - WhiteList: 2020-11-19 23:14:56 - Handle command function started with TV_taustavalo - 75 % and Group: msg_type: 2020-11-19 23:14:56 - dtgbot: Start DTGMENU ... (1) TV_taustavalo - 75 % 2020-11-19 23:14:56 - ==> menu.lua process:TV_taustavalo - 75 % 2020-11-19 23:14:56 - -< replymarkup:{"keyboard":[["Off","On","25%","50%","75%","99%","?"],["*Sisävalot","ATV","Erkkerin_valot - Off"],["Media - On","Musiikki_yleisettilat - Off","Olohuone - 23.3°C - 43%"],["PIR","Ruokailualueen_valomäärä","Ruokapöydän_valaisin - Off"],["Smart_TV","SqueezeBox","TV-seinän_spottivalot - Off"],["TV-seinän_valo - Off","TV_taustavalo - 75 %","Takan_valot - On"],["Takka - 31°C","en_ikkunavalot - Off","en_kaappivalot - Off"],["en_kattovalo - Off","en_tauluvalot - Off","en_valomäärä"],["menu"]],"selective":true,"resize_keyboard":true} 2020-11-19 23:14:56 - ==< Show device options menu plus other devices in submenu. 2020-11-19 23:14:56 - Message sent (1) 200 2020-11-19 23:14:56 - dtgbot: dtgmenu ended and text send ...return:200 2020-11-19 23:14:56 - Succesfully handled incoming request .2020-11-19 23:14:59 - WhiteList: 2020-11-19 23:14:59 - WhiteList: 2020-11-19 23:14:59 - Handle command function started with 50% and Group: msg_type: 2020-11-19 23:14:59 - dtgbot: Start DTGMENU ... (1) 50% 2020-11-19 23:14:59 - ==> menu.lua process:50%
(removed whitelists and group)
Could you do me a favor so I can see what exactly is happening?:
Jos
Certainly. Or is it ok to just paste here? I hope I removed anything too personal but kept the info that is needed. Let me know if not 😃
Log:
Strange, so the switch actually does switch but then it reports a nil issue. You do have the language tables in your user config up-to-date? anyway, I have just pushed a change for dtg_domoticz.lua to do some extra checking for the variables on the line with the issue, so could you do the same again for me? ...and i really need the whole log as I also need to see the table initialization to see what is possibly missing. Maybe you can also provide the config files to me so I can double check those? Thanks Jos
Hmm, that might be it. I had not noticed it as I think it does not mention about that in the main wiki article. I checked the file and there were option nl and en ready, I enabled en. Now I do not even get the menu populated:
It stops there...
I again commented out the language and same thing, not getting the menu anymore.
Well, then I run another command which was custom created and working yesterday. That worked and also the menu appeared right after this command was processed. Seems like it was some temporary glitch. I then tested the same switch I was testing in my previous message and now it works as well. And yes, the language is still commented out. In any case, it seems to work now. A few log lines from the last commands (if it tells anything about the reason in the background):
So it works now.. and I am pretty sure there is a glitch with the language settings, but as you didn't provide what I asked, it will be hard for me to determine the exact issue. ;-)
...and i really need the whole log as I also need to see the table initialization to see what is possibly missing. Maybe you can also provide the config files to me so I can double check those?**
Yes, true, sorry about that. Got a bit carried away when it started working 😄 I think I have not touched the .cfg files if you mean those. 0nly /etc/profile.d/DomoticzData.sh as mentioned in the main wiki page. I definitely need to look closer as I see there are more links defining what can be done and what should be updated. Would you still want the full log? I can create it again or maybe it is not useful anymore now that it works? I have still this from the old log, but I guess this is missing the start as well. This starts from where I run the custom command "lampo" and suddenly after that it starts to work again:
Btw, is there some specific reason that if I .e.g have "Bedroom ceiling lamp" in "Bedroom" the menu shows just "ceiling lamp" after selecting the room? Well ok, it is making things tighter by not repeating what is already known. However, in my case the room in "Makuuhuone" and device is "Makuuhuoneen kattolamppu". This becomes en_kattolamppu which is a bit funny. Can I force dtgbot to repeat the full name somehow?
Thanks a lot for this great add-on for Domoticz and the support, really appreciate it 👍
Yes, true, sorry about that. Got a bit carried away when it started working 😄 I think I have not touched the .cfg files if you mean those. 0nly /etc/profile.d/DomoticzData.sh as mentioned in the main wiki page. I definitely need to look closer as I see there are more links defining what can be done and what should be updated. Would you still want the full log? I can create it again or maybe it is not useful anymore now that it works? I have still this from the old log, but I guess this is missing the start as well. This starts from where I run the custom command "lampo" and suddenly after that it starts to work again:
Come on... please don't just dump those logfiles here anymore as this message thread has become totally unreadable for everybody. It can't be that hard to simply email them to me. (I've added a codebox (<>) around your log dump to make it all a little clearer) I am fine when you are happy but I am telling you there is something not correct with your setup, likely the config file containing the translation tables. The code change is just so it doesn't crash anymore when something is wrong with that specific keyword. I am now working on a more permanent "fix" which will ensure things don't crash anymore when language tables are incorrect or missing.
Thanks a lot for this great add-on for Domoticz and the support, really appreciate it 👍
You're welcome. :-)
@jvanderzande thanks for adding in some more checks to help with stability.
Come on... please don't just dump those logfiles here anymore as this message thread has become totally unreadable for everybody. It can't be that hard to simply email them to me. (I've added a codebox (<>) around your log dump to make it all a little clearer)
@odelma I have added edited your reply with collapsible sections for your logs, so makes thread still readable, but contains your logs as well.
You can do this with markdown:
<details><summary>Click` arrow to see / hide log</summary>
Here is your log
</details>
Produces:
Come on... please don't just dump those logfiles here anymore as this message thread has become totally unreadable for everybody. It can't be that hard to simply email them to me. (I've added a codebox (<>) around your log dump to make it all a little clearer)
Yes, you are correct, sorry, will try to behave...👍
I am fine when you are happy but I am telling you there is something not correct with your setup, likely the config file containing the translation tables. The code change is just so it doesn't crash anymore when something is wrong with that specific keyword.
As said, I had not touched those config files (.cfg). So for example the "language" line was commented out. I now added "fi" as a language and it is working still so I guess nothing major should be wrong there. I think I first installed dtgbot around 2017 so it was working fine for quite some time. One of the recent changes changed also that. Let me know if you still want to see the config files and I'll email those to you...
If a device has a name with special characters like accents or "ñ" in Spain, dtgbot chrases.
I have found this lua function:
Click arrow to see / hide function
``` function stripChars(str) local tableAccents = {} tableAccents["à"] = "a" tableAccents["á"] = "a" tableAccents["â"] = "a" tableAccents["ã"] = "a" tableAccents["ä"] = "a" tableAccents["ç"] = "c" tableAccents["è"] = "e" tableAccents["é"] = "e" tableAccents["ê"] = "e" tableAccents["ë"] = "e" tableAccents["ì"] = "i" tableAccents["í"] = "i" tableAccents["î"] = "i" tableAccents["ï"] = "i" tableAccents["ñ"] = "n" tableAccents["ò"] = "o" tableAccents["ó"] = "o" tableAccents["ô"] = "o" tableAccents["õ"] = "o" tableAccents["ö"] = "o" tableAccents["ù"] = "u" tableAccents["ú"] = "u" tableAccents["û"] = "u" tableAccents["ü"] = "u" tableAccents["ý"] = "y" tableAccents["ÿ"] = "y" tableAccents["À"] = "A" tableAccents["Á"] = "A" tableAccents["Â"] = "A" tableAccents["Ã"] = "A" tableAccents["Ä"] = "A" tableAccents["Ç"] = "C" tableAccents["È"] = "E" tableAccents["É"] = "E" tableAccents["Ê"] = "E" tableAccents["Ë"] = "E" tableAccents["Ì"] = "I" tableAccents["Í"] = "I" tableAccents["Î"] = "I" tableAccents["Ï"] = "I" tableAccents["Ñ"] = "N" tableAccents["Ò"] = "O" tableAccents["Ó"] = "O" tableAccents["Ô"] = "O" tableAccents["Õ"] = "O" tableAccents["Ö"] = "O" tableAccents["Ù"] = "U" tableAccents["Ú"] = "U" tableAccents["Û"] = "U" tableAccents["Ü"] = "U" tableAccents["Ý"] = "Y" tableAccents["/"] = "_" tableAccents["\\"] = "_" tableAccents["*"] = "_" tableAccents["&"] = "_" tableAccents[":"] = "_" tableAccents[";"] = "_" tableAccents["!"] = "_" tableAccents["@"] = "at" local normalizedString = str:gsub("[%z\1-\127\194-\244][\128-\191]*", tableAccents) return normalizedString end ```