FlyingDiver / Indigo-Slack2

Send messages and files from Indigo to a Slack channel
MIT License
0 stars 0 forks source link

Message events aren't firing #4

Closed indigo-jay closed 2 years ago

indigo-jay commented 2 years ago

Since the upgrade to Python 3, Message events aren't firing, but nothing in the log is particularly useful. On startup:

Loading plugin "Slack 2 2022.0.0" using API v3.0
Starting plugin "Slack 2 2022.0.0" (pid 86187)
Slack 2 Debug                   LogLevel = 5
Started plugin "Slack 2 2022.0.0"
Slack 2 Debug                   Slack 2 startup
Slack 2                         Reflector OK, this is your webhook URI for Slack dashboard: https://XXXXXXXXXXXXX.indigodomo.net/message/com.flyingdiver.indigoplugin.slack/webhook?api_key=XXXXXXXXXXXXXXXXXXXXXXXXX
Slack 2 Debug                   Bazaar Slack: Starting Device
Slack 2                         Bazaar Slack: Connected to Slack Workspace 'Bazaar Software'
Slack 2                         Bazaar Slack: Channel List Updated
Slack 2 Debug                   Bazaar Slack: Channels: [('C01M3176HPG', 'emergency'), ('C01M8H4ADLJ', 'general'), ('C01M8H4TCG2', 'notifications'), ('C01M8P4HTPV', 'random'), ('C01PJ1SH0HG', 'to-read')]
Slack 2 Debug                   Laundry Finished: Adding Trigger

The Laundry Finished trigger isn't firing. Definition:

image

pip3 installs:

TinyMac:~ admin$ pip3 list
Package                                  Version
---------------------------------------- -------
cffi                                     1.15.0
cryptography                             37.0.2
cycler                                   0.11.0
fonttools                                4.33.3
gevent                                   21.12.0
greenlet                                 1.1.2
kiwisolver                               1.4.2
matplotlib                               3.5.1
numpy                                    1.22.3
packaging                                21.3
Pillow                                   9.1.0
pip                                      21.2.4
pycparser                                2.21
pyparsing                                3.0.8
python-dateutil                          2.8.2
scipy                                    1.8.0
setuptools                               58.1.0
six                                      1.16.0
websocket                                0.2.1
websocket-client                         1.3.2
zope.event                               4.5.0
zope.interface                           5.4.0

I do note that the websocket library is extremely old - the latest version (0.2.1) is from 2010, so I wonder if that just doesn't work with Python 3.10.

All of this was working nicely in Python 2/API 2.x.

indigo-jay commented 2 years ago

I should note - there are no other debug lines in the event log after the ones above. Nothing when a message is added to the selected channel, etc.

FlyingDiver commented 2 years ago

Hmm. I thought I tested that. I'll check.

indigo-jay commented 2 years ago

Correction, I just noticed these two lines from the event log:

Jun 1, 2022 at 10:42:40 AM
   Slack 2 Debug                   get_channel_list, targetId=293900836, typeId=messageEvent, valuesDict = UiValuesDict : (dict)
     slackChannel : C01M8H4TCG2 (string)
     slackDevice : 1694834566 (string)

Jun 1, 2022 at 10:46:30 AM
   Slack 2 Debug                   get_channel_list, targetId=293900836, typeId=messageEvent, valuesDict = UiValuesDict : (dict)
     slackChannel : C01M8H4TCG2 (string)
     slackDevice : 1694834566 (string)
indigo-jay commented 2 years ago

SAF has gone down significantly since we no longer get flashing Inovelli LEDs when the washing machine or dryer is done...

FlyingDiver commented 2 years ago

Can't have that...

FlyingDiver commented 2 years ago

What brand are they again? LG?

indigo-jay commented 2 years ago

GE - last time I looked no API. So I'm using their IFTTT integration to post updates to the slack channel. The posts are going through to slack, just not from there into the plugin/Indigo.

FlyingDiver commented 2 years ago

We just got an LG laundry pair. Might look into the ThinQ API.

FlyingDiver commented 2 years ago

The plugin doesn't use websocket. Did you check that you have the right URL in the Slack API dashboard?

indigo-jay commented 2 years ago

Ah, I think I see the problem. The description in the store is incorrect: https://www.indigodomo.com/pluginstore/192/

I didn't do these:

sudo /usr/bin/pip3 install slack-sdk
sudo /usr/bin/pip3 install aiohttp
sudo /usr/bin/pip3 install aiofiles

But only the two websocket ones in the description on the store. I'll uninstall the two websocket ones listed there and install the above.

FlyingDiver commented 2 years ago

Wait. That's the old one. The new Readme didn't get pushed.

indigo-jay commented 2 years ago

BTW, your wiki install instructions are wrong also - they point to the wrong pip3...

FlyingDiver commented 2 years ago

I just updated the wiki. Feel free to suggest edits.

indigo-jay commented 2 years ago

So, did this configuration stuff change significantly from the python 2 plugin? I have an Installed App that I created in that workspace called Indigo Plugin, but I don't see any tokens. Do I need to just trash everything from before and start over?

indigo-jay commented 2 years ago

Ok, so uninstalled websockets and websockets-client, installed the 3 in the wiki.

I found the info on the slack site (it's a pita with multiple workspaces), and everything looks like it's configured correctly. The wiki says this:

Just enter that App Token and Bot Token in the device configuration dialog.

But the device config only has a field for the Bot Token (which is the correct token). Is that the problem? I'm still not getting anything when new messages are added to the channel (coming from a different account, so that's not the problem).

indigo-jay commented 2 years ago

I should note that it's getting the correct list of channels for that workspace, so at least that part of the communication is working correctly.

FlyingDiver commented 2 years ago

Yes it changed a bunch from the version that used websocket. They deprecated that in favor of webhooks.

I'll review the instructions again and see where it's misleading.

We could avoid all of this if we can get the url rewrite in the reflector. If we can do that we can use Oauth and not need to do any of this per user setup.

FlyingDiver commented 2 years ago

Gah. The correct directions for the new version are at https://github.com/FlyingDiver/Indigo-Slack2/wiki/Setup

I forgot to edit the main page to point there when I released the new version. Can you try those instructions and see if everything works?

indigo-jay commented 2 years ago

So, you do or don't need those pip installs? In any event, they are installed.

Just walked through the steps, everything looks right. Still no go.

FlyingDiver commented 2 years ago

Fixed install instructions.