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

Whatsapp integration with fibaro


ethanmiles

Question

How can I integrate whats app with Fibaro HC2.

Please login or register to see this link.

.

 

I know that this post already exists. The answer given in this post on this forum is an absolute telegram question.

 

And I want to know, Can WhatsApp be integrated now?

Link to comment
Share on other sites

Recommended Posts

  • 0

There is a solution they use in HomeAssistant so it could work in HC2. I don’t have experience with the solution:


See:

Please login or register to see this link.

 

 

Link to comment
Share on other sites

  • 0

Yes,

go  to 

Please login or register to see this link.

and get an API key.

Then:

Please login or register to see this code.

You need one api key to each number you want to send to

Link to comment
Share on other sites

  • 0

jgab@, 

 

I'm receiving the message on my cell phone when I press the QA button, but these messages appear.....please, did I do something wrong?

below the way I did the QA.

Thanks.

 

Please login or register to see this attachment.

 

 

local function encode(url)
  if url == nil then
    return
  end
  url = url:gsub("\n""\r\n")
  url = url:gsub("([^%w _%%%-%.~])"function(c) return string.format("%%%02X", string.byte(c))  end)
  url = url:gsub(" ""+")
  return url
end
 
function QuickApp:sendMessage(number,apikey,message)
  local url = string.format("https://api.callmebot.com/whatsapp.php?phone=%s&text=%s&apikey=%s",
    number,encode(message),apikey)
  net.HTTPClient():request(url,{})
end
 
function QuickApp:onInit()
  self:debug(self.name, self.id)
 
end
-- BUTTON send msg 1
function QuickApp:uibuttonw1OnReleased(event)
self:sendMessage("+5511999999999",xxxxx,"Testing whatsapp Msg 1 Fibaro HC3!")
end
Link to comment
Share on other sites

  • 0

It's just your QA button that is wrong.  

You seem to call the button "Whatsapp 1" but your QuickApp function is named "uibuttonw1OnReleased"

Link to comment
Share on other sites

  • 0
5 minutes ago, jorge rintaro said:

jgab@,

ok, Could you please tell me where to fix it?

thanks

What version of HC3 FW are you using?

How have you configured the button in the QA UI? - id, label, onReleased?

 

My guess is that you should rename

-- BUTTON send msg 1
function QuickApp:uibuttonw1OnReleased(event)
self:sendMessage("+5511999999999",xxxxx,"Testing whatsapp Msg 1 Fibaro HC3!")
end
 
to
-- BUTTON send msg 1
function QuickApp:button1(event)
self:sendMessage("+5511999999999",xxxxx,"Testing whatsapp Msg 1 Fibaro HC3!")
end
Link to comment
Share on other sites

  • 0

 

jgab@,

HC3 v. 5.100.22

I thought of a QA where each button would call a whatsapp message.......I don't know if it's the best way to use Whatsapp as alert messages.....

Please login or register to see this image.

/monthly_2022_02/image.png.c94e19a2feef1d7c994b9ca4dbdc75c6.png" />

 

image.png.2c6f9c6d5159b59b3a07d84527a9ff00.png

Link to comment
Share on other sites

  • 0

If you have

function QuickApp:sendMessage(number,apikey,message)

defined in QA deviceID 318

you can do

Please login or register to see this code.

from other QAs or Lua scenes.

A QA with two buttons becomes pretty static with 2 predefined messages.

 

The onReleased field in the Button dialogue should be the name of the QuickApp method to call, ex. "button1" will call QuickApp:button1

If you have 2 buttons you need two methods, ex. button1 and button2

Edited by jgab
Link to comment
Share on other sites

  • 0

jgab@,

 

thank you very much for the tips..... I made the adjustments now the message (TRACE) appears in the debug panel ......???

I'm studying now QA, a lot to learn yet.....sorry!

 

Please login or register to see this attachment.

Link to comment
Share on other sites

  • 0
1 minute ago, jorge rintaro said:

jgab@,

 

thank you very much for the tips..... I made the adjustments now the message (TRACE) appears in the debug panel ......???

I'm studying now QA, a lot to learn yet.....sorry!

 

Please login or register to see this attachment.

Yes, the trace is from Fibaro's implementation of the UI handling. A bit annoying but it informs you that you pressed the "whats1" button of deviceId 318.

Link to comment
Share on other sites

  • 0

Hello jgab@, reading most of your tips and tricks - very helpfull. In this case my question: is there a way to send a picture from a ip-cam as a whatsapp-message? E.g. in case motiondetection -> send picture from a camrange...

Thanks in advance.

Link to comment
Share on other sites

  • 0

No, the callmebot that provides the GW to WhatsApp only support text messages.

...but it does support emoticons.

Edited by jgab
Link to comment
Share on other sites

  • 0
On 2/6/2022 at 4:57 PM, jgab said:

Yes,

go  to 

Please login or register to see this link.

and get an API key.

Then:

Please login or register to see this code.

You need one api key to each number you want to send to

Hi

 

I have changed the mobile number and the apikey  but I have get the following error message>

 

[DEBUG] 11:48:40: 2022-02-13 11:48:40.672855 [ fatal] Unknown exception: /opt/fibaro/scenes/187.lua:17: attempt to index global 'QuickApp' (a nil value)
 

What does mean thi?s

Link to comment
Share on other sites

  • 0
21 minutes ago, iTibor said:

Hi

 

I have changed the mobile number and the apikey  but I have get the following error message>

 

[DEBUG] 11:48:40: 2022-02-13 11:48:40.672855 [ fatal] Unknown exception: /opt/fibaro/scenes/187.lua:17: attempt to index global 'QuickApp' (a nil value)
 

What does mean thi?s

Because you are trying to run the code from a Scene, The code is a QuickApp example.

This should work from a scene.

Please login or register to see this code.

 

Link to comment
Share on other sites

  • 0
1 hour ago, jgab said:

Because you are trying to run the code from a Scene, The code is a QuickApp example.

This should work from a scene.

Please login or register to see this code.

 

 

Hi

 

Now I have got the following message

 

[DEBUG] 13:43:11: 2022-02-13 13:43:11.006944 [ error] Handshake error: certificate verify failed
 

And the number and the api key is okay ...- I have checked the sent link in whatsapp , I have put in browser link and worked

Edited by iTibor
correct text
Link to comment
Share on other sites

  • 0

Try

Please login or register to see this code.

...or move your code to a  QA...

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.

×
×
  • Create New...