As part of working through adding OrangePi support to Home Assistant, Alastair and I decided to change to a different GPIO library for OrangePi to avoid the requirement for Home Assistant to have access to /dev/mem. I just realised that I hadn’t posted updated examples of how to do GPIO output with the new library….
Category: Python
Posts relating to the python programming language.
GPIO inputs on Raspberry Pi
Now that I have GPIO outputs working nicely for Home Assistant using either a Raspberry Pi or an Orange Pi, I want to get GPIO inputs working as well. Naively, that’s pretty easy to do in python on the Raspberry Pi: import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) GPIO.setup(17, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) while True: print('Reading…')…
Pull Requests for the LCA2019 Home Automation tutorial
A quick list of things I did for the LCA2019 Home Automation tutorial. Of course Alistair did a lot more, but I still want to track these. Add OrangePi GPIO support to Home Assistant (declined) Document OrangePi GPIO support in Home Assistant (declined) Add OrangePi Prime GPIO pinouts to OPi.GPIO (merged, and released) Expose pullup…
Further adventures in Home Assistant OrangePi GPIO
Its funny how a single sentence can change your course. In the last post about this work, I said: We also need to run hass as root, because OrangePi GPIO support requires access to /dev/mem for reasons I haven’t dug into just yet. That’s turned out to be (reasonably) a pretty big sticking point upstream. Access to…
Adventures in Home Assistant Raspberry Pi GPIO
Alastair D’Silva is running what looks to be a very well prepared home automation tutorial at LCA2019 based on Home Assistant. I offered to have a hack on the support for GPIO pins on OrangePi boards in Home Assistant because it sounded interesting for a vacation week. The only catch being that I’d never done anything…
Learning from the mistakes that even big projects make
The following is a blog post version of a talk presented at pyconau 2018. Slides for the presentation can be found here (as Microsoft powerpoint, or as PDF), and a video of the talk (thanks NextDayVideo!) is below: OpenStack is an orchestration system for setting up virtual machines and associated other virtual resources such as…
Rejected talk proposal: Design at scale: OpenStack versus Kubernetes
This proposal was submitted for pyconau 2018. It wasn’t accepted, but given I’d put the effort into writing up the proposal I’ll post it here in case its useful some other time. The oblique references to OpensStack are because pycon had an “anonymous” review system in 2018, and I was avoiding saying things which directly…
I think I found a bug in python’s unittest.mock library
Mocking is a pretty common thing to do in unit tests covering OpenStack Nova code. Over the years we’ve used various mock libraries to do that, with the flavor de jour being unittest.mock. I must say that I strongly prefer unittest.mock to the old mox code we used to write, but I think I just…
Python3 venvs for people who are old and grumpy
I’ve been using virtualenvwrapper to make venvs for python2 for probably six or so years. I know it, and understand it. Now some bad man (hi Ramon!) is making me do python3, and virtualenvwrapper just isn’t a thing over there as best as I can tell. So how do I make a venv? Its really…
Multiple file support with scp
Paramiko doesn’t provide a scp implementation, so I’ve been using my own for a while. http://blogs.sun.com/janp/entry/how_the_scp_protocol_works (link now unfortunately dead) provides good documentation about the scp protocol, but it missed out on one detail I needed — how to send more than one file in a given session. In the end I implemented a simple…