adafruit-circuitpython-dash-display


Nameadafruit-circuitpython-dash-display JSON
Version 2.1.5 PyPI version JSON
download
home_pageNone
SummaryCircuitPython library for creating Adafruit IO dashboards.
upload_time2025-01-16 19:42:34
maintainerNone
docs_urlNone
authorNone
requires_pythonNone
licenseMIT
keywords adafruit displays iot adafruitio hardware micropythoncircuitpython
VCS
bugtrack_url
requirements Adafruit-Blinka adafruit-circuitpython-display-text adafruit-circuitpython-display-shapes adafruit-circuitpython-adafruitio
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Introduction
============


.. image:: https://readthedocs.org/projects/adafruit-circuitpython-dash_display/badge/?version=latest
    :target: https://docs.circuitpython.org/projects/dash_display/en/latest/
    :alt: Documentation Status


.. image:: https://raw.githubusercontent.com/adafruit/Adafruit_CircuitPython_Bundle/main/badges/adafruit_discord.svg
    :target: https://adafru.it/discord
    :alt: Discord


.. image:: https://github.com/adafruit/Adafruit_CircuitPython_Dash_Display/workflows/Build%20CI/badge.svg
    :target: https://github.com/adafruit/Adafruit_CircuitPython_Dash_Display/actions
    :alt: Build Status


.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
    :target: https://github.com/psf/black
    :alt: Code Style: Black

CircuitPython library for creating Adafruit IO dashboards.


Dependencies
=============
This driver depends on:

* `Adafruit CircuitPython <https://github.com/adafruit/circuitpython>`_

Please ensure all dependencies are available on the CircuitPython filesystem.
This is easily achieved by downloading
`the Adafruit library and driver bundle <https://circuitpython.org/libraries>`_
or individual libraries can be installed using
`circup <https://github.com/adafruit/circup>`_.


Usage Example
=============

.. code :: python3

    import time
    import ssl
    import board
    from digitalio import DigitalInOut, Direction, Pull
    import touchio
    import socketpool
    import wifi
    import adafruit_minimqtt.adafruit_minimqtt as MQTT
    from adafruit_io.adafruit_io import IO_MQTT
    from adafruit_dash_display import Hub

    up = DigitalInOut(board.BUTTON_UP)
    up.direction = Direction.INPUT
    up.pull = Pull.DOWN

    select = DigitalInOut(board.BUTTON_SELECT)
    select.direction = Direction.INPUT
    select.pull = Pull.DOWN

    down = DigitalInOut(board.BUTTON_DOWN)
    down.direction = Direction.INPUT
    down.pull = Pull.DOWN

    back = touchio.TouchIn(board.CAP7)
    submit = touchio.TouchIn(board.CAP8)

    try:
        from secrets import secrets
    except ImportError:
        print("WiFi secrets are kept in secrets.py, please add them there!")
        raise

    display = board.DISPLAY

    # Set your Adafruit IO Username and Key in secrets.py
    # (visit io.adafruit.com if you need to create an account,
    # or if you need your Adafruit IO key.)
    aio_username = secrets["aio_username"]
    aio_key = secrets["aio_key"]

    print("Connecting to %s" % secrets["ssid"])
    wifi.radio.connect(secrets["ssid"], secrets["password"])
    print("Connected to %s!" % secrets["ssid"])

    # Create a socket pool
    pool = socketpool.SocketPool(wifi.radio)

    # Initialize a new MQTT Client object
    mqtt_client = MQTT.MQTT(
        broker="io.adafruit.com",
        username=secrets["aio_username"],
        password=secrets["aio_key"],
        socket_pool=pool,
        ssl_context=ssl.create_default_context(),
    )

    # Initialize an Adafruit IO MQTT Client
    io = IO_MQTT(mqtt_client)


    def pub_lamp(lamp):
        if type(lamp) == str:
            lamp = eval(lamp)  # pylint: disable=eval-used
        iot.publish("lamp", str(not lamp))
        # funhouse.set_text(f"Lamp: {not lamp}", 0)
        time.sleep(0.3)


    iot = Hub(display=display, io=io, nav=(up, select, down, back, submit))

    iot.add_device(
        feed_key="lamp",
        default_text="Lamp: ",
        formatted_text="Lamp: {}",
        pub_method=pub_lamp,
    )
    iot.add_device(
        feed_key="temperature",
        default_text="Temperature: ",
        formatted_text="Temperature: {:.1f} C",
    )
    iot.add_device(
        feed_key="humidity", default_text="Humidity: ", formatted_text="Humidity: {:.2f}%"
    )

    iot.get()

    while True:
        iot.loop()
        time.sleep(0.01)

