Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


  • 0

LUA. Telegram. Change HC2 to HC3. Where am I going wrong?


Fabio
 Share

Question

Obs: Sorry for possible errors ... I used the google translator.

 

Hello.

 

I migrated from HC2 to HC3. At HC2 I had a generic scene that was called by several others to send me a message on the telegram.

 

Example: Someone touched the campaign, I received a message on Telegram: "The campaign has been activated". The door was opened, I received a message "the door was opened".

 

It used a global variable in which the main scene determined the variable telegram and, after that, the generic scene that sent the message to the telegram was called.

 

However, with HC3, this scene stopped working.

 

I made some changes to the LUA code, but I can't get the message on the telegram.


Example changes: I changed "fibaro: getGlobalValue (" Telegram ")" to "fibaro.getGlobalVariable (" Telegram ")"

 

The error message I get is:

 

[DEBUG] [SCENE54]: 400
[DEBUG] [SCENE54]: {"ok": false, "error_code": 400, "description": "Bad Request: message text is empty"}

 

I put one more message in this code to see the value of the variable Telegram and url, and both are not reset.

 

fibaro.debug("URL é", url)
fibaro.debug("MSG é", msg)

 

From the commands above I can verify that the variables are with the values I want.

 

Please, could someone guide me where I was missing the LUA code below? Thank you.

------------------------------------------------------------------------------------------------------------------------------------------------------------

Please login or register to see this code.

 

Link to comment
Share on other sites

14 answers to this question

Recommended Posts

  • 1

so. as I haven't any plans to publich this QA - QA prrovided as-is :)

 

Please login or register to see this code.

 

how to send message

 

Please login or register to see this code.

image.png.89be879b3beb943bdf02bcf135834c69.png

 

 

 

send pic from url.

for example 

Please login or register to see this link.

 

(c) Fibaro

 

 

Please login or register to see this code.

image.png.6542a793022460ff0921590f9f3ea3c5.png

  • Like 1
Link to comment
Share on other sites

  • 0

You do not need that’s at all

no global etc 

just ping me for 2h 

I’ll provide here QA for sending messages and pictures via telegram 

  • Like 1
Link to comment
Share on other sites

  • 0

good Morning

I would be interested in that too!
Would you be so nice and would you send that to me too?
I've only created one variant with PushOver.
If you are interested I will take the post.
However, this can only be used to send texts.

Greetings Frank

Link to comment
Share on other sites

  • 0
  • Inquirer
  • Hello ....@10der and @FBerges , initially, I apologize for any errors in the writing. I used the google translator.

     

    @10der ,  your code is Fantastic!!! Thanks for your suggestions and the code.

     

    I made the adaptation to mine and it worked perfectly.

     

    This will solve my "emergency" so as not to miss my apartment's security messages (door open, etc.), however, with its complete code, I will make some changes over time to implement it in order to increase productivity HC3.

     

    Thanks again.

     

    @FBerges , this code suggested by @10der worked perfectly....

     

    If you still have any difficulties, please post here what it would be. I don't understand much, almost nothing in fact, but we can look together or another colleague can help.

     

    Hugs

    • Thanks 1
    Link to comment
    Share on other sites

    • 0
    On 10/1/2020 at 3:04 AM, 10der said:

    so. as I haven't any plans to publich this QA - QA prrovided as-is :)

     

    Please login or register to see this code.

     

    how to send message

     

    Please login or register to see this code.

    Please login or register to see this link.

     

     

     

    send pic from url.

    for example 

    Please login or register to see this link.

     

    (c) Fibaro

     

     

    Please login or register to see this code.

    Please login or register to see this link.

     
     
     

     

     

    salut 

     

    à quoi correspond  :   1818    et    11111111

    what is  :  :   1818    et    11111111

     

    Please login or register to see this code.

     

    et dans ton code je voie BOT-KEY mai je ne vois pas le chat_id

    and in your code I see   BOT-KEY     may i don't see the     chat_id  

     

     

     

    Edited by 971jmd
    Link to comment
    Share on other sites

    • 0

    J'ai trouvé 

    I found

     

    fibaro . call ( 1818 , "sendMessage" , "Hello HC3" , 11111111 ) 

     

    1818  =  ID  Quick App

    et 

    11111111 =   chat_id

     

    merci 

    thank you ?

     

    • Thanks 1
    Link to comment
    Share on other sites

    • 0

    Pour l'envoie de l'image j'ai une erreur.


    To send the image I have an error.

     

    Please login or register to see this code.

     

     

     

    Link to comment
    Share on other sites

    • 0
    5 hours ago, 971jmd said:

    Pour l'envoie de l'image j'ai une erreur.


    To send the image I have an error.

     

    Please login or register to see this code.

     

     

     

    Please login or register to see this code.

    scena

    • Like 1
    Link to comment
    Share on other sites

    • 0

    @10der. Thanks for this Telegram QA, excellent job done!!

    Is it possible to add the chat id in the code somewhere so in the message it will  "hide" the chat-id?

    Thanks in advance,

    //Sjakie

    Link to comment
    Share on other sites

    • 0
    On 10/1/2020 at 4:25 AM, 10der said:

    You do not need that’s at all

    no global etc 

    just ping me for 2h 

    I’ll provide here QA for sending messages and pictures via telegram 

    Hi,

     

    Just wondering if the QA file is available for Telegram in Fibaro.

     

    Thanks

    Link to comment
    Share on other sites

    • 0

     

    1 hour ago, AlecPickles said:

    QA file is available for Telegram in Fibaro.

    asking Fibaro :)

    Link to comment
    Share on other sites

    • 0
    On 2/26/2021 at 9:21 AM, Sjakie said:

    Is it possible to add the chat id in the code somewhere so in the message it will  "hide" the chat-id?

    nice idea. via vars. ok wil do

    Link to comment
    Share on other sites

    • 0
    On 10/5/2020 at 8:51 AM, 10der said:

    Please login or register to see this code.

    scena

    Just want to understand.. can this solution be used for controlling HC3 devices outside the HC3 LAN ? As a solution for this 

    ?

     

    Link to comment
    Share on other sites

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Answer this question...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.

     Share

    ×
    ×
    • Create New...