mopidy-raspberrypi-gpio/mopidy_raspberry_gpio/__init__.py

33 lines
717 B
Python
Raw Permalink Normal View History

import logging
2019-11-21 19:16:56 +01:00
import pathlib
from mopidy import config, ext
2019-10-10 14:16:37 +02:00
from .pinconfig import PinConfig
2019-11-12 10:58:16 +01:00
__version__ = "0.0.2"
2019-10-10 14:16:37 +02:00
logger = logging.getLogger(__name__)
class Extension(ext.Extension):
dist_name = "Mopidy-Raspberry-GPIO"
ext_name = "raspberry-gpio"
version = __version__
def get_default_config(self):
2019-11-21 19:16:56 +01:00
return config.read(pathlib.Path(__file__).parent / "ext.conf")
def get_config_schema(self):
2019-11-21 19:11:43 +01:00
schema = super().get_config_schema()
2019-10-10 14:16:37 +02:00
for pin in range(28):
2019-11-21 19:11:43 +01:00
schema[f"bcm{pin:d}"] = PinConfig()
return schema
def setup(self, registry):
2019-10-10 14:16:37 +02:00
from .frontend import RaspberryGPIOFrontend
2019-11-21 19:13:31 +01:00
2019-10-10 14:16:37 +02:00
registry.add("frontend", RaspberryGPIOFrontend)