LaMetric Time

I never got it connected to HE, but it wasn't a priority. If you can make it work, that would be great.

Hehe. I'll give it a go.

Might have jumped in more at the deep-end than I'd originally thought - but hey... you learn best by doing, and all that.

My mental map of how OAuth works is clearly deficient at the moment, but I suspect that if I can work it out, then it'll probably admit defeat eventually. I'll let you know how I get on. LaMetric is hardly the highest priority for me, either... but it looked like low-hanging fruit when I sat down and tried to work out what I needed to do :wink:

-- Jules

1 Like

Interested to see this. There's someone that can do a lot for the optics of this platform if he has reason to want to try it. He has a LaMetric and this would be a good carrot to dangle.

Oh, by the way, if you contact @bobbyD, he can change your user name to one that we humans can read :wink:

Oh yeah. I'd only just noticed that I've got a name only CPUs can pronounce :wink:

@bobbyD - any chance of a name change? Either 'MrTickle', or 'JulesT' would do nicely.

-- Jules

1 Like

OK. Finally. Success, I think.

So... quite a lot of changes necessary to get it working in the end, I think, but all confined to the Connect app.

In no particular order, changes to the following:

  1. Added web interface to make ClientID and ClientSecret actually turn up and be prompted for.
  2. Re-wrote the Oauth stuff pretty much from scratch (Well... I say from Scratch - I mostly cribbed it from other integrations I found on the forums here).
  3. Not sure I'm doing this right - but the way the discovery worked was to do a sendHubCommand to interrogate a discovered device, and assume that the locationHandler would get a callback when the response arrived. That wasn't happening, so I replaced it with an explicit callback, which then handles the data and correctly populates it's device data.
  4. Notifications - they were using sendHubCommand too, but from reading the forums, they don't work in drivers. I took that to mean that they don't work if they're LAUNCHED from drivers - technically the code was in the Connect app, and called by a parent(). in the driver. I replaced that with an asynchttpPost() call with an appropriate callback, and all looks to be well now.

So... anybody that's interested, please feel free to give it a go. The code can be found here:

Connect App: https://raw.githubusercontent.com/Slapn/hubitat-LaMetric/master/apps/lametric-connect.groovy
Notifier App (largely unchanged): https://raw.githubusercontent.com/Slapn/hubitat-LaMetric/master/apps/lametric-notifier.groovy
Driver: https://raw.githubusercontent.com/Slapn/hubitat-LaMetric/master/device/lametric-device.groovy

Please let me know how you get on. I'm not ruling out that it explodes violently for all involved :wink:

-- Jules

4 Likes

Hello, I don't have a lametric at the moment but searching for a way to display meassured temperatures and humidity aso at a glance.

How capable is this implementation?

I never got it to work with HE. I still use the Lametric, but on it's own. It also displays what is playing on my Sonos.

so it's not really useful for an integration... thanks

Not until someone correctly ports the driver and app over from ST. It is beyond my ability.

You can use HE to IFTTT to Lametric if you want. I haven't because IFTTT always seemed slow to me.

I did notice something interesting. I have the LT displaying current Sonos tracks, through its built in app. If I use the Sonos as a TTS device in HE, the LT will also display what happened. The Sonos will say "The front door is open", and the LT will display "Hubitat - The front door is open". But only if I use the Sonos as a TTS, and I don't, because it doesn't reliably restore the track. I also use the Lutron Sonos audio pico. If I press the play button, it won't start playing the station again, but instead say "The front door is open". So I separated them and use a Samsung R1 for my TTS, and the Sonos for music, and my pico works normally.

Hi Oliver. At the moment, I just use it for sending messages, for which it works just fine. Haven't really looked any harder at the moment, but if anybody's got a particular use case, I'm happy to have a bash at it.

-- Jules

Is there a way to use this as a notification device outside the La Metric Notification App?

I ask because if you try to send a notification using RM, for example, you receive the following log:

[app:5379](http://192.168.7.57/logs#app5379)2020-05-24 01:14:24.325 pm [error](http://192.168.7.57/installedapp/configure/5379)java.lang.Exception: No response data exists for async request on line 818 (notificationCallbackMethod)

[app:5379](http://192.168.7.57/logs#app5379)2020-05-24 01:14:24.315 pm [debug](http://192.168.7.57/installedapp/configure/5379)Auth: dev:680ffaa83aa236e6a1ed494ce82b8c099b252bae2c8ebd81abee7703b3a8b767

[app:5379](http://192.168.7.57/logs#app5379)2020-05-24 01:14:24.311 pm [debug](http://192.168.7.57/installedapp/configure/5379)send notification message to device 192.168.7.36:8080/api/v2/device/notifications Test - key: 680ffaa83aa236e6a1ed494ce82b8c099b252bae2c8ebd81abee7703b3a8b767

[app:5379](http://192.168.7.57/logs#app5379)2020-05-24 01:14:24.307 pm [debug](http://192.168.7.57/installedapp/configure/5379)send something

I never got this working with HE. It does work with Smarthings.

[quote="JulesT, post:17, topic:5000"]
get it working in the end, I think, but all confined to the
[/quote], Works great, I have 2 Lametrics, it sees both and added them as devices but will only output on 1, if though i have both selected, any ideas? Thanks

Hi JulesT,

I use this app for messages also. Otherwise my LT is sat on the clock screen. Is there any code that I can change to make the messages stay on screen for say 15 seconds. Often times I look up to see a message disappearing back to clock screen - mostly single words relating to my motion sensors.

Thanks in advance.

Can anyone document how they got this to work? It's dead in the water for me too.

OK, after some further messing with it, I got it to work! Here's some tips...

  1. Unlike Smartthings a redirect URL isn't need in your Lametric developer app configuration. Make sure it's empty.

  2. As was mentioned previously after creating the Connect app, hit the OAuth button.

  3. When adding the Connect user app, you do it twice. The first time you enter your client ID and client secret which sends you to Lametric's site to authorize it. The second time the app runs a discovery to find your Lametric device. This is where I had issues - it couldn't find my device. The way I worked around was a follows...

a. Go to Devices.
b. Add a virtual device.
c. In the "Device Name" and "Device Label" enter the actual name of your Lametric device (can be found in the Lametric App). Mine was "My LaMetric".
d. From the "Type" dropdown select "LaMetric".
e. Save the device.

Now when running discovery My Lametric showed up and I was able to select it from the list. It then created a second Lametric device which was the real one and I deleted the one I created.

  1. If you want Notifications to appear for longer, use an Animated icon when creating the notification. You can find the icon ID here: LaMetric: Web

Good luck!

3 Likes

Hate to be digging up super old threads but even with all the help in this thread it took me almost an hour to setup of an old LaMetric device I had laying around so wanted to add a few clarifying steps to @ngcard's post above in case anyone else has the same issue I did where the "LaMetric (Connect)" Apps Code screen would not open the OAuth flow mentioned in step 2 above for some reason.

Long story short, all I had to do was skip step 2 above and jump to installing the Connect app and then running through the OAuth flow within the app itself.

If memory serves, these were the steps I eventually took to get it working:

  1. Go setup a developer account with LaMetric and create a basic Notification App like the example image above. (Take note of the new App's Client ID and Secret as you'll need them later)
  2. Next, go to Hubitat's "Drivers Code" page and install the drivers from above
  3. Then head over to your hub's "Apps Code" page and install both the LaMetric Connect and LaMetric Notifier apps from above
  4. Navigate to your hub's "Apps" page and hit the "Add user App" then install "LaMetric Connect" from the list.
  5. Once you've installed/launch the "Connect" app the first time you should now be able to follow the OAuth flow inside there.
  6. Similar to @ngcard 's tips above, I am pretty sure once I completed the OAuth by entering my Client ID and Secret the first time I had to exit the Connect app in Hubitat, then I just scrolled down and re-opened it again.
  7. If setup correct it should start searching for devices and after a few seconds the drop down should populate.
  8. Select your device from the list and hit done to close the Connect App (As mentioned above this will automatically create the "LaMetric" device for you.)
  9. If you want to confirm, head over to Hubitat's devices page and find your LaMetric device from the list
  10. Once the Connect app has created your device then it's time to install the "LaMetric Notifier" by clicking on the "Add user App" button on the Apps page again and finding it in the list.
  11. After the Notifier app is installed/Loaded you should be able to select your LaMetric and send it messages.

Personally, the Notifier app was a little too limited. It was probably user error but it did not seem to allow for variables in messages so all I could do is send a generic "something is on" which was not particularly useful at all.

I ended up just using Hubitat's built-in "Notifier" app instead (Rule Machine also works). For syntax you can skim the web api link @ngcard posted above.

To save others a little time here is a Custom Message I threw together initially that worked for me:
{"model":{"frames":[{"text":"%device% %value%","icon":"33655"}]}, "priority":"warning"}

Screen Shot 2021-08-23 at 8.39.10 PM


I had an old one of these laying around that someone had gifted me a while back before stumbling across this post so it was worth the effort to get this running but I can't really recommend paying $200 for one of these brand new if all you want is to push it Hubitat notifications as there are much cheaper ways to do that... That being said, once I set it up about two weeks ago it's been pretty solid and have not had a single issue with it so if you have the money and it fills your use case then go for it.

1 Like

Did you manage to get custom text working in the format you suggested? I get the full string on the LaMetric if I do it like that. I also tried the exact phrase as reported (as a custom message) I saw in the Hub activity log when using Non-Custom messages. That also did not work as the full text is also displayed on the Lametric.
(I'm intrigued why these devices are not more popular. To me, they are essential for all home automation setups.)

Had to go double check but yea, it’s working through Hubitat’s built-in Notifier app as well as through Rule Machine.

For the Notify app once you select your LaMetric as the notification device try copy/pasting the example below in the field labeled “Notification message to send” and see if it works for you.


{"priority":"warning","icon_type":"none","model":{"frames":[{"icon":5855,"text":"%device% %value%"}],"sound":{"category":"notifications","id":"positive6","repeat":1},"cycles":1}}

For Rule Machine, after you set your trigger event, select the action “Send, Speak or Log a Message, Send HTTP Request”. Then, in the “Message to send” field, try pasting the example below to see if it works for you.


{"priority":"warning","icon_type":"none","model":{"frames":[{"icon":10025,"text":"%now%"}],"sound":{"category":"notifications","id":"negative1","repeat":1},"cycles":1}}