Skip to content
This repository was archived by the owner on Jan 24, 2023. It is now read-only.

Commit 1ae6eb7

Browse files
authored
Merge pull request #14 from custom-components/multi-user
🍺 Unique sensor names based on userid
2 parents 13e9c32 + 796778d commit 1ae6eb7

4 files changed

Lines changed: 31 additions & 30 deletions

File tree

README.md

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
11
# Untappd
2-
3-
[![Version](https://img.shields.io/badge/version-0.0.9-green.svg?style=for-the-badge)](#) [![mantained](https://img.shields.io/maintenance/yes/2018.svg?style=for-the-badge)](#)
42

5-
[![maintainer](https://img.shields.io/badge/maintainer-Peter%20Skopa%20%40swetoast-blue.svg?style=for-the-badge)](#) [![maintainer](https://img.shields.io/badge/maintainer-Ian%20Richardson%20%40iantrich-blue.svg?style=for-the-badge)](#)
3+
[![Version](https://img.shields.io/badge/version-0.1.1-green.svg?style=for-the-badge)](#) [![mantained](https://img.shields.io/maintenance/yes/2018.svg?style=for-the-badge)](#)
64

5+
[![maintainer](https://img.shields.io/badge/maintainer-Peter%20Skopa%20%40swetoast-blue.svg?style=for-the-badge)](#) [![maintainer](https://img.shields.io/badge/maintainer-Ian%20Richardson%20%40iantrich-blue.svg?style=for-the-badge)](#)
76

8-
Checks your untappd info and keeps you updated from home-assistant and your wishlist that can be automated to send the list to your phone when your at the bar if you set it up right. Use the [beer card](https://github.com/ciotlosm/custom-lovelace/tree/master/beer-card) to display the wishlist its made by [Ciotlosm](https://github.com/ciotlosm)
97

10-
Like this component for home-assistant?
8+
Get Untappd last badge, check-in, wishlist and more in Home Assistant. You can also use the [beer card](https://github.com/ciotlosm/custom-lovelace/tree/master/beer-card) by [ciotlosm](https://github.com/ciotlosm) or the [list-card](https://github.com/custom-cards/list-card) by [iantrich](https://github.com/iantrich) to display your wishlist in Lovelace.
119

10+
## Like this component for home-assistant?
1211

12+
@swetoast
1313
<div style="text-align: center">
1414
<a href="https://www.paypal.me/swetoast">
1515
<img src="http://www.libertymachinenews.com/uploads/5/8/4/3/58432585/7594747_orig.png" width="300" />
1616
</a>
1717
</div>
1818

19+
@iantrich
20+
[![coffee](https://www.buymeacoffee.com/assets/img/custom_images/black_img.png)](https://www.buymeacoffee.com/zJtVxUAgH)
1921

22+
To get started put `/custom_components/sensor/untappd.py` here:
23+
`<config directory>/custom_components/sensor/untappd.py`
2024

21-
To get started put `/custom_components/sensor/untappd.py` here:
22-
`<config directory>/custom_components/sensor/untappd.py`
23-
2425
**Example configuration.yaml:**
2526
```yaml
2627
sensor:
@@ -29,16 +30,16 @@ sensor:
2930
id: FSDJLKHDF786287UGHLE
3031
secret: FJKSDLHKS8337R6948F
3132
```
32-
**Configuration variables:**
33-
34-
key | description
35-
:--- | :---
36-
**platform (Required)** | untappd
37-
**id (Required)** | Your Untappd API id.
38-
**secret (Required)** | Your Untappd API secret.
39-
**username (Required)** | The username of the Untappd user, you want updates for.
40-
41-
You will need to apply for an [API from Untappd](https://untappd.com/api) to use this.
42-
33+
**Configuration variables:**
34+
35+
key | description
36+
:--- | :---
37+
**platform (Required)** | untappd
38+
**id (Required)** | Your Untappd API id.
39+
**secret (Required)** | Your Untappd API secret.
40+
**username (Required)** | The username of the Untappd user, you want updates for.
41+
42+
You will need to apply for an [API from Untappd](https://untappd.com/api) to use this.
43+
4344
***
4445
Due to how `custom_componentes` are loaded, it is normal to see a `ModuleNotFoundError` error on first boot after adding this, to resolve it, restart Home-Assistant.

custom_components/sensor/untappd.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
REQUIREMENTS = ['pyuntappd==0.0.5']
1818

19-
__version__ = '0.1.0'
19+
__version__ = '0.1.1'
2020

2121
_LOGGER = logging.getLogger(__name__)
2222

@@ -83,7 +83,7 @@ def __init__(self, username, api_id, api_secret):
8383

8484
def update(self):
8585
current_date = parser.parse(str(datetime.now())).replace(tzinfo=None)
86-
result = self._untappd.get_last_activity(self._apiid,
86+
result = self._untappd.get_last_activity(self._apiid,
8787
self._apisecret, self._username)
8888
if not result :
8989
return False
@@ -101,7 +101,7 @@ def update(self):
101101
self._score = str(result['rating_score'])
102102
self._picture = result['beer']['beer_label']
103103
self._abv = str(result['beer']['beer_abv']) + '%'
104-
result = self._untappd.get_info(self._apiid,
104+
result = self._untappd.get_info(self._apiid,
105105
self._apisecret, self._username)
106106
if not result :
107107
return False
@@ -113,10 +113,10 @@ def update(self):
113113
self._total_friends = result['stats']['total_friends']
114114
self._total_followings = result['stats']['total_followings']
115115
self._total_photos = result['stats']['total_photos']
116-
116+
117117
@property
118118
def name(self):
119-
return 'Untappd Last Check-in'
119+
return 'Untappd Last Check-in (' + self._username + ')'
120120

121121
@property
122122
def entity_picture(self):
@@ -159,7 +159,7 @@ def __init__(self, hass, username, api_id, api_secret):
159159
self.update()
160160

161161
def update(self):
162-
result = self._untappd.get_wishlist(self._apiid,
162+
result = self._untappd.get_wishlist(self._apiid,
163163
self._apisecret, self._username)
164164
if not result :
165165
return False
@@ -185,7 +185,7 @@ def update(self):
185185

186186
@property
187187
def name(self):
188-
return 'Untappd On The Wishlist'
188+
return 'Untappd Wishlist (' + self._username + ')'
189189

190190
@property
191191
def state(self):
@@ -212,7 +212,7 @@ def __init__(self, hass, username, api_id, api_secret):
212212

213213

214214
def update(self):
215-
result = self._untappd.get_badges(self._apiid,
215+
result = self._untappd.get_badges(self._apiid,
216216
self._apisecret, self._username)
217217
if not result or len(result) < 1 :
218218
return False
@@ -234,7 +234,7 @@ def update(self):
234234

235235
@property
236236
def name(self):
237-
return 'Untappd Last Badge'
237+
return 'Untappd Last Badge (' + self._username + ')'
238238

239239
@property
240240
def entity_picture(self):

custom_updater.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"sensor.untappd": {
33
"updated_at": "",
4-
"version": "0.0.8",
4+
"version": "0.1.1",
55
"local_location": "/custom_components/sensor/untappd.py",
66
"remote_location": "https://raw.githubusercontent.com/custom-components/sensor.untapped/master/custom_components/sensor/untappd.py",
77
"visit_repo": "https://github.com/custom-components/sensor.untapped",

root.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"untappd": {
33
"component": "sensor",
4-
"version": "0.0.1",
4+
"version": "0.1.1",
55
"mantained": "yes",
66
"author": "Peter Skopa @swetoast",
77
"added_to_ha": "false",

0 commit comments

Comments
 (0)