Skip to content

Commit 0965994

Browse files
committed
Remove useless enoceanmqtt modules copy
1 parent 06e4557 commit 0965994

File tree

9 files changed

+48
-699
lines changed

9 files changed

+48
-699
lines changed
File renamed without changes.

HA_enoceanmqtt/main.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import logging
2+
import traceback
3+
4+
from enoceanmqtt.communicator import Communicator
5+
from enoceanmqtt.enoceanmqtt import conf, parse_args, setup_logging, load_config_file
6+
7+
8+
def main():
9+
"""entry point if called as an executable"""
10+
# logging.getLogger().setLevel(logging.DEBUG)
11+
# Parse command line arguments
12+
conf.update(parse_args())
13+
14+
# setup logger
15+
setup_logging(conf['logfile'], logging.DEBUG if conf['debug'] else logging.INFO)
16+
17+
# load config file
18+
sensors, global_config = load_config_file(conf['config'])
19+
conf.update(global_config)
20+
21+
# Select the overlay
22+
if str(global_config.get('overlay')).lower() == "ha":
23+
try:
24+
from enoceanmqtt.overlays.homeassistant.ha_communicator import HACommunicator
25+
except ImportError:
26+
logging.error("Unable to import Home Assistant overlay")
27+
return
28+
logging.info("Selected overlay : Home Assistant")
29+
com = HACommunicator(conf, sensors)
30+
else:
31+
logging.info("Selected overlay : None")
32+
com = Communicator(conf, sensors)
33+
34+
# start working
35+
try:
36+
com.run()
37+
38+
# catch all possible exceptions
39+
except: # pylint: disable=broad-except,bare-except
40+
logging.error(traceback.format_exc())
41+
42+
43+
# check for execution
44+
if __name__ == "__main__":
45+
main()

HA_enoceanmqtt/overlays/__init__.py

Whitespace-only changes.

HA_enoceanmqtt/overlays/homeassistant/__init__.py

Whitespace-only changes.

enoceanmqtt/overlays/homeassistant/ha_communicator.py renamed to HA_enoceanmqtt/overlays/homeassistant/ha_communicator.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010

1111
import enocean.utils
1212
from enoceanmqtt.communicator import Communicator
13-
from enoceanmqtt.overlays.homeassistant.device_manager import DeviceManager
13+
14+
from HA_enoceanmqtt.overlays.homeassistant.device_manager import DeviceManager
15+
1416

1517
class HACommunicator(Communicator):
1618
'''Home Assistant-oriented Communicator subclass for enoceanmqtt'''

0 commit comments

Comments
 (0)