Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot define digital_outputs with raspberrypi module #15

Closed
CWempe opened this issue Jul 26, 2017 · 3 comments
Closed

Cannot define digital_outputs with raspberrypi module #15

CWempe opened this issue Jul 26, 2017 · 3 comments
Assignees
Labels

Comments

@CWempe
Copy link

CWempe commented Jul 26, 2017

I cannot get the program started wehen I define digital_outputs with raspberrypi module.

my config:

mqtt:
  host: localhost
  port: 1883
  user: "***"
  password: "*****"
  topic_prefix: test

gpio_modules:
  - name: raspberrypi
    module: raspberrypi

digital_outputs:
  - name: lights
    module: raspberrypi
    pin: 21
    on_payload: "ON"
    off_payload: "OFF"

Error:

root@raspi01:/usr/local/lib/python3.4/dist-packages/pi_mqtt_gpio# python3 -m pi_mqtt_gpio.server ~/pi_mqtt_gpio_2.yml
Traceback (most recent call last):
  File "/usr/lib/python3.4/runpy.py", line 170, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.4/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.4/dist-packages/pi_mqtt_gpio/server.py", line 419, in <module>
    initialise_digital_output(out_conf, GPIO_MODULES[out_conf["module"]])
  File "/usr/local/lib/python3.4/dist-packages/pi_mqtt_gpio/server.py", line 378, in initialise_digital_output
    gpio.setup_pin(out_conf["pin"], PinDirection.OUTPUT, None, out_conf)
  File "/usr/local/lib/python3.4/dist-packages/pi_mqtt_gpio/modules/raspberrypi.py", line 35, in setup_pin
    pullup = PULLUPS[0]
KeyError: 0
@flyte flyte closed this as completed in 370ca00 Jul 26, 2017
@flyte flyte self-assigned this Jul 26, 2017
@flyte flyte added the bug label Jul 26, 2017
@flyte
Copy link
Owner

flyte commented Jul 26, 2017

Thanks @CWempe - please try version 0.0.10 and reopen the ticket if it's not fixed.

@CWempe
Copy link
Author

CWempe commented Jul 26, 2017

It works!

The bis still confusing though. 😉

MQTT client: Received PUBLISH (d0, q0, r0, m0), 'test/output/lights/set', ...  (2 bytes)
Received message on topic 'test/output/lights/set': b'ON'
Set 'raspberrypi' output 'lights' to True
MQTT client: Sending PUBLISH (d0, q0, r0, m9), 'b'test/output/lights'', ... (2 bytes)
MQTT client: Received PUBLISH (d0, q0, r0, m0), 'test/output/lights/set', ...  (3 bytes)
Received message on topic 'test/output/lights/set': b'OFF'
Set 'raspberrypi' output 'lights' to False
MQTT client: Sending PUBLISH (d0, q0, r0, m10), 'b'test/output/lights'', ... (3 bytes)

@flyte
Copy link
Owner

flyte commented Jul 26, 2017

Ah yes, it's the way Python 3 declares that it's a string of bytes with an unknown character encoding. It's useful when debugging, but not necessarily helpful to the end user. I may add some logging configuration which will stop it from being quite so verbose.

Glad the issue's fixed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants