Skip to content

Commit

Permalink
Add peanut label
Browse files Browse the repository at this point in the history
  • Loading branch information
beaufortfrancois committed Jun 28, 2017
1 parent 86ee455 commit 3dd9b64
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion web-bluetooth/sense-peanut/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,19 @@ web app. Look at the `index.html` file and update the JavaScript constant
const MY_PEANUTS = {
'00:A0:50:46:06:1A': {
'color': 'orange',
'label': '46:06:1A',
'type': 'guard',
'factoryKey': 'e4e7ba283c9e524bc559c51a27f388f0',
},
'00:A0:50:0C:11:08': {
'color': 'blue',
'label': '0C:11:08',
'type': 'thermo',
'factoryKey': '2cd1d05935bfb2138f346bb24b9cbc23',
},
'00:A0:50:06:13:18': {
'color': 'green',
'label': '06:13:18',
'type': 'thermo',
'factoryKey': 'ebaed4451f6e8bcc0f84a8c3d3574a8c',
}
Expand All @@ -35,4 +38,3 @@ const MY_PEANUTS = {
You can grab all these useful information from
https://sen.se/developers/peanutkeys/ if you already have a Sen.se Developer
Account and added your peanut into the official app.

6 changes: 5 additions & 1 deletion web-bluetooth/sense-peanut/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,19 @@
const MY_PEANUTS = {
'00:A0:50:46:06:1A': {
'color': 'orange',
'label': '46:06:1A',
'type': 'guard',
'factoryKey': 'e4e7ba283c9e524bc559c51a27f388f0',
},
'00:A0:50:0C:11:08': {
'color': 'blue',
'label': '0C:11:08',
'type': 'thermo',
'factoryKey': '2cd1d05935bfb2138f346bb24b9cbc23',
},
'00:A0:50:06:13:18': {
'color': 'green',
'label': '06:13:18',
'type': 'thermo',
'factoryKey': 'ebaed4451f6e8bcc0f84a8c3d3574a8c',
}
Expand All @@ -95,6 +98,7 @@
peanut.factoryKey = MY_PEANUTS[macAddress].factoryKey;
peanut.mac = macAddress;
peanut.type = MY_PEANUTS[macAddress].type;
peanut.label = MY_PEANUTS[macAddress].label;
})
.then(_ => peanut.getPlainText())
.then(clearText => peanut.setFactoryCipher(peanut.factoryKey, clearText))
Expand All @@ -111,7 +115,7 @@
newButton.classList.add('mdl-button', 'mdl-js-button');
newButton.dataset.mac = peanut.mac;
newButton.dataset.color = peanut.color;
newButton.textContent = peanut.mac.substr(9, 8);
newButton.textContent = peanut.label;
newButton.addEventListener('click', onConnectButtonClick);
$('#buttons').appendChild(newButton);
peanut.rgbColor = window.getComputedStyle(newButton).color;
Expand Down

0 comments on commit 3dd9b64

Please sign in to comment.