Start a new topic

Python Library for LaMetric

Hi,


everyone who is interested in controlling the LaMetric Time using Python should have a look here:


https://github.com/alexrockt/lmnotify (this is my fork of https://github.com/keans/lmnotify which is the available via PIP). I've send pull requests to the original repository and as soon as the maintainer accepts it, the current version should be also available via PIP.


I added support for Python 3.6 and all the new stuff from firmware 1.75:


  • switching apps
  • play/pause radio
  • switch radio channels
  • start/pause/reset countdown and stopwatch
  • enable/disable/set alarm clock
  • examples for alarm clock and radio



Hi Alex,


great api! Is there a possibility, to use the local api? I tried changing the baseurl in const.py but then i get [SSL: CERTIFICATE_VERIFY_FAILED]. I could not find out where to switch off validation. As long as it uses OAuth, i see no way to change to my apikey. Do i miss anything?

Hi,


the library already uses the local API - the BASE_URL is only used for authenticating at the beginning, to get the access token.


Every other call is always using the IPv4 address (in _exec(): url = url % self.dev["ipv4_internal"]).


What are you trying to do?

Hi,


i was trying to switch to local api completely, using only the api key for auth. Managed to do that by changing lmnotify.py:

# add device address to the URL
url = url % "192.168.178.42"

# set basic authentication
auth = HTTPBasicAuth("dev", "8fe841bb4bcdxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx3501dc79c76ac")
The api key could be read from the configfile of course.

Ok,


I guess you can do it this way, although using oAuth to get the data is "cleaner". It's also easier to handle multiple devices at once. But I get why someone would need everything local only.

Login or Signup to post a comment