Documentation
=============

API documentation for this library can be found on `Read the Docs <https://docs.circuitpython.org/projects/dash_display/en/latest/>`_.

For information on building library documentation, please check out `this guide <https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/sharing-our-docs-on-readthedocs#sphinx-5-1>`_.

Contributing
============

Contributions are welcome! Please read our `Code of Conduct
<https://github.com/adafruit/Adafruit_CircuitPython_Dash_Display/blob/HEAD/CODE_OF_CONDUCT.md>`_
before contributing to help this project stay welcoming.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "adafruit-circuitpython-dash-display",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "adafruit, displays, iot, adafruitio, hardware, micropythoncircuitpython",
    "author": null,
    "author_email": "Adafruit Industries <circuitpython@adafruit.com>",
    "download_url": "https://files.pythonhosted.org/packages/fc/99/cfd4a043b21328cd34f30ff890a1f049134567623834ab3a0e894d6ee5d8/adafruit_circuitpython_dash_display-2.1.5.tar.gz",
    "platform": null,
    "description": "Introduction\n============\n\n\n.. image:: https://readthedocs.org/projects/adafruit-circuitpython-dash_display/badge/?version=latest\n    :target: https://docs.circuitpython.org/projects/dash_display/en/latest/\n    :alt: Documentation Status\n\n\n.. image:: https://raw.githubusercontent.com/adafruit/Adafruit_CircuitPython_Bundle/main/badges/adafruit_discord.svg\n    :target: https://adafru.it/discord\n    :alt: Discord\n\n\n.. image:: https://github.com/adafruit/Adafruit_CircuitPython_Dash_Display/workflows/Build%20CI/badge.svg\n    :target: https://github.com/adafruit/Adafruit_CircuitPython_Dash_Display/actions\n    :alt: Build Status\n\n\n.. image:: https://img.shields.io/badge/code%20style-black-000000.svg\n    :target: https://github.com/psf/black\n    :alt: Code Style: Black\n\nCircuitPython library for creating Adafruit IO dashboards.\n\n\nDependencies\n=============\nThis driver depends on:\n\n* `Adafruit CircuitPython <https://github.com/adafruit/circuitpython>`_\n\nPlease ensure all dependencies are available on the CircuitPython filesystem.\nThis is easily achieved by downloading\n`the Adafruit library and driver bundle <https://circuitpython.org/libraries>`_\nor individual libraries can be installed using\n`circup <https://github.com/adafruit/circup>`_.\n\n\nUsage Example\n=============\n\n.. code :: python3\n\n    import time\n    import ssl\n    import board\n    from digitalio import DigitalInOut, Direction, Pull\n    import touchio\n    import socketpool\n    import wifi\n    import adafruit_minimqtt.adafruit_minimqtt as MQTT\n    from adafruit_io.adafruit_io import IO_MQTT\n    from adafruit_dash_display import Hub\n\n    up = DigitalInOut(board.BUTTON_UP)\n    up.direction = Direction.INPUT\n    up.pull = Pull.DOWN\n\n    select = DigitalInOut(board.BUTTON_SELECT)\n    select.direction = Direction.INPUT\n    select.pull = Pull.DOWN\n\n    down = DigitalInOut(board.BUTTON_DOWN)\n    down.direction = Direction.INPUT\n    down.pull = Pull.DOWN\n\n    back = touchio.TouchIn(board.CAP7)\n    submit = touchio.TouchIn(board.CAP8)\n\n    try:\n        from secrets import secrets\n    except ImportError:\n        print(\"WiFi secrets are kept in secrets.py, please add them there!\")\n        raise\n\n    display = board.DISPLAY\n\n    # Set your Adafruit IO Username and Key in secrets.py\n    # (visit io.adafruit.com if you need to create an account,\n    # or if you need your Adafruit IO key.)\n    aio_username = secrets[\"aio_username\"]\n    aio_key = secrets[\"aio_key\"]\n\n    print(\"Connecting to %s\" % secrets[\"ssid\"])\n    wifi.radio.connect(secrets[\"ssid\"], secrets[\"password\"])\n    print(\"Connected to %s!\" % secrets[\"ssid\"])\n\n    # Create a socket pool\n    pool = socketpool.SocketPool(wifi.radio)\n\n    # Initialize a new MQTT Client object\n    mqtt_client = MQTT.MQTT(\n        broker=\"io.adafruit.com\",\n        username=secrets[\"aio_username\"],\n        password=secrets[\"aio_key\"],\n        socket_pool=pool,\n        ssl_context=ssl.create_default_context(),\n    )\n\n    # Initialize an Adafruit IO MQTT Client\n    io = IO_MQTT(mqtt_client)\n\n\n    def pub_lamp(lamp):\n        if type(lamp) == str:\n            lamp = eval(lamp)  # pylint: disable=eval-used\n        iot.publish(\"lamp\", str(not lamp))\n        # funhouse.set_text(f\"Lamp: {not lamp}\", 0)\n        time.sleep(0.3)\n\n\n    iot = Hub(display=display, io=io, nav=(up, select, down, back, submit))\n\n    iot.add_device(\n        feed_key=\"lamp\",\n        default_text=\"Lamp: \",\n        formatted_text=\"Lamp: {}\",\n        pub_method=pub_lamp,\n    )\n    iot.add_device(\n        feed_key=\"temperature\",\n        default_text=\"Temperature: \",\n        formatted_text=\"Temperature: {:.1f} C\",\n    )\n    iot.add_device(\n        feed_key=\"humidity\", default_text=\"Humidity: \", formatted_text=\"Humidity: {:.2f}%\"\n    )\n\n    iot.get()\n\n    while True:\n        iot.loop()\n        time.sleep(0.01)\n\nDocumentation\n=============\n\nAPI documentation for this library can be found on `Read the Docs <https://docs.circuitpython.org/projects/dash_display/en/latest/>`_.\n\nFor information on building library documentation, please check out `this guide <https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/sharing-our-docs-on-readthedocs#sphinx-5-1>`_.\n\nContributing\n============\n\nContributions are welcome! Please read our `Code of Conduct\n<https://github.com/adafruit/Adafruit_CircuitPython_Dash_Display/blob/HEAD/CODE_OF_CONDUCT.md>`_\nbefore contributing to help this project stay welcoming.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "CircuitPython library for creating Adafruit IO dashboards.",
    "version": "2.1.5",
    "project_urls": {
        "Homepage": "https://github.com/adafruit/Adafruit_CircuitPython_Dash_Display"
    },
    "split_keywords": [
        "adafruit",
        " displays",
        " iot",
        " adafruitio",
        " hardware",
        " micropythoncircuitpython"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "eff8ce30f370842fc96dd0fce25c3d11af56d1c420e6068cdfa205c5e2930545",
                "md5": "9d3d3b86d27cc516d6092fcb7a627a98",
                "sha256": "cf3eb4de36e31bffe4e9ba2176b7fff98361ac0b0b67256c2326daff0cb41540"
            },
            "downloads": -1,
            "filename": "adafruit_circuitpython_dash_display-2.1.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9d3d3b86d27cc516d6092fcb7a627a98",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 7398,
            "upload_time": "2025-01-16T19:42:30",
            "upload_time_iso_8601": "2025-01-16T19:42:30.841638Z",
            "url": "https://files.pythonhosted.org/packages/ef/f8/ce30f370842fc96dd0fce25c3d11af56d1c420e6068cdfa205c5e2930545/adafruit_circuitpython_dash_display-2.1.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fc99cfd4a043b21328cd34f30ff890a1f049134567623834ab3a0e894d6ee5d8",
                "md5": "dfc2eaf9173f1c9f927b5895d7bc4d8b",
                "sha256": "eb6b5bcfa18957f40239724dc161b3ccd3a3b6c83a100c7a6b9d1ebf99d6d172"
            },
            "downloads": -1,
            "filename": "adafruit_circuitpython_dash_display-2.1.5.tar.gz",
            "has_sig": false,
            "md5_digest": "dfc2eaf9173f1c9f927b5895d7bc4d8b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 34925,
            "upload_time": "2025-01-16T19:42:34",
            "upload_time_iso_8601": "2025-01-16T19:42:34.302193Z",
            "url": "https://files.pythonhosted.org/packages/fc/99/cfd4a043b21328cd34f30ff890a1f049134567623834ab3a0e894d6ee5d8/adafruit_circuitpython_dash_display-2.1.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-16 19:42:34",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "adafruit",
    "github_project": "Adafruit_CircuitPython_Dash_Display",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "Adafruit-Blinka",
            "specs": []
        },
        {
            "name": "adafruit-circuitpython-display-text",
            "specs": []
        },
        {
            "name": "adafruit-circuitpython-display-shapes",
            "specs": []
        },
        {
            "name": "adafruit-circuitpython-adafruitio",
            "specs": []
        }
    ],
    "lcname": "adafruit-circuitpython-dash-display"
}
        
Elapsed time: 0.39780s