Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lametric Time Cloud Mode not working #290

Closed
caronc opened this issue Sep 4, 2020 · 16 comments
Closed

Lametric Time Cloud Mode not working #290

caronc opened this issue Sep 4, 2020 · 16 comments
Labels

Comments

@caronc
Copy link
Owner

caronc commented Sep 4, 2020

📣 Notification Service(s) Impacted
Lametric Time

🪲 Describe the bug
The device mode works fine but the cloud mode does not. It doesn't appear to have every worked since #235

💡 Screenshots and Logs
Current output (thanks to @mattpackwood)

$ apprise -vvv -b "Test Message Body" lametric://9403c98d-REDACTED5bd2f@JDEkREDACTED5YVBnMA==
2020-09-03 17:03:29,749 - DEBUG - Loaded LaMetric URL: lametric://9403c98d-REDACTED-246509a5bd2f@JDEka0dTNGdDMREDACTEDN2F5YVBnMA%3D%3D/?mode=cloud&format=text&overflow=upstream&rto=4.0&cto=4.0&verify=yes
2020-09-03 17:03:29,749 - INFO - Notifying 1 service(s) asynchronous.
2020-09-03 17:03:29,749 - DEBUG - Using selector: EpollSelector
2020-09-03 17:03:29,750 - DEBUG - LaMetric POST URL: https://developer.lametric.com/api/v1/dev/widget/update/com.lametric.9403c98d-REDACTED-246509a5bd2f (cert_verify=True)
2020-09-03 17:03:29,750 - DEBUG - LaMetric Payload: {'frames': [{'icon': 'i620', 'text': 'Test Message Body'}]}
2020-09-03 17:03:30,973 - WARNING - Failed to send LaMetric notification: Page not found., error=404.
2020-09-03 17:03:30,974 - DEBUG - Response Details:
b''

💻 Your System Details:

  • OS: Ubuntu
  • Python Version: 3

🔮 Additional context
n/a

@caronc caronc added the bug label Sep 4, 2020
@caronc
Copy link
Owner Author

caronc commented Sep 5, 2020

@mattpackwood,

