Skip to content
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

Homematic Support #2366

Closed
wants to merge 224 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
224 commits
Select commit Hold shift + click to select a range
d5d37dc
Added Homematic implementation
Jun 10, 2016
c099874
Added rest I just forgot
danielperna84 Jun 10, 2016
766b8a1
Fixes to pass tox-tests
danielperna84 Jun 11, 2016
25b7221
Added homematic
danielperna84 Jun 11, 2016
f4c8612
Updated requirements_all.txt
danielperna84 Jun 11, 2016
e7f4273
Changes for lint-tests
danielperna84 Jun 11, 2016
e4602ef
Removed pyling.d
danielperna84 Jun 11, 2016
280798d
Added Homematic implementation
Jun 10, 2016
26e29af
Added rest I just forgot
danielperna84 Jun 10, 2016
4cefd2d
Fixes to pass tox-tests
danielperna84 Jun 11, 2016
d3b33ea
Added homematic
danielperna84 Jun 11, 2016
f80f854
Updated requirements_all.txt
danielperna84 Jun 11, 2016
85d1307
Changes for lint-tests
danielperna84 Jun 11, 2016
d40fb29
Removed pyling.d
danielperna84 Jun 11, 2016
fec72b7
Merge branch 'Homematic' of https://github.com/danielperna84/home-ass…
danielperna84 Jun 11, 2016
da271e8
Fixes to pass lint-tests
danielperna84 Jun 11, 2016
d08518a
Re-added configuration examples in docstrings
danielperna84 Jun 11, 2016
a7a2ac3
Added wallbuttons, lots of remotes, better documentation
danielperna84 Jun 12, 2016
3ba0786
Better device-detection. More documentation.
danielperna84 Jun 12, 2016
e12742d
Added note about needed homematic-component to documentation.
danielperna84 Jun 12, 2016
975d734
Fixed lint errors
danielperna84 Jun 12, 2016
c18edfb
fix REQUIREMENTS handling
pvizeli Jun 14, 2016
d94fcb5
fix old style Server handling error
pvizeli Jun 14, 2016
05f15a3
fix E129 linter
pvizeli Jun 14, 2016
b7d043d
fix pylint bad-continuation
pvizeli Jun 14, 2016
451cdba
Merge pull request #2 from pvizeli/Homematic
danielperna84 Jun 14, 2016
cd69956
Removed pyhomematic requirement from lights-component
danielperna84 Jun 14, 2016
0f4311a
Switched to new pyhomematic 0.1.3 as requirement
danielperna84 Jun 14, 2016
34fb6ed
Added pyhomematic
danielperna84 Jun 14, 2016
30e6475
restruct HA-Homematic part 1
pvizeli Jun 20, 2016
6a1d3fb
add attribute support
pvizeli Jun 20, 2016
5a8f5c9
first draft for new homematic
pvizeli Jun 20, 2016
27def92
add support for device discovery
pvizeli Jun 20, 2016
2811957
improve creating names with multible channel/params
pvizeli Jun 21, 2016
6138781
update device support for autodiscovery
pvizeli Jun 21, 2016
482c578
add controll mode support for attribute
pvizeli Jun 21, 2016
df206a9
load data over hm metadata to data struct
pvizeli Jun 21, 2016
ddb957c
cleanup switch device
pvizeli Jun 21, 2016
5186fc8
moded for new homematic support
pvizeli Jun 21, 2016
2d1dc41
switch is now full implemented
pvizeli Jun 21, 2016
9ebf845
first version of sensor for new release
pvizeli Jun 21, 2016
cd21f24
add error handling for better useability
pvizeli Jun 21, 2016
6e8c510
add light support
pvizeli Jun 21, 2016
f736fed
support binary sensor
pvizeli Jun 21, 2016
dd4f945
support binary with multible sensors for state
pvizeli Jun 21, 2016
a403f48
add rollershuter support & add channels to other :)
pvizeli Jun 21, 2016
9843bd6
add support for thermostat
pvizeli Jun 21, 2016
9e932d6
fix a bug
pvizeli Jun 21, 2016
e92dca0
fix bug with autodiscovery & callback
pvizeli Jun 21, 2016
f5ea6e1
div. bugfix
pvizeli Jun 21, 2016
af1a798
fix flake8 errors
pvizeli Jun 21, 2016
245c2d2
fix linter error
pvizeli Jun 21, 2016
f32417f
fix linter bug
pvizeli Jun 21, 2016
8bda632
fix next range of pylinter
pvizeli Jun 21, 2016
8a7713f
try this one...
pvizeli Jun 21, 2016
5c78e73
hmm
pvizeli Jun 21, 2016
e94588b
fix linter
pvizeli Jun 21, 2016
87b70b0
fix a lot of other linter message
pvizeli Jun 21, 2016
857925d
last one...
pvizeli Jun 21, 2016
e448d39
better code style
pvizeli Jun 21, 2016
30148d6
update pyhomatic version & fix bugs
pvizeli Jun 21, 2016
784adf1
false ELEMENT to channel binding
pvizeli Jun 21, 2016
6e6bb92
bugfix and loging info
pvizeli Jun 21, 2016
7adfc4c
fix data load bug
pvizeli Jun 21, 2016
1b7a441
fix event register
pvizeli Jun 21, 2016
9e54500
STATE overwrite all datapoints. big fail
pvizeli Jun 21, 2016
bd44c37
fix _init_data_struct super() bug
pvizeli Jun 21, 2016
d598cc1
fix event subscription calc
pvizeli Jun 21, 2016
f73413e
fix check param
pvizeli Jun 21, 2016
d98efd3
change state over pyhomematic events
pvizeli Jun 21, 2016
0a2b715
error handling
pvizeli Jun 21, 2016
01b36b4
test
pvizeli Jun 21, 2016
1aa15be
fix thread bug in HA
pvizeli Jun 21, 2016
a0b78bc
multible bugfixes
pvizeli Jun 22, 2016
fd65938
fix rolershutterdevice
pvizeli Jun 22, 2016
78b1ac4
make _subscribe_homematic_events more stable
pvizeli Jun 22, 2016
5b98c79
I hope this fix the light/switch bug
pvizeli Jun 22, 2016
57e0534
fix possible dimmer troubles
pvizeli Jun 22, 2016
a46bfc3
possible errors
pvizeli Jun 22, 2016
1641d18
fix linter error
pvizeli Jun 22, 2016
318651d
disable linter check
pvizeli Jun 22, 2016
4100ec3
add unit_of_measurement to sensor
pvizeli Jun 22, 2016
c93c3ee
attribute cast
pvizeli Jun 22, 2016
4e9b285
Merge pull request #4 from pvizeli/Homematic
danielperna84 Jun 22, 2016
e5999ef
Merge remote-tracking branch 'refs/remotes/danielperna84/Homematic' i…
pvizeli Jun 23, 2016
69f10c6
fix bug with HA Events only / remove party mode on thermostat
pvizeli Jun 23, 2016
3064c6d
uups
pvizeli Jun 23, 2016
0594471
fix linter error
pvizeli Jun 23, 2016
d5e2e49
fix bugs
pvizeli Jun 23, 2016
e869021
fix false class in binary sensor
pvizeli Jun 23, 2016
4cc3543
fix state bug
pvizeli Jun 23, 2016
0c93b28
this way is better...
pvizeli Jun 23, 2016
46d912d
reset event in callback
pvizeli Jun 23, 2016
904c86f
add debug log
pvizeli Jun 23, 2016
002cb16
more debug strings
pvizeli Jun 23, 2016
05796a5
add exeption handling
pvizeli Jun 23, 2016
4a913b9
last debug strings
pvizeli Jun 23, 2016
44d88af
fix error
pvizeli Jun 23, 2016
cef4341
fix debug
pvizeli Jun 23, 2016
cfe72fe
bugfix with name creation
pvizeli Jun 23, 2016
95a3d17
catch the error
pvizeli Jun 23, 2016
f17a280
Merge pull request #1 from pvizeli/Homematic_auto
pvizeli Jun 23, 2016
048849e
fix linter
pvizeli Jun 23, 2016
997e93f
add gong sensor support
pvizeli Jun 23, 2016
8d16b91
Merge pull request #8 from pvizeli/Homematic
danielperna84 Jun 23, 2016
3550d7d
fix autodetect
pvizeli Jun 23, 2016
96d8497
it works
pvizeli Jun 23, 2016
e938849
Merge pull request #9 from pvizeli/Homematic
danielperna84 Jun 23, 2016
a6cea9b
hack for don't break the CCU :8ball:
pvizeli Jun 23, 2016
80d1bb0
change from 3 second to 1 second
pvizeli Jun 23, 2016
95ead30
Merge pull request #10 from pvizeli/Homematic
danielperna84 Jun 23, 2016
4575155
Fixed some typos, grammar, edited documentation and comments
danielperna84 Jun 23, 2016
11466df
Fixed some typos, grammar, edited documentation and comments, small b…
danielperna84 Jun 23, 2016
b4b4baf
Updated requirements_all.txt
danielperna84 Jun 23, 2016
eab8bb7
Added Homematic implementation
Jun 10, 2016
4239fe0
Added rest I just forgot
danielperna84 Jun 10, 2016
381572d
Fixes to pass tox-tests
danielperna84 Jun 11, 2016
ae39ffd
Added homematic
danielperna84 Jun 11, 2016
bd8175a
Updated requirements_all.txt
danielperna84 Jun 11, 2016
a28681b
Changes for lint-tests
danielperna84 Jun 11, 2016
5066454
Added Homematic implementation
Jun 10, 2016
9f70722
Added rest I just forgot
danielperna84 Jun 10, 2016
ab9b187
Fixes to pass tox-tests
danielperna84 Jun 11, 2016
f69789f
Updated requirements_all.txt
danielperna84 Jun 11, 2016
fa32a46
Changes for lint-tests
danielperna84 Jun 11, 2016
bf83a21
Removed pyling.d
danielperna84 Jun 11, 2016
38fe492
Fixes to pass lint-tests
danielperna84 Jun 11, 2016
124cc80
Re-added configuration examples in docstrings
danielperna84 Jun 11, 2016
5d5c19b
Added wallbuttons, lots of remotes, better documentation
danielperna84 Jun 12, 2016
4cc529f
Better device-detection. More documentation.
danielperna84 Jun 12, 2016
c793935
Added note about needed homematic-component to documentation.
danielperna84 Jun 12, 2016
b4cf5cf
Fixed lint errors
danielperna84 Jun 12, 2016
d8507f2
fix REQUIREMENTS handling
pvizeli Jun 14, 2016
b30d9c3
fix old style Server handling error
pvizeli Jun 14, 2016
81eeed7
fix E129 linter
pvizeli Jun 14, 2016
617fbd9
fix pylint bad-continuation
pvizeli Jun 14, 2016
d99fb2c
Removed pyhomematic requirement from lights-component
danielperna84 Jun 14, 2016
7d97d06
Switched to new pyhomematic 0.1.3 as requirement
danielperna84 Jun 14, 2016
1d0fc5e
restruct HA-Homematic part 1
pvizeli Jun 20, 2016
a323c5a
add attribute support
pvizeli Jun 20, 2016
d430459
first draft for new homematic
pvizeli Jun 20, 2016
70f370e
add support for device discovery
pvizeli Jun 20, 2016
00e268c
improve creating names with multible channel/params
pvizeli Jun 21, 2016
c91c440
update device support for autodiscovery
pvizeli Jun 21, 2016
fcf143f
add controll mode support for attribute
pvizeli Jun 21, 2016
a21b8c7
load data over hm metadata to data struct
pvizeli Jun 21, 2016
3afc97c
cleanup switch device
pvizeli Jun 21, 2016
a99fccd
moded for new homematic support
pvizeli Jun 21, 2016
7a1e742
switch is now full implemented
pvizeli Jun 21, 2016
3e61cd5
first version of sensor for new release
pvizeli Jun 21, 2016
1b2917b
add error handling for better useability
pvizeli Jun 21, 2016
3f39ec7
add light support
pvizeli Jun 21, 2016
f9a5387
support binary sensor
pvizeli Jun 21, 2016
cd9edc4
support binary with multible sensors for state
pvizeli Jun 21, 2016
5f1a5ea
add rollershuter support & add channels to other :)
pvizeli Jun 21, 2016
5dcc469
add support for thermostat
pvizeli Jun 21, 2016
981c3bd
fix a bug
pvizeli Jun 21, 2016
19f4ec0
fix bug with autodiscovery & callback
pvizeli Jun 21, 2016
b4f7fe6
div. bugfix
pvizeli Jun 21, 2016
309e02a
fix flake8 errors
pvizeli Jun 21, 2016
244d24a
fix linter error
pvizeli Jun 21, 2016
92dcd73
fix linter bug
pvizeli Jun 21, 2016
c1c2445
fix next range of pylinter
pvizeli Jun 21, 2016
24a3215
try this one...
pvizeli Jun 21, 2016
c0a7c18
hmm
pvizeli Jun 21, 2016
63866e9
fix linter
pvizeli Jun 21, 2016
1bfedcc
fix a lot of other linter message
pvizeli Jun 21, 2016
f6da911
last one...
pvizeli Jun 21, 2016
759ede8
better code style
pvizeli Jun 21, 2016
4be52e0
update pyhomatic version & fix bugs
pvizeli Jun 21, 2016
ba67442
false ELEMENT to channel binding
pvizeli Jun 21, 2016
dc88155
bugfix and loging info
pvizeli Jun 21, 2016
a14bd37
fix data load bug
pvizeli Jun 21, 2016
e5bcc2d
fix event register
pvizeli Jun 21, 2016
cf50918
STATE overwrite all datapoints. big fail
pvizeli Jun 21, 2016
262fb62
fix _init_data_struct super() bug
pvizeli Jun 21, 2016
ef6333f
fix event subscription calc
pvizeli Jun 21, 2016
a8a3bf0
fix check param
pvizeli Jun 21, 2016
5055562
change state over pyhomematic events
pvizeli Jun 21, 2016
cf76eec
error handling
pvizeli Jun 21, 2016
3230224
test
pvizeli Jun 21, 2016
7b42a2e
fix thread bug in HA
pvizeli Jun 21, 2016
ae154de
multible bugfixes
pvizeli Jun 22, 2016
e314ac5
fix rolershutterdevice
pvizeli Jun 22, 2016
8d83757
make _subscribe_homematic_events more stable
pvizeli Jun 22, 2016
aba6804
I hope this fix the light/switch bug
pvizeli Jun 22, 2016
3529034
fix possible dimmer troubles
pvizeli Jun 22, 2016
25b3389
possible errors
pvizeli Jun 22, 2016
d55caa5
fix linter error
pvizeli Jun 22, 2016
7eaddf7
disable linter check
pvizeli Jun 22, 2016
45fb6d1
add unit_of_measurement to sensor
pvizeli Jun 22, 2016
5c2a4ad
attribute cast
pvizeli Jun 22, 2016
710fa48
fix bug with HA Events only / remove party mode on thermostat
pvizeli Jun 23, 2016
449da02
uups
pvizeli Jun 23, 2016
99351f6
fix linter error
pvizeli Jun 23, 2016
a9da779
fix bugs
pvizeli Jun 23, 2016
e9a7319
fix false class in binary sensor
pvizeli Jun 23, 2016
e3942b7
fix state bug
pvizeli Jun 23, 2016
90f1d51
this way is better...
pvizeli Jun 23, 2016
6862251
reset event in callback
pvizeli Jun 23, 2016
a52e113
add debug log
pvizeli Jun 23, 2016
3011bac
more debug strings
pvizeli Jun 23, 2016
a66f358
add exeption handling
pvizeli Jun 23, 2016
9272829
last debug strings
pvizeli Jun 23, 2016
b3c0be4
fix error
pvizeli Jun 23, 2016
2d9f67e
fix debug
pvizeli Jun 23, 2016
3364e73
bugfix with name creation
pvizeli Jun 23, 2016
0bb67e6
catch the error
pvizeli Jun 23, 2016
3208a65
fix linter
pvizeli Jun 23, 2016
41f2d01
add gong sensor support
pvizeli Jun 23, 2016
c90358a
fix autodetect
pvizeli Jun 23, 2016
92cb024
it works
pvizeli Jun 23, 2016
3f6dc6a
hack for don't break the CCU :8ball:
pvizeli Jun 23, 2016
a9df146
change from 3 second to 1 second
pvizeli Jun 23, 2016
89294ec
Fixed some typos, grammar, edited documentation and comments
danielperna84 Jun 23, 2016
7862d3e
Fixed some typos, grammar, edited documentation and comments, small b…
danielperna84 Jun 23, 2016
95926d5
Updated requirements_all.txt
danielperna84 Jun 24, 2016
5582a67
Again requirements
danielperna84 Jun 24, 2016
e4f6666
Merge remote-tracking branch 'refs/remotes/danielperna84/Homematic' i…
pvizeli Jun 24, 2016
afb0f37
fix docstring & remove unwanted code in autedetect
pvizeli Jun 24, 2016
dc94f73
cleanup
pvizeli Jun 24, 2016
a9918b8
Merge pull request #11 from pvizeli/Homematic
danielperna84 Jun 24, 2016
fe0adda
update requirements
pvizeli Jun 24, 2016
8fbe15e
Merge pull request #12 from pvizeli/Homematic
danielperna84 Jun 24, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ omit =
homeassistant/components/netatmo.py
homeassistant/components/*/netatmo.py

homeassistant/components/homematic.py
homeassistant/components/*/homematic.py

homeassistant/components/alarm_control_panel/alarmdotcom.py
homeassistant/components/alarm_control_panel/nx584.py
homeassistant/components/binary_sensor/arest.py
Expand Down
164 changes: 164 additions & 0 deletions homeassistant/components/binary_sensor/homematic.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
"""
The homematic binary sensor platform.

For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/binary_sensor.homematic/

Important: For this platform to work the homematic component has to be
properly configured.

Configuration (single channel, simple device):

binary_sensor:
- platform: homematic
address: "<Homematic address for device>" # e.g. "JEQ0XXXXXXX"
name: "<User defined name>" (optional)


Configuration (multiple channels, like motion detector with buttons):

binary_sensor:
- platform: homematic
address: "<Homematic address for device>" # e.g. "JEQ0XXXXXXX"
param: <MOTION|PRESS_SHORT...> (device-dependent) (optional)
button: n (integer of channel to map, device-dependent) (optional)
name: "<User defined name>" (optional)
binary_sensor:
- platform: homematic
...
"""

import logging
from homeassistant.const import STATE_UNKNOWN
from homeassistant.components.binary_sensor import BinarySensorDevice
import homeassistant.components.homematic as homematic

_LOGGER = logging.getLogger(__name__)

DEPENDENCIES = ['homematic']

SENSOR_TYPES_CLASS = {
"Remote": None,
"ShutterContact": "opening",
"Smoke": "smoke",
"SmokeV2": "smoke",
"Motion": "motion",
"MotionV2": "motion",
"RemoteMotion": None
}

SUPPORT_HM_EVENT_AS_BINMOD = [
"PRESS_LONG",
"PRESS_SHORT"
]


def setup_platform(hass, config, add_callback_devices, discovery_info=None):
"""Setup the platform."""
return homematic.setup_hmdevice_entity_helper(HMBinarySensor,
config,
add_callback_devices)


class HMBinarySensor(homematic.HMDevice, BinarySensorDevice):
"""Represents diverse binary Homematic units in Home Assistant."""

@property
def is_on(self):
"""Return True if switch is on."""
if not self.available:
return False
# no binary is defined, check all!
if self._state is None:
available_bin = self._create_binary_list_from_hm()
for binary in available_bin:
try:
if binary in self._data and self._data[binary] == 1:
return True
except (ValueError, TypeError):
_LOGGER.warning("%s datatype error!", self._name)
return False

# single binary
return bool(self._hm_get_state())

@property
def sensor_class(self):
"""Return the class of this sensor, from SENSOR_CLASSES."""
if not self.available:
return None

# If state is MOTION (RemoteMotion works only)
if self._state in "MOTION":
return "motion"
return SENSOR_TYPES_CLASS.get(self._hmdevice.__class__.__name__, None)

def _check_hm_to_ha_object(self):

Choose a reason for hiding this comment

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

farcy v1.1

  • D205: 1 blank line required between summary line and description (found 0)
  • D400: First line should end with a period (not 'e')

"""Check if possible to use the HM Object as this HA type."""
from pyhomematic.devicetypes.sensors import HMBinarySensor\
as pyHMBinarySensor

# Check compatibility from HMDevice
if not super()._check_hm_to_ha_object():
return False

# check if the homematic device correct for this HA device
if not isinstance(self._hmdevice, pyHMBinarySensor):
_LOGGER.critical("This %s can't be use as binary!", self._name)
return False

# load possible binary sensor
available_bin = self._create_binary_list_from_hm()

# if exists user value?
if self._state and self._state not in available_bin:
_LOGGER.critical("This %s have no binary with %s!", self._name,
self._state)
return False

# only check and give a warining to User
if self._state is None and len(available_bin) > 1:
_LOGGER.warning("%s have multible binary params. It use all " +
"binary nodes as one. Possible param values: %s",
self._name, str(available_bin))

return True

def _init_data_struct(self):

Choose a reason for hiding this comment

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

farcy v1.1

  • D205: 1 blank line required between summary line and description (found 0)
  • D400: First line should end with a period (not 'a')

"""Generate a data struct (self._data) from hm metadata."""
super()._init_data_struct()

# load possible binary sensor
available_bin = self._create_binary_list_from_hm()

# object have 1 binary
if self._state is None and len(available_bin) == 1:
for value in available_bin:
self._state = value

# no binary is definit, use all binary for state
if self._state is None and len(available_bin) > 1:
for node in available_bin:
self._data.update({node: STATE_UNKNOWN})

# add state to data struct
if self._state:
_LOGGER.debug("%s init datastruct with main node '%s'", self._name,
self._state)
self._data.update({self._state: STATE_UNKNOWN})

def _create_binary_list_from_hm(self):

Choose a reason for hiding this comment

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

farcy v1.1

  • D210: No whitespaces allowed surrounding docstring text
  • D400: First line should end with a period (not 'r')

"""Generate a own metadata for binary_sensors."""
bin_data = {}
if not self._hmdevice:
return bin_data

# copy all data from BINARYNODE
bin_data.update(self._hmdevice.BINARYNODE)

# copy all hm event they are supportet by this object
for event, channel in self._hmdevice.EVENTNODE.items():
if event in SUPPORT_HM_EVENT_AS_BINMOD:
bin_data.update({event: channel})

return bin_data
Loading