Skip to content

Commit

Permalink
Added custom clockface configuration and countdown configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
klein0r committed Jan 1, 2021
1 parent 860eed6 commit dee2b76
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 5 deletions.
24 changes: 21 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ You can get your personal key [here](https://developer.lametric.com/).
- Activate/Deactivate bluetooth and change bluetooth name
- Switch between apps (next, previous, go to specific app)
- Send notifications with blockly (with configurable priority, sound, icons, text, ...)
- Control special apps like radio, stopwatch or weather
- Control special apps like clock, radio, stopwatch or weather
- Use *My Data (DIY)* LaMetric App to display persistent information

Features are limited by the [official API features](https://lametric-documentation.readthedocs.io/en/latest/reference-docs/lametric-time-reference.html).
Expand All @@ -50,7 +50,7 @@ If you want to use chart frames, you have to specify an array of numbers as a fr

![chart data frames](docs/blockly3.png)

## My Data (DIY)
## My Data (DIY) *(version > 1.1.0)*

LaMetric offers an app (on the integrated app market) to poll custom data. This app is called [My Data DIY](https://apps.lametric.com/apps/my_data__diy_/8942). This adapter creates a new state in the required format.
You can use the Simple API Adapter to transfer the data to the LaMetric Time.
Expand Down Expand Up @@ -85,7 +85,7 @@ http://172.16.0.219:8087/getPlainValue/lametric.0.mydatadiy.obj/

**Ensure to update IP and port in the URL if necessary!**

### Frame Configuration
### Frame Configuration *(version > 1.1.0)*

- Use the plus icon to add as many frames as you want
- Icon: Choose an icon from the [official website](https://developer.lametric.com/icons) and put the ID in the configuration field. **Important: Add an i (for static icons) or an a (for animated icons) as a prefix for that ID. (Example: `i3389`)
Expand All @@ -95,6 +95,23 @@ Example configuration of 2 frames:

![example frame config](docs/myDataDIYConfig.png)

## Special Apps / Widgets *(version > 1.1.2)*

You can control some apps with custom information

### clock.clockface

Allowed values are:

- one of `weather`, `page_a_day`, `custom` or `none`
- custom icon data in format `data:image/png;base64,<base64 encoded png binary>` or `data:image/gif;base64,<base64 encoded gif binary>`

Example: `data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAOklEQVQYlWNUVFBgwAeYcEncv//gP04FMEmsCmCSiooKjHAFMEF0SRQTsEnCFcAE0SUZGBgYGAl5EwA+6RhuHb9bggAAAABJRU5ErkJggg==`

### countdown.configure

Allowed value: Time in seconds

## Scripts

To show the message on your la metric just send a message to this instance with script adapter:
Expand Down Expand Up @@ -180,6 +197,7 @@ show();
### 1.1.2

* (klein0r) Delete app channels if app was deleted on LaMetric
* (klein0r) Custom app configuration (clockface, countdown duration)

### 1.1.1

Expand Down
56 changes: 54 additions & 2 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,12 +252,39 @@ class LaMetric extends utils.Adapter {
const data = { id: action };

// START special Widgets
if (action == 'countdown.configure') {

if (action == 'clock.clockface') {

if (['weather', 'page_a_day', 'custom', 'none'].indexOf(state.val) > -1) {

data.params = {
type: state.val
};

} else {

data.params = {
icon: state.val,
type: 'custom'
};

}

data.activate = true;

this.setState(id, {val: state.val, ack: true}); // Confirm state change

} else if (action == 'countdown.configure') {

data.params = {
duration: state.val,
start_now: false
};

this.setState(id, {val: state.val, ack: true}); // Confirm state change

}

// END special Widgets

this.buildRequest(
Expand Down Expand Up @@ -576,7 +603,32 @@ class LaMetric extends utils.Adapter {
this.setState(path + uuid + '.version', {val: pack.version, ack: true});

// START special Widgets
if (pack.package === 'com.lametric.radio') {

if (pack.package === 'com.lametric.clock') {

this.setObjectNotExists(path + uuid + '.clock', {
type: 'channel',
common: {
name: pack.package,
role: ''
},
native: {}
});

this.setObjectNotExists(path + uuid + '.clock.clockface', {
type: 'state',
common: {
name: 'Clockface (Base64)',
type: 'string',
role: 'value',
read: true,
write: true
},
native: {}
});

} else if (pack.package === 'com.lametric.radio') {

this.setObjectNotExists(path + uuid + '.radio', {
type: 'channel',
common: {
Expand Down

0 comments on commit dee2b76

Please sign in to comment.