Add All-Linking capabilities#14065
Add All-Linking capabilities#14065balloob merged 35 commits intohome-assistant:devfrom teharris1:all-linking
Conversation
Please don't be inpatient. It's open source… |
|
|
||
| LOAD_ALDB_SCHEMA = vol.Schema({ | ||
| vol.Required(CONF_ENTITY_ID): cv.entity_id, | ||
| vol.Optional(SRV_LOAD_DB_RELOAD, default='n'): vol.In(['Y', 'N', |
|
|
||
| ADD_ALL_LINK_SCHEMA = vol.Schema({ | ||
| vol.Required(SRV_ALL_LINK_GROUP): vol.Range(min=0, max=255), | ||
| vol.Required(SRV_ALL_LINK_MODE): vol.In(['C', 'R', |
There was a problem hiding this comment.
Don't use single letters, write out the word what it means instead. Also, stick to just lowercase chars
| def __init__(self, device, state_key): | ||
| def __init__(self, hass, device, state_key): | ||
| """Initialize the INSTEON PLM binary sensor.""" | ||
| self._hass = hass |
There was a problem hiding this comment.
This is not necessary. All entities that are added to Home Assistant will have access to the hass object via self.hass
| rec.group, rec.address.human, | ||
| rec.data1, rec.data2, rec.data3)) | ||
|
|
||
| else: |
There was a problem hiding this comment.
Use a guard clause.
if aldb.status not in […]:
_LOGGER.warning('')
return
for mem_addr in aldb:| self._hass = hass | ||
| self._insteon_device_state = device.states[state_key] | ||
| self._insteon_device = device | ||
| self._insteon_device.aldb.add_loaded_callback(self._aldb_loaded) |
There was a problem hiding this comment.
We should not print anything during startup. Print when requested via a service is ok.
There was a problem hiding this comment.
This method is not printing here. It is registering a callback.
There was a problem hiding this comment.
my bad. Was confused because the callback will print, but I guess it only prints when asked to load.
| device_id: | ||
| description: Hardware address of the device to remove. | ||
| example: 158d0000000000 | ||
| insteon_plm: |
There was a problem hiding this comment.
Please move insteon_plm to a new file insteon_plm/__init__.py and create a new services.yaml file in that folder.
There was a problem hiding this comment.
Happy to do that. Do you want me to make the edits it components/insteon_plm.py then move and rename it? Otherwise you will have issues with compare (unless you do a diff outside git of course:) Just want to make it easier on you.
There was a problem hiding this comment.
I think that GitHub should be able to handle it if you use git mv
|
@balloob Thanks for taking the time to review this. Please don't think I was being impatient. My concern was that most of the PRs that came in after this were being reviewed and I was afraid it slipped between the cracks. Went I looked at the PR there did not appear to be a review request so I was concerned that the PR was never going to hit anyone's queue. |
| import insteonplm | ||
|
|
||
| ipdb = IPDB() | ||
| plm = None |
There was a problem hiding this comment.
unexpected spaces around keyword / parameter equals
| vol.Optional(SRV_LOAD_DB_RELOAD, default='false'): vol.boolean), | ||
| }) | ||
|
|
||
| PRINT_ALDB_SCHEMA = vol.Schema({ |
There was a problem hiding this comment.
continuation line missing indentation or outdented
unexpected spaces around keyword / parameter equals
|
|
||
| LOAD_ALDB_SCHEMA = vol.Schema({ | ||
| vol.Required(CONF_ENTITY_ID): cv.entity_id, | ||
| vol.Optional(SRV_LOAD_DB_RELOAD, default='false'): vol.boolean), |
| import insteonplm | ||
|
|
||
| ipdb = IPDB() | ||
| plm = None |
There was a problem hiding this comment.
unexpected spaces around keyword / parameter equals
| vol.Optional(SRV_LOAD_DB_RELOAD, default='false'): vol.boolean), | ||
| }) | ||
|
|
||
| PRINT_ALDB_SCHEMA = vol.Schema({ |
There was a problem hiding this comment.
continuation line missing indentation or outdented
unexpected spaces around keyword / parameter equals
|
|
||
| LOAD_ALDB_SCHEMA = vol.Schema({ | ||
| vol.Required(CONF_ENTITY_ID): cv.entity_id, | ||
| vol.Optional(SRV_LOAD_DB_RELOAD, default='false'): vol.boolean), |
| rec.group, rec.address.human, | ||
| rec.data1, rec.data2, rec.data3)) | ||
|
|
||
|
No newline at end of file |
There was a problem hiding this comment.
blank line at end of file
blank line contains whitespace
| ' {:3d} {:3d} {:3d}'.format( | ||
| rec.mem_addr, in_use, mode, hwm, | ||
| rec.group, rec.address.human, | ||
| rec.data1, rec.data2, rec.data3)) |
There was a problem hiding this comment.
continuation line missing indentation or outdented
| _LOGGER.info(' {:04x} {:s} {:s} {:s} {:3d} {:s}' | ||
| ' {:3d} {:3d} {:3d}'.format( | ||
| rec.mem_addr, in_use, mode, hwm, | ||
| rec.group, rec.address.human, |
There was a problem hiding this comment.
continuation line missing indentation or outdented
| hwm = 'Y' if rec.control_flags.is_high_water_mark else 'N' | ||
| _LOGGER.info(' {:04x} {:s} {:s} {:s} {:3d} {:s}' | ||
| ' {:3d} {:3d} {:3d}'.format( | ||
| rec.mem_addr, in_use, mode, hwm, |
There was a problem hiding this comment.
continuation line missing indentation or outdented
Description:
In order for Insteon devices to work in a network they must be linked to the PLM and to each other. New services have been added to allow devices to be linked using the Home Assistant services under Development Tools.
Related issue (if applicable): fixes #
Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.io#5239
Example entry for
configuration.yaml(if applicable):Checklist:
tox. Your PR cannot be merged unless tests passIf user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
REQUIREMENTSvariable (example).requirements_all.txtby runningscript/gen_requirements_all.py..coveragerc.If the code does not interact with devices: