-
-
Notifications
You must be signed in to change notification settings - Fork 4
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
Updated Light & Switch Functionality #4
Open
FyrbyAdditive
wants to merge
14
commits into
jamesridgway:main
Choose a base branch
from
FyrbyAdditive:fiddle
base: main
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.
Conversation
This file contains 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
…hich are more home-assistanty
…s of icons for usage without text overlay, change icon naming convention
…small optimisations
Add a list of available light icons.
Formatting fix
Updated to include switch related changes
jamesridgway
approved these changes
Apr 22, 2023
jamesridgway
requested changes
Apr 22, 2023
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.
HI @timtimellis
Thanks for this! I'd really like to get this merged, but I've just realised that tests fail for me:
================================================================================== FAILURES ===================================================================================
______________________________________________________________ TestLightToggleControl.test_initialize_sets_icon _______________________________________________________________
self = <tests.devdeck_home_assistant.test_light_toggle_control.TestLightToggleControl object at 0x7f4ed457f1f0>
@vcr.use_cassette('tests/fixtures/test_light_toggle/test_initialize_sets_icon.yaml')
def test_initialize_sets_icon(self):
settings = {
'api_key': 'my_secret_api_key',
'entity_id': 'light.light1',
'url': 'https://homeassistant:8123',
'redraw_interval': 0.1
}
self.control = LightToggleControl(0, **settings)
with mock_context(self.control) as ctx:
self.control.initialize()
> assert_rendered(ctx, TestingUtils.get_filename('../devdeck_home_assistant/assets/mdi/lightbulb-on.png'))
tests/devdeck_home_assistant/test_light_toggle_control.py:23:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
ctx = <devdeck_core.deck_context.DeckContext object at 0x7f4ed4402f70>
image_filename_or_renderer = '/home/james/projects/devdeck-home-assistant/devdeck_home_assistant/assets/mdi/lightbulb-on.png'
def assert_rendered(ctx, image_filename_or_renderer):
if isinstance(image_filename_or_renderer, str):
> assert_that(ImageChops.difference(ctx.get_image(), Image.open(image_filename_or_renderer)
.convert('RGB')).getbbox()).is_none()
E TypeError: not all arguments converted during string formatting
venv/lib/python3.8/site-packages/devdeck_core/mock_deck_context.py:16: TypeError
---------------------------------------------------------------------------- Captured log teardown ----------------------------------------------------------------------------
WARNING urllib3.connection:connection.py:547 Certificate did not match expected hostname: homeassistant. Certificate: {'subject': ((('commonName', 'homeassistant.home.jamesridg
way.co.uk'),),), 'issuer': ((('countryName', 'US'),), (('organizationName', "Let's Encrypt"),), (('commonName', 'R3'),)), 'version': 3, 'serialNumber': '04AA26D42C300E41F194F0BE
F3E200633991', 'notBefore': 'Mar 18 20:29:37 2023 GMT', 'notAfter': 'Jun 16 20:29:36 2023 GMT', 'subjectAltName': (('DNS', 'homeassistant.home.jamesridgway.co.uk'),), 'OCSP': ('
http://r3.o.lencr.org',), 'caIssuers': ('http://r3.i.lencr.org/',)}
ERROR devdeck:call_service_control.py:48 Cannot redraw key 0: HTTPSConnectionPool(host='homeassistant', port=8123): Max retries exceeded with url: /api/states/light.light1 (C
aused by SSLError(CertificateError("hostname 'homeassistant' doesn't match 'homeassistant.home.jamesridgway.co.uk'")))
____________________________________________________________ TestLightToggleControl.test_initialize_sets_icon_off _____________________________________________________________
self = <tests.devdeck_home_assistant.test_light_toggle_control.TestLightToggleControl object at 0x7f4ed48236d0>
@vcr.use_cassette('tests/fixtures/test_light_toggle/test_initialize_sets_icon_off.yaml')
def test_initialize_sets_icon_off(self):
settings = {
'api_key': 'my_secret_api_key',
'entity_id': 'light.light1',
'url': 'https://homeassistant:8123',
'redraw_interval': 0.1
}
self.control = LightToggleControl(0, **settings)
with mock_context(self.control) as ctx:
self.control.initialize()
> assert_rendered(ctx, TestingUtils.get_filename('../devdeck_home_assistant/assets/mdi/lightbulb-off.png'))
tests/devdeck_home_assistant/test_light_toggle_control.py:36:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
ctx = <devdeck_core.deck_context.DeckContext object at 0x7f4ed44e89a0>
image_filename_or_renderer = '/home/james/projects/devdeck-home-assistant/devdeck_home_assistant/assets/mdi/lightbulb-off.png'
def assert_rendered(ctx, image_filename_or_renderer):
if isinstance(image_filename_or_renderer, str):
> assert_that(ImageChops.difference(ctx.get_image(), Image.open(image_filename_or_renderer)
.convert('RGB')).getbbox()).is_none()
E TypeError: not all arguments converted during string formatting
Could you take a look please?
Hi - great, sorry work is busy at the moment but I will look at this as soon as I can! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Hi, this is my first time attempting to contribute someone elses project on github! Anyway, here is a summary of the changes:
Thank you for the work on your projects