-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
Add Gryfsmart integration #137753
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
karlowiczpl
wants to merge
21
commits into
home-assistant:dev
Choose a base branch
from
karlowiczpl:gryfsmart
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Add Gryfsmart integration #137753
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
08dc212
Initialise commit
karlowiczpl 5b1f6a9
Initialise commit
karlowiczpl 068d302
Initialise commit
karlowiczpl c611933
Initialise commit
karlowiczpl ed4011e
add sensor platform
karlowiczpl 4409267
add binary sensor platform
karlowiczpl a7db884
1.0
karlowiczpl fc9c7c6
added GryfSmart integration
karlowiczpl ab34997
added GryfSmart integration
karlowiczpl 2c0fd88
added lights platform to GryfSmart
karlowiczpl ab8dbfe
Added light platform to gryfSmart Integration
karlowiczpl 7529baf
Added light platform to gryfSmart Integration
karlowiczpl 4b208a0
Added climate platform for GryfSmart integration
karlowiczpl c6ae577
Merge branch 'dev' into lightPlatform
karlowiczpl 40f725c
Merge branch 'dev' into gryfsmart
karlowiczpl 5cf7f10
GryfSmart comments removed
karlowiczpl 00d26a9
Merge branch 'dev' into gryfsmart
karlowiczpl 5f17d09
Merge branch 'dev' into gryfsmart
karlowiczpl 8e373e6
Merge branch 'dev' into gryfsmart
karlowiczpl 7818756
Merge branch 'dev' into gryfsmart
karlowiczpl 96f0393
Merge branch 'dev' into gryfsmart
karlowiczpl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
"""The Gryf Smart integration.""" | ||
|
||
from __future__ import annotations | ||
|
||
from pygryfsmart.api import GryfApi | ||
|
||
from homeassistant.config_entries import ConfigEntry | ||
from homeassistant.const import Platform | ||
from homeassistant.core import HomeAssistant | ||
from homeassistant.exceptions import ConfigEntryNotReady | ||
|
||
from .const import CONF_API, CONF_COMMUNICATION, CONF_DEVICE_DATA, CONF_PORT, DOMAIN | ||
|
||
_PLATFORMS: list[Platform] = [ | ||
Platform.LIGHT, | ||
] | ||
|
||
|
||
async def async_setup_entry( | ||
hass: HomeAssistant, | ||
entry: ConfigEntry, | ||
) -> bool: | ||
"""Config flow for Gryf Smart Integration.""" | ||
|
||
try: | ||
api = GryfApi(entry.data[CONF_COMMUNICATION][CONF_PORT]) | ||
await api.start_connection() | ||
api.start_update_interval(1) | ||
except ConnectionError: | ||
raise ConfigEntryNotReady("Unable to connect with device") from ConnectionError | ||
|
||
entry.runtime_data = {} | ||
entry.runtime_data[CONF_API] = api | ||
entry.runtime_data[CONF_DEVICE_DATA] = { | ||
"identifiers": {(DOMAIN, "Gryf Smart", entry.unique_id)}, | ||
"name": f"Gryf Smart {entry.unique_id}", | ||
"manufacturer": "Gryf Smart", | ||
"model": "serial", | ||
"sw_version": "1.0.0", | ||
"hw_version": "1.0.0", | ||
} | ||
Comment on lines
+34
to
+41
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't need to store this one in here |
||
|
||
await hass.config_entries.async_forward_entry_setups(entry, _PLATFORMS) | ||
|
||
return True | ||
|
||
|
||
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: | ||
"""Unload a config entry.""" | ||
|
||
return await hass.config_entries.async_unload_platforms(entry, _PLATFORMS) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extend the config entry type and add the data you put in entry.runtime_data there