Skip to content

Commit

Permalink
feat: Update doc, version number and add a license on principle.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesse Sopel committed Jun 2, 2021
1 parent 4d7bcba commit 1344a9f
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.coverage
env/
__pycache__/

.idea/
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019 Custom cards for Home Assistant

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
77 changes: 71 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
# Ember Mug Integration for Home Assistant
# [Ember Mug Integration for Home Assistant](https://github.com/sopelj/hass-ember-mug-component)

[![GitHub Release](https://img.shields.io/github/release/sopelj/hass-ember-mug-component.svg?style=for-the-badge)](https://github.com/sopelj/hass-ember-mug-component/releases)
[![License](https://img.shields.io/github/license/sopelj/hass-ember-mug-component.svg?style=for-the-badge)](LICENSE.md)
[![hacs_badge](https://img.shields.io/badge/HACS-Custom-orange.svg?style=for-the-badge)](https://github.com/custom-components/hacs)
![Project Maintenance](https://img.shields.io/maintenance/yes/2021.svg?style=for-the-badge)

Custom integration for the Ember Mug in Home Assistant.
I only have the Ember Mug 2, but in theory it should be the same with other Ember Mugs.

This is still a work in progress, but seems to be working for reading information at least.
Although, I'm not sure what impact it has on battery.

The protocol is not public, so there is quite a bit of guesswork involved.
[@orlopau](https://github.com/orlopau) has documented the most important [UUIDs here](https://github.com/orlopau/ember-mug)
Some of it I had to get from the Android App.

This is still a work in progress, but seems to be working for reading information at least.

## Installation

Expand All @@ -25,5 +30,65 @@ sensors:
temperature_unit: "C" # Optional: Default [C]
```
For some reason, when Home Assistant boots up it will only pair with the mug if it is in pairing mode.
So, for now at least, when Home Assistant restarts you need to put your mug into pairing mode for it to be detected again. (Hold down 5 seconds until light flashes blue)
### Caveats / known issues:
- The services to change mug values fail with a bluetooth permission error, that I can't figure out yet.
- If you have another device paired with it like your phone it will cause it to disconnect, so you need to remove it from that device.
- If it won't connect you may need to go back into pairing mode (Hold down 5 seconds until light flashes blue).
- This maintains a connection to your mug which:
- may affect battery
- may interfere with other local bluetooth integrations as it can only maintain one connection at a time.
## Automations:
If you want to have notifications similar to the app you can do something like:
```yaml
automation:
- id: mug_filled
alias: Mug Filled
trigger:
- platform: state
entity_id: sensor.jesse_s_ember_mug # your mug entity
attribute: liquid_state
from: "Empty"
to:
- "Filling"
- "Heating"
- "Cooling"
action:
service: notify.mobile_app_jesse_s_pixel_4a # Mobile device notify or other action
data:
message: Your mug has been filled

- id: mug_temp_right
alias: Mug Temp is right
trigger:
- platform: state
entity_id: sensor.jesse_s_ember_mug # your mug entity
attribute: liquid_state
from:
- "Heating"
- "Cooling"
to: "Perfect"
action:
service: notify.mobile_app_jesse_s_pixel_4a # Mobile device notify or other action
data_template:
message: "Your mug is at the desired {{ states('sensor.jesse_s_ember_mug') }}."

- id: mug_battery_warning
alias: Mug Battery Low
trigger:
- platform: numeric_state
entity_id: sensor.jesse_s_ember_mug # your mug entity
value_template: "{{ state.attributes.battery_level }}"
below: 20
attribute: "battery_level"
for:
minutes: 10
action:
service: notify.mobile_app_jesse_s_pixel_4a # Mobile device notify or other action
data_template:
message: "Your mug battery is low ({{ state_attr('sensor.jesse_s_ember_mug', 'battery_level') }}%)."

```
3 changes: 2 additions & 1 deletion custom_components/ember_mug/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
"documentation": "https://github.com/sopelj/hass_ember_mug",
"domain": "ember_mug",
"name": "Ember Mug",
"requirements": ["bleak", "pygatt[GATTTOOL]"]
"version": "0.1.0",
"requirements": ["bleak==0.11.0"]
}
3 changes: 2 additions & 1 deletion custom_components/ember_mug/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ async def async_setup_platform(
config: ConfigType,
async_add_entities: Callable,
discovery_info: Optional[DiscoveryInfoType] = None,
) -> None:
) -> bool:
"""Add Mug Sensor Entity to HASS."""
from .services import set_led_colour, set_target_temp, set_mug_name

Expand All @@ -86,6 +86,7 @@ async def async_setup_platform(
platform.async_register_entity_service(
SERVICE_SET_MUG_NAME, SET_MUG_NAME_SCHEMA, set_mug_name
)
return True


async def async_setup_entry(hass: HomeAssistantType, config: ConfigType):
Expand Down
1 change: 1 addition & 0 deletions hacs.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "Ember Mug",
"render_readme": true,
"version": "0.1.0",
"iot_class": "Local Polling",
"requirements": [
"bleak==0.11.0"
Expand Down

0 comments on commit 1344a9f

Please sign in to comment.