Skip to content

Commit

Permalink
revert to old working (#996)
Browse files Browse the repository at this point in the history
* Update discover.py

* Update configHandler.py

* end wake up

* Update v2restapi.py

Add behavior instance to clip/v2/resource, to solve problem as in issue 873, now the app shows the automations

* wrong response

* add all buttons to response

* Update discover.py

Fix issue where lights with the same mac address but different modelid get the same ip address

* update wake-up

fix error "Exception while processing the schedule X | 'turn_lights_off_after'" if "turn_lights_off_after" is not specified

* fix add light in hue app

* Update requirements.txt

* Update requirements.txt

* Update Dockerfile

* Update Dockerfile

* Update Dockerfile

* Update requirements.txt

* Update requirements.txt

* Update Dockerfile

* Update requirements.txt

* Update Dockerfile

* revert to old working

* Update Dockerfile
  • Loading branch information
hendriksen-mark authored Feb 17, 2024
1 parent fa32c6b commit f968518
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 32 deletions.
37 changes: 6 additions & 31 deletions BridgeEmulator/configManager/configInit.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import logManager
import uuid
import netifaces
from random import randrange
logging = logManager.logger.get_logger(__name__)

Expand All @@ -9,37 +8,13 @@ def _generate_unique_id():
return "00:17:88:01:00:%02x:%02x:%02x-0b" % (rand_bytes[0],rand_bytes[1],rand_bytes[2])

def write_args(args, yaml_config):
host_ip = args['HOST_IP']

devices = []
for interface in netifaces.interfaces():
for family, addresses in netifaces.ifaddresses(interface).items():
if family not in (netifaces.AF_INET, netifaces.AF_INET6):
continue
for address in addresses:
if address['addr'] == host_ip:
devices.append((family, interface))
logging.debug('Found network devices ' + str(devices))

gateway_ips = []
for family, gateways in netifaces.gateways().items():
for device in devices:
if family != device[0]:
continue
for gateway in gateways:
if gateway[1] == device[1]:
gateway_ips.append(gateway[0])
logging.debug('Found gateways ' + str(gateway_ips))

if not gateway_ips:
ip_pieces = host_ip.split('.')
gateway_ips.append(ip_pieces[0] + '.' + ip_pieces[1] + '.' + ip_pieces[2] + '.1')
logging.info('Found no gateways and use fallback ' + str(gateway_ips))

yaml_config['config']['ipaddress'] = host_ip
yaml_config['config']['gateway'] = gateway_ips[0]
yaml_config['config']['mac'] = args['FULLMAC']
yaml_config['config']['bridgeid'] = (args['MAC'][:6] + 'FFFE' + args['MAC'][-6:]).upper()
host_ip = args["HOST_IP"]
ip_pieces = host_ip.split(".")
yaml_config["config"]["ipaddress"] = host_ip
yaml_config["config"]["gateway"] = ip_pieces[0] + "." + ip_pieces[1] + "." + ip_pieces[2] + ".1"
yaml_config["config"]["mac"] = args["FULLMAC"]
yaml_config["config"]["bridgeid"] = (args["MAC"][:6] + 'FFFE' + args["MAC"][-6:]).upper()
return yaml_config

def generate_security_key(yaml_config):
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,3 @@ yeelight
python-kasa==0.4.1
bleak==0.14.3
rgbxy==0.5
netifaces==0.11.0

0 comments on commit f968518

Please sign in to comment.