LAMetric 3P Plugin - Beta

Getting Started

This is a HomeSeer HS3 plugin for the ‘LAMetric Time’ line of smart clock dispaly units (http://lametric.com/), this plugin has been developed using the LAMetric Time LOCAL API, it does not utilise any of their cloud services and instead talks to your device on the LAN rather than relying on a cloud service. This plugin is to be installed from the updater as any other plugin, unless running the plugin remotely (see later) then HSPI_LAMETRIC3P.exe should be placed inside the main HS directory by the updater. Once the files have been installed by the updater then in the HomeSeer UI go into the Plug-ins > Manage page, you should now see the LAMetrc Time plugin in the list of plugins. Please now enable this plugin by clicking the switch as you would any other plugin.

Upon enabling the plugin you should see some entries in the HomeSeer log similar to this:


Jan-02 21:27:45         Plug-In        Finished initializing plug-in LaMetric 3P
Jan-02 21:27:45         LaMetric 3P        No IP Address Specified In INI File - Please Update
Jan-02 21:27:45         LaMetric 3P        Getting IP Address For Instance
Jan-02 21:27:45         LaMetric 3P        Connection Worker Thread Started
Jan-02 21:27:45         LaMetric 3P        Icons In Table: 1
Jan-02 21:27:45         LaMetric 3P        Adding Icons To Table
Jan-02 21:27:45         LaMetric 3P        Registering Web Pages
Jan-02 21:27:45         LaMetric 3P        Devices Exist For Instance: False
Jan-02 21:27:44         LaMetric 3P        LAMetric Time Plugin Started
Jan-02 21:27:44         Info                Plugin LaMetric 3P has connected. IP:127.0.0.1:39388

As the HomeSeer log suggests, the IP address and also an API key needs to be set for HomeSeer to communicate with the LAMetric Time device. Please go into Plugins > LAMetric 3P  > LAMetric 3P page and you should find two tabs labelled Home and Settings. Please click Settings and you should find a page similar to this:

These fields are fairly self explanatory, the instance name will report as ‘Default’ if you have no instance name passed to the plugin. The next field is for the IP address of the LAMetric unit and then the API key (see next chapter). The plugin establishes a connection with the LAMetric unit that is opened whenever the plugin either needs to query the unit or send a notification. Once you have entered the required details please press Update Changes, you will see little change in the UI but please now look in the HomeSeer log. If you have established a connection with your LAMetric unit then the HomeSeer log will contain entries looking like:


Jan-02 21:33:38         LaMetric 3P        LAMetric Time Device Connection Success
Jan-02 21:33:38         LaMetric 3P        WiFi Strength: 100%
Jan-02 21:33:38         LaMetric 3P        Device ID: 4241
Jan-02 21:33:38         LaMetric 3P        Device Name: LM5844
Jan-02 21:33:37         LaMetric 3P        API Key Discovered: f261b85edfd48f6b9749422103
Jan-02 21:33:37         LaMetric 3P        IP Address Discovered: 192.168.1.97
Jan-02 21:33:37         LaMetric 3P        Getting IP Address For Instance
Jan-02 21:33:37         LaMetric 3P        Connection Worker Thread Started

Please check whether or not the plugin reports that it established a connection and whether or not you have the entry marked as device connection success, if you have then the plugin should now be ready to communicate with.

Devices

HomeSeer will create a group of three basic devices for the plugin, these devices in the main will be self explanatory. You should find that the devices look as follows:

  1. Root Device - This device has limited function but will change it’s state to ‘Error’ if there are communication issues between the plugin and the LAMetric Time unit.
  2. Audio Setting - This device controls the audio level of the LAMetric device, minimum is essentially mute and maximum is 100%
  3. Brightness - The LAMetric device if left set to Automatic will use it’s own light sensor to determine the light level on the basis of the background light levels, setting to anything else will manually change the brightness of the display.
  4. Application Switch - This device is new as per plugin version .7, this device allows you to move between applications being displayed on the unit

All devices contain value/graphics pairs that have been taken from the HomeSeer contemporary image set. You are free to change them to whatever images you feel suitable by editing the pairs in the plugin pages. All of the devices should change status and can be used in events to display screens, obtain images or whatever actions you feel appropriate.

Event Actions/Triggers

There are now (as of version .7) four event actions and no triggers. As the plugin utilises the local LAN API then the ability to send data is more limited than the cloud API. You are able to send notifications to the unit however responding to any button presses on the unit is not possible.  The information for this is contained in the API documentation - http://lametric-documentation.readthedocs.io/en/latest/reference-docs/device-notifications.html 

The event action will look like this;

The first drop down will enable you to determine what sort of message you wish to send, the options are either a simple frame (just text or text and an icon), a spike frame (a comma separated list of numbers to display as a chart) or a goal. The goal will have a start, current, end and unit that will show as a tracker. The rest of the options are relatively easy to understand, when finished ensure you press the update button before attempting to collapse the event. The plugin now has support for multiple frame messages, the single frame actions are still retained

Application Specific Actions

The API for the LAMetric now supports both moving between applications, activating a specific application or sending data to an application. As such it should now be possible to do things like set the alarm clock, set a countdown clock, display the weather forecast etc by HomeSeer event action.

Please be aware that I cannot test every app in the LAMetric app store, there may be some apps that have unusual actions that expect different data - if you encounter an issue please inform me and I’ll do my best to try and fix it but I can make no assurances that I will get it working.

The new actions look like this;

Once you have inputted the required data for the particular action then ensure you press the update button before collapsing the event.

Issues/Warnings

Indicator Application Functions (Version 0.0.0.10 or later)

Please note that this function will involve using the LAMetric Cloud Service - it is NOT a local connection

The plugin as it currently stands supports notification applications, this means that when an event happens and you send the event action the notification will appear straight away on the LAMetric device. LAMetric support a different kind of application called indicator applications, these are the standard applications that are on the device that are similar to the weather, news or email display applications that you download from the store. I have now (0.0.0.10 or later) added the ability to be able to send data to an application from a HomeSeer event, this means that you can have your own application to display data much the same way as the weather data or similar. Please note that setup of these is not always straightforward and please pay close attention to the following;

  1. Create an application at the developer.lametric.com address, you need to create an ‘Indicator App’ available at the following;

  1. Create the application and specify the structure (how many frames and what type - whether they be simple, goal or spark line) - please note that it does appear that problems can arise if you later try and change this and get a new app published as the URL’s change
  2. In the communication type select ‘push’ rather than ‘pull’, copy the ‘URL for pushing data’ into notepad or similar as this will need to be inputted into the plugin at a later stage
  3. I would highly recommend that you make the application private (on the store info page) else other users may install your application and end up with you updating the data on their device.
  4. When you create the application the following screen will have an access token on it, again you need this access token to use in the plugin so keep this page open. The page will look like this;

  1. You will then need to publish the application, click publish on the top left and you should then get an email advising that it is published (and it will be privately available to you)
  2. You can then add the application by the LAMetric app to your device in much the same way as any other application

In HomeSeer you will now have an additional event action to push data to a LAMetric application, before you make any attempt to create an event you will need to add this application to the plugin. Go into the plugin settings page and you should now have some additional fields at the bottom of the page, please enter a local name for the application (this is only used in HomeSeer so you are aware of which application you are updating) and then the URL/application token in exactly the same format as given to you on the LAMetric website. The dialog box above should then update with the application details (with a truncated URL), if you open the LAMetric.ini file you will also see that the data has been added to this file.

Now you should be able to send data to your application and this will be done by an event. This event should be run whenever you wish to update the data however I would recommend that the event is structured in such a way that it cannot send data at a high rate (the API document does not specify however setting the cannot retrigger event property is probably the safest way to achieve this). It does appear that the structure sent by HS should be similar to that the application was initially setup, if you only set a single frame of text it will not update if you then attempt to send a chart to the unit. If you have set up the app to have a single text frame followed by a chart then your HS event should mirror this.

When you send the data to the device please check the HS log that you have been able to send the data and then it should (when the application next revolves on the LAMetric device) display your updated data.

This functionality is still potentially in it’s early stages so please report any issues on the forum.

Scripting Functions

There are no functions available in the plugin in terms of scripting, this is because of the existing functions available in the events and the fact that the event actions are relatively complex. If there is a specific function requested then this can be considered.

Icons

By default there is only one icon added when the plugin loads (which is actually no icon), because of the difficulties in implementing a icon editor then I have decided to add a method to download an icon from the official list of icons. If there is an icon you wish to add to the plugin then please go to the official icon page here https://developer.lametric.com/icons

Pick a list of icons you wish to include and note down their numbers, also note down whether or not they are animated. Then open up the LAMetric.ini file in the HomeSeer config directory. Add a section labelled [Icons] and then a line marked IconList. The format of the list of icons to download is a comma separated list with the starting letter being ‘m’ for moving or ‘s’ for static. Then add the line like this;

[Icons]IconList=m4584,s37,m2867

When the plugin then is re-loaded it will look to download the icons with those particular numbers and then it will save the data for that icon inside a table within the plugin. When you load the plugin it should display a count of the downloaded icons.

Getting an API Key

The plugin requires an API key from LAMetric before you attempt to communicate with it, log into the LAMetric site and go to https://developer.lametric.com/user/devices - you should be presented with a screen similar to this, please press Devices and copy the API key.

This API key needs to be copied and inserted into the API key box on the plugin settings page.

Issues

Please post any issues/comments/requests to the appropriate HomeSeer message board thread and I will try and answer them accordingly - https://board.homeseer.com/showthread.php?p=1285244