alexbelgium / hassio-addons

My homeassistant addons
MIT License
1.49k stars 213 forks source link

WHATSAPPER | Fixed WWeb.js library #1367

Closed baldarn closed 5 months ago

baldarn commented 5 months ago

fixing using a PR branch that should work

https://github.com/pedroslopez/whatsapp-web.js/pull/2816

siw1973 commented 5 months ago

@baldarn let me know when it's pushed and I'll try when I'm back home in about an hour 👍

siw1973 commented 5 months ago

@baldarn looks like it's passed the login and polling for messages, I'm assuming that the Web UI won't open until it's completed ? Is it loading all of my historic messages ?

This is in the logs but nothing is coming up.

{"method":"GET","url":"/","hostname":"192.168.2.156:4000","remoteAddress":"192.168.0.23","remotePort":50320},"msg":"incoming request"}

siw1973 commented 5 months ago

I'm not sure if all is well. Following on from the above I'm getting the following which I think is causing the Web UI to fail.

{"level":30,"time":1714417316546,"pid":7,"hostname":"db21ed7f-whatsapper","reqId":"req-8","msg":"Route GET:/favicon.ico not found"}

The log is a continous cycle of the following as well.

{"method":"GET","url":"/","hostname":"127.0.0.1:3000","remoteAddress":"127.0.0.1","remotePort":55378},"msg":"incoming request"} {"level":30,"time":1714417312572,"pid":7,"hostname":"db21ed7f-whatsapper","reqId":"req-6","res":{"statusCode":200},"responseTime":0.41631000116467476,"msg":"request completed"}

siw1973 commented 5 months ago

However I can get to 192.168.2.156:4000/chats

I have also set up the following in configuration.yaml

But this does not create a Service that is available in HA such as notify.y4_mc_login

TBH I'm blundering around a bit blind here and taking two steps forward and two steps back.....

baldarn commented 5 months ago

@siw1973 strange.

now my instance of whatsapper is working. did you reboot the system after adding the configuration? you cannot create or edit it without rebooting home assistant :)

baldarn commented 5 months ago

hold on, did you installed the whatsapper home assistant integration via hacs?

https://github.com/baldarn/whatsapper-ha-integration

siw1973 commented 5 months ago

@siw1973 strange.

now my instance of whatsapper is working. did you reboot the system after adding the configuration? you cannot create or edit it without rebooting home assistant :)

1/ Yes I did install via HACS, but after a VM restart couldn't access anything at http://192.168.2.156:5000 so I found the above URL after digging around.

Note the above error in the logs : msg":"Route GET:/favicon.ico not found"

2/ After accessing on http://192.168.2.156:5000/chats I found the Group ID I want to send to and modify configuration.yaml as above and Restarted Home Assistant services.

3/ After doing this I have been looking for an appropriate Notify Service in Developer Tools to call within my existing Automations. I have notify services for mobile devices and also "platform : group" entries I have put in configuration.yaml, but not for platform : whatsapper

4/ If you can provide an example of the basic message structure after helping me set up the service it'd be appraciated.

QUESTION : Is there another web UI page apart from http://192.168.2.156:5000/chats ? The documentation intimates I should be able to access from http://192.168.2.156:5000/ on it's own

baldarn commented 5 months ago

maybe the issue could be the _?

try renaming name: "y4 mc login"

then, the availabels routes are: /chats /qr

is still ultra basic for now.

the favicon is a bug i think, but shouldn't be a problem

siw1973 commented 5 months ago

Hi there, still no joy. My full Notify part on configuration.yaml is as follows :

# Notification Groups
notify:
  - name: "notify_ha_core"
    platform: group
    services:
    - service: mobile_app_sjw_pixel7
    - service: mobile_app_mtfr_pixel7
  - name: "notify_ha_parents"
    platform: group
    services:
    - service: mobile_app_dsb_0230
  - name: "y4mclogin"
    platform: whatsapper
    chat_id: xxxxxxxxxx404121@g.us

1/ Is this supposed to create a notify service that I can access from Developer Tools -> Services ?

2 / I have found a Device for Whatsapper, but no corresponding Entities that I could hang a Service from :

image

image

siw1973 commented 5 months ago

If you can show me what you are seeing in your :

Then I'll be able to do some digging myself.

baldarn commented 5 months ago

services Screenshot_20240430_162057

config Screenshot_20240430_162203

devices Screenshot_20240430_162239

it seems you are missing the HACS integration

siw1973 commented 5 months ago

I have installed and reloaded the HACS Integration, wiped everything and then rebuilt from scratch, removed the config.yaml entries and reloaded and I cannot get the Whatsapper-Notification device to display.

Can you please provide guidance on how I can wipe everything and then the steps to intall from nothing.

baldarn commented 5 months ago

tomorrow I'll assist you.

if needed, we can schedule a call ;)

baldarn commented 4 months ago

@siw1973 I tried to delete everything and go on.

can you check that in /custom_components/ there is a folder named whatsapper?

if not, you are having problem installing the integration from HACS

you can reach me out on telegram, nick @baldarn

siw1973 commented 4 months ago

Hi there, unfortunately I'm not on Telegram.

I did have a folder called Whatsapper previously. As I've deleted everything lets start from scratch, step by step.

baldarn commented 4 months ago

that should be the same.

try to install first the addon, then the integration

then add the configuration

then restart home assistant

siw1973 commented 4 months ago

So from a Devices perspective I should get the Whatsapper HA Add-ons line after installing the Add On and then after installing the Whatsapper Integration I should get the Whatsapper Notification baldarn line.

siw1973 commented 4 months ago

Should I start the Whatsapper Add On after installing and link to Whatsapp before installing the Whatsapper Integration.

Step by step :-)

baldarn commented 4 months ago

I did that without starting the addon. so try without

siw1973 commented 4 months ago

So from a Devices perspective I should get the Whatsapper HA Add-ons line after installing the Add On and then after installing the Whatsapper Integration I should get the Whatsapper Notification baldarn line.

Is this correct ?

BTW : I still have Protection Mode "On"

siw1973 commented 4 months ago

I haven't started the AddOn yet, but the Whatsapper notification line is not visible in devices.

image

I have not started the Add On though.

siw1973 commented 4 months ago

I do have the Whatsapper folder present under custom components though 👍

image

baldarn commented 4 months ago

could we do a call? maybe we can solve this in 5 mins ;)

tell me your preferred call system

siw1973 commented 4 months ago

Hi there, just been setting up accounts on an old email address.

I've pinged you an email.

siw1973 commented 4 months ago

Your email just bounced.....

removed against spam

baldarn commented 4 months ago

try removed against spam

baldarn commented 4 months ago

we should have fixed that! ;)

siw1973 commented 4 months ago

For whoever reads this in the future, my issue was that I had an old version of HACS installed that did not install the Whatsapper Integration correctly. Upon getting the correct version in a reboot worked.

@baldarn went way above and beyond the call of duty and jumped on a call to work this through with me and resolve.

alexbelgium commented 4 months ago

Thanks very much @baldarn !!! And great to know it is solved!!