I don't have one of these devices, so it's really hard for me to test this. I spent some time googling how other plugins connected to the Lametric (through the cloud). I made some pretty drastic changes to the app (cloud mode), i'm not sure how it will work... So as far as the cloud mode goes; forget the {client_id} and {secret_id}. It's the {app_id} and {apikey} that is important now.

  1. Sign Up and login to the developer webpage https://developer.lametric.com. Locate your Device API Key; you can find it here: https://developer.lametric.com/user/devices
  2. Create a Notification App if you haven't already done so from: https://developer.lametric.com/applications/sources
  3. Provide it an app name, a description and privacy URL (which can point to anywhere; I set mine to http://localhost). No permissions are required.

The coud URL should look like this (with the new branch only will this work):

  • lametric://{apikey}@{app_id}?mode=cloud
# Create a virtual environment to work in
# This way you can just destroy it after when it's all over.
# The below will create a directory called apprise
python3 -m venv apprise

# Change into our new directory
cd apprise

# Activate our virtual environment
source bin/activate

# Install the branch with Lametric chamges
pip install git+https://github.com/caronc/apprise.git@lametric-cloud-support

# Give it a go:
# App ID in the form of a string of numbers and letters
#                    such as 941c51dff3135bd87aa72db9d855dd50
apprise -t "Title" -b "Body" "lametric://{apikey}@{app_id}?mode=cloud"

@mattpackwood
Copy link
Contributor

Hi there,

Errors on install:

(apprise) mattpackwood@ubuntu:~/apprise$ pip install git+https://github.com/caronc/apprise.git@lametric-cloud-support
Collecting git+https://github.com/caronc/apprise.git@lametric-cloud-support
  Cloning https://github.com/caronc/apprise.git (to revision lametric-cloud-support) to /tmp/pip-req-build-pydzbfe1
  Running command git clone -q https://github.com/caronc/apprise.git /tmp/pip-req-build-pydzbfe1
  Running command git checkout -b lametric-cloud-support --track origin/lametric-cloud-support
  Switched to a new branch 'lametric-cloud-support'
  Branch 'lametric-cloud-support' set up to track remote branch 'lametric-cloud-support' from 'origin'.
Collecting PyYAML
  Downloading PyYAML-5.3.1.tar.gz (269 kB)
     |████████████████████████████████| 269 kB 941 kB/s 
Collecting click>=5.0
  Using cached click-7.1.2-py2.py3-none-any.whl (82 kB)
Collecting markdown
  Using cached Markdown-3.2.2-py3-none-any.whl (88 kB)
Collecting requests
  Downloading requests-2.24.0-py2.py3-none-any.whl (61 kB)
     |████████████████████████████████| 61 kB 206 kB/s 
Collecting requests-oauthlib
  Using cached requests_oauthlib-1.3.0-py2.py3-none-any.whl (23 kB)
Collecting six
  Downloading six-1.15.0-py2.py3-none-any.whl (10 kB)
Collecting idna<3,>=2.5
  Downloading idna-2.10-py2.py3-none-any.whl (58 kB)
     |████████████████████████████████| 58 kB 1.0 MB/s 
Collecting chardet<4,>=3.0.2
  Downloading chardet-3.0.4-py2.py3-none-any.whl (133 kB)
     |████████████████████████████████| 133 kB 2.6 MB/s 
Collecting certifi>=2017.4.17
  Downloading certifi-2020.6.20-py2.py3-none-any.whl (156 kB)
     |████████████████████████████████| 156 kB 4.0 MB/s 
Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1
  Downloading urllib3-1.25.10-py2.py3-none-any.whl (127 kB)
     |████████████████████████████████| 127 kB 3.3 MB/s 
Collecting oauthlib>=3.0.0
  Using cached oauthlib-3.1.0-py2.py3-none-any.whl (147 kB)
Building wheels for collected packages: apprise, PyYAML
  Building wheel for apprise (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/mattpackwood/apprise/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-pydzbfe1/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-pydzbfe1/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-g6megg1y
       cwd: /tmp/pip-req-build-pydzbfe1/
  Complete output (10 lines):
  WARNING: The wheel package is not available.
  WARNING: The wheel package is not available.
  WARNING: The wheel package is not available.
  Warning: 'classifiers' should be a list, got type 'tuple'
  usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
     or: setup.py --help [cmd1 cmd2 ...]
     or: setup.py --help-commands
     or: setup.py cmd --help
  
  error: invalid command 'bdist_wheel'
  ----------------------------------------
  ERROR: Failed building wheel for apprise
  Running setup.py clean for apprise
  Building wheel for PyYAML (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/mattpackwood/apprise/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-j14su5sf/PyYAML/setup.py'"'"'; __file__='"'"'/tmp/pip-install-j14su5sf/PyYAML/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-ohjfa1l8
       cwd: /tmp/pip-install-j14su5sf/PyYAML/
  Complete output (6 lines):
  usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
     or: setup.py --help [cmd1 cmd2 ...]
     or: setup.py --help-commands
     or: setup.py cmd --help
  
  error: invalid command 'bdist_wheel'
  ----------------------------------------
  ERROR: Failed building wheel for PyYAML
  Running setup.py clean for PyYAML
Failed to build apprise PyYAML
Installing collected packages: PyYAML, click, markdown, idna, chardet, certifi, urllib3, requests, oauthlib, requests-oauthlib, six, apprise
    Running setup.py install for PyYAML ... done
    Running setup.py install for apprise ... done
Successfully installed PyYAML-5.3.1 apprise-0.8.8 certifi-2020.6.20 chardet-3.0.4 click-7.1.2 idna-2.10 markdown-3.2.2 oauthlib-3.1.0 requests-2.24.0 requests-oauthlib-1.3.0 six-1.15.0 urllib3-1.25.10

Ran the code:

apprise -vvv -t "Title" -b "Body" "lametric://9a7affc30b2REDACTED35ae350fc8c5f98ada@9403c98d-REDACTEDa5bd2f?mode=cloud"
2020-09-05 09:04:48,871 - DEBUG - Loaded LaMetric URL: lametric://9a7affc30b22b3e8a15REDACTEDd1d2af5035ae350fc8c5f98ada@9403c98d-98aa-2REDACTED09a5bd2f/?mode=cloud&format=text&overflow=upstream&rto=4.0&cto=4.0&verify=yes
2020-09-05 09:04:48,871 - INFO - Notifying 1 service(s) asynchronous.
2020-09-05 09:04:48,871 - DEBUG - Using selector: EpollSelector
2020-09-05 09:04:48,872 - DEBUG - LaMetric POST URL: https://developer.lametric.com/api/V1/dev/widget/update/com.lametric.9a7affc3REDACTED5d9f8fb2d1d2af5035ae350fc8c5f98ada (cert_verify=True)
2020-09-05 09:04:48,872 - DEBUG - LaMetric Payload: {'frames': [{'icon': 'i620', 'text': 'Title\r\nBody'}]}
2020-09-05 09:04:49,740 - WARNING - Failed to send LaMetric notification: error=403.
2020-09-05 09:04:49,741 - DEBUG - Response Details:
b'{"error":{"code":null,"message":"Forbidden","trace":["Permissions denied"]}}'

I added the -vvv as I did not see any message from the "first try".... If you like I am happy to send you (in a secure method) the unredacted version of my credentials (I can always reset them later).

@caronc
Copy link
Owner Author

caronc commented Sep 9, 2020

I made some more changes; they may or may not work. You'll have to do a git update to pull the new changes in.

I would like to take you up on your offer if this doesn't work though. Perhaps you could email me (at lead2gold@gmail.com) your App ID an API Key if this fails? I won't spam your account, i just want to get the 200 response code letting me know i'm at least pushing the updates properly.

Who knows though; maybe the latest code will work... same rules apply as before though; format it as:
lametric://{apikey}@{app_id} 🙂

@caronc
Copy link
Owner Author

caronc commented Sep 9, 2020

@mattpackwood Thank you for reaching out to me. You provided the {app_id} in your email (which is great), i just need your Device {apikey} so we can construct : lametric://{apikey}@{app_id}?mode=cloud

I've pushed some big changes and also a lot of unit-tests to go with it; so it's possible the latest code works too.

Thanks for all your help so far! 🙂 👍

@mattpackwood
Copy link
Contributor

mattpackwood commented Sep 10, 2020 via email

@caronc
Copy link
Owner Author

caronc commented Sep 10, 2020 via email

@mattpackwood
Copy link
Contributor

mattpackwood commented Sep 10, 2020 via email

@caronc
Copy link
Owner Author

caronc commented Sep 10, 2020

@mattpackwood i agree; that's the way it appears now, but the screenshots from their website paint a different picture. They show that it used to provide both URLs (for cloud pushing) and there are a lot of sources they still link to that use this technique (so while it appears to be suddenly hidden, it's very much working). See:

When i hear back from LaMetric, i'll let you know. There is a good chance if you create an Indicator App and configure it for a Local Push just to get the APP ID (from the end of the URL), it might work when paired with your API Key (from the device list screen).

@mattpackwood
Copy link
Contributor

@caronc I just e-mailed you the credentials I got from creating an indicator app...

@caronc
Copy link
Owner Author

caronc commented Sep 10, 2020

Thanks a lot Matt! It looks like the APP Access Token isn't universal 🙁. I get the error from their remote server:

  • Only local pushes are allowed for this application

Using the latest code I pushed:

apprise -vvv -b test "lametric://{APP_ACCESS_TOKEN}@{APP_ID}/1?mode=cloud"

Produced...

2020-09-10 15:20:37,744 - DEBUG - Loaded LaMetric URL: lametric://{APP_ACCESS_TOKEN}@{APP_ID}/1/?mode=cloud&format=text&overflow=upstream&rto=4.0&cto=4.0&verify=yes
2020-09-10 15:20:37,744 - INFO - Notifying 1 service(s) asynchronous.
2020-09-10 15:20:37,744 - DEBUG - Using selector: EpollSelector
2020-09-10 15:20:37,745 - DEBUG - LaMetric POST URL: https://developer.lametric.com/api/v1/dev/widget/update/com.lametric.{APP_ID}/1 (cert_verify=True)
2020-09-10 15:20:37,745 - DEBUG - LaMetric Payload: {'frames': [{'icon': 'i620', 'text': 'test'}]}
2020-09-10 15:20:38,545 - WARNING - Failed to send LaMetric notification: error=403.
2020-09-10 15:20:38,546 - DEBUG - Response Details:
b'{"error":{"code":null,"message":"Forbidden","trace":["Only local pushes are allowed for this application"]}}'

Edit: The Lametric Tutorial explaining how all this works mentions Publishing your app. Maybe this needs to be done first before you can perform a remote post? Maybe there is some way you can perform this publishing?

@mattpackwood
Copy link
Contributor

Yep, I get the feeling that this is a "local only" service like the desktop notify. Pity, having a cloud-aware device that does not accept pushes is pity...

@caronc
Copy link
Owner Author

caronc commented Sep 10, 2020

@mattpackwood try opening up your App again (on the Lametric Website) and click on the Draft Tab. You should be able to Publish the app which would make it available (for others i believe too) and you can then post to it with perhaps a new Access Token it generates (or it might just make the one you already have work).

@mattpackwood
Copy link
Contributor

Chris, it looks like the website is smart enough to say that a local push application can only be set to "Private".

@caronc
Copy link
Owner Author

caronc commented Sep 11, 2020

Matt,

Would you be okay with making your App public (for publishing/remote access purposes); you can always delete it later. Keep in mind that no one will abuse it because you're also the only one who can post to it (as no one else has the Access Token). But if you're not comfortable with that, I totally understand! You've been a fantastic help regardless even just to get to this point! 🙂

I'll still probably merge all my new changes on this new Lametric branch just because of the improvements that did come with it regardless.

@mattpackwood
Copy link
Contributor

Chris,

I have published it, the problem seems to be that:
If you create an Indicator App that does not have an APP_ID

I just e-mailed you some info...

Matt

@caronc
Copy link
Owner Author

caronc commented Sep 14, 2020

Thanks Matt,

I'm merging all of my changes and closing off this issue now. If you have the ability to use the developer.api now; you will be able to use the cloud mode at this time. LaMetric has definitely changed things around making this process different then what they've officially documented here. So it's anyone's guess how new users can get access to this mode again.

I reached out to them through their support and haven't heard back.

For now I'm closing this issue off because it's about the best it's going to get. If LaMetric updates their documentation or opens up the possibility to use the legacy developer.api code, then the new code pushed in the Pull Request associated with this ticket will work.

@caronc caronc closed this as completed Sep 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants