Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
functional_channel = hmip_device.functionalChannels[channel]
setattr(functional_channel, attribute, new_value)
fire_target = hmip_device if fire_device is None else fire_device
if isinstance(fire_target, AsyncHome):
fire_target.fire_update_event(
fire_target._rawJSONData # pylint: disable=protected-access
)
else:
fire_target.fire_update_event()
await hass.async_block_till_done()
class HomeTemplate(Home):
"""
Home template as builder for home mock.
It is based on the upstream libs home class to generate hmip devices
and groups based on the given homematicip_cloud.json.
All further testing activities should be done by using the AsyncHome mock,
that is generated by get_async_home_mock(self).
The class also generated mocks of devices and groups for further testing.
"""
_typeClassMap = TYPE_CLASS_MAP
_typeGroupMap = TYPE_GROUP_MAP
_typeSecurityEventMap = TYPE_SECURITY_EVENT_MAP
if etype == 'DEVICE_CHANGED':
dispatcher_send(hass, EVENT_DEVICE_CHANGED, edata.id)
elif etype == 'GROUP_CHANGED':
dispatcher_send(hass, EVENT_GROUP_CHANGED, edata.id)
elif etype == 'HOME_CHANGED':
dispatcher_send(hass, EVENT_HOME_CHANGED, edata.id)
elif etype == 'JOURNAL_CHANGED':
dispatcher_send(hass, EVENT_SECURITY_CHANGED, edata.id)
return True
for device in accesspoints:
name = device.get(CONF_NAME)
accesspoint = device.get(CONF_ACCESSPOINT)
authtoken = device.get(CONF_AUTHTOKEN)
home = Home()
if name.lower() == 'none':
name = ''
home.label = name
try:
home.set_auth_token(authtoken)
home.init(accesspoint)
if home.get_current_state():
_LOGGER.info("Connection to HMIP established")
else:
_LOGGER.warning("Connection to HMIP could not be established")
return False
except timeout:
_LOGGER.warning("Connection to HMIP could not be established")
return False
homes[home.id] = home
home.onEvent += _update_event
def main():
if config is None:
print("COULD NOT DETECT CONFIG FILE")
return
home = Home()
home.set_auth_token(config.auth_token)
home.init(config.access_point)
print("Downloading configuration")
home.get_current_state()
if not os.path.exists("./img/"):
os.makedirs("./img/")
print("Generating QRCodes")
for d in home.devices:
img = qrcode.make(d.id)
img.save("./img/{}.png".format(d.id))
print("Creating website")
templatePath = os.path.join(os.path.dirname(__file__), 'qrcodes_template.html')
template = None
tableText = ""
def main():
if config is None:
print("COULD NOT DETECT CONFIG FILE")
return
home = Home()
home.set_auth_token(config.auth_token)
home.init(config.access_point)
home.get_current_state()
print("current AP Version: {}".format(home.currentAPVersion))