Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Introduced a new device class "plug" for the binary sensor. #558

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

Merged
merged 2 commits into from
Nov 5, 2017

Conversation

echox
Copy link
Contributor

@echox echox commented Nov 4, 2017

Based on #550 this is my suggestion for a new binary sensor device class.
I will use it to monitor the state of pluged/unplugged sonoff switches but it could be used for other wireless switchable sockets.

@homeassistant
Copy link
Contributor

Hi @echox,

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

@@ -26,7 +26,7 @@
window.hassUtil.DOMAINS_WITH_MORE_INFO = [
'alarm_control_panel', 'automation', 'camera', 'climate', 'configurator',
'cover', 'fan', 'group', 'history_graph', 'light', 'lock', 'media_player', 'script',
'sun', 'updater', 'vacuum', 'input_datetime',
'sun', 'updater', 'vacuum', 'input_datetime', 'plug',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'plug' is not a home assistant domain.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I removed it from there.

@MartinHjelmare
Copy link
Member

You will also need to update the following module and make a PR to the backend repo.
https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/binary_sensor/__init__.py

@echox
Copy link
Contributor Author

echox commented Nov 4, 2017

@MartinHjelmare Thanks for the hint.
I've added it to the backend repo and created a PR: home-assistant/core#10336

@MartinHjelmare
Copy link
Member

Good! A frontend developer will need to make a proper review here, so stay tuned.

@@ -385,6 +385,8 @@
case 'safety':
case 'smoke':
return activated ? 'mdi:verified' : 'mdi:alert';
case 'plug':
return activated ? 'mdi:power-plug-off' : 'mdi:power-plug';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is reverse. When it is activated it should show plugged.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This whole function has a reversed name:
var activated = state.state && state.state === 'off';

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's weird

@balloob balloob merged commit ba5f401 into home-assistant:master Nov 5, 2017
@github-actions github-actions bot locked and limited conversation to collaborators Jul 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants