Abaddon’s Gate

  • Post author:
  • Post category:Book

This is the third book in the Leviathan Wakes series by James SA Corey. Just as good as the first two, this is a story about how much a daughter loves her father, perhaps beyond reason, moral choices, and politics — just as much as it is the continuation of the story arc around the alien visitor. Another excellent book, with a bit more emphasis on space battles than previously and an overall enjoyable plot line. Worth a read, to be honest I think the series is getting better.

Continue ReadingAbaddon’s Gate

The Gentle Art of Swedish Death Cleaning

  • Post author:
  • Post category:Book

We've owned this book for a while, but ironically Catherine lost it for a bit. It seems very topical at the moment because of the Marie Kondo craze, but its been floating around our house for probably a year. The book is written by an 80+ year old and explains the Swedish tradition of sorting your stuff out before you keel over, which seems like a totally reasonable thing to do when the other option is leaving your grieving kids to work out what on earth to do. The book isn't as applicable to people not at the end of the lives -- it for example recommends starting with large things like furniture and younger people are unlikely to have heaps of unneeded furniture. That said, there is definitely advice in here that is applicable to other life stages. The book is composed of a series of generally short chapters. They read a bit like small letters, notes, or blog posts. This makes the book feel very approachable and its a quite fast read. I enjoyed the book and I think I got some interesting things out of it.

Continue ReadingThe Gentle Art of Swedish Death Cleaning

Best Foot Forward

  • Post author:
  • Post category:Book

Catherine and I have been huge fans of Adam Hills for ages, so it wasn't a surprise to me that I'd like a book by him. As an aside, we've never seen him live -- we had tickets for his show in Canberra in 2013, but some of us ended up in labor in hospital instead, so we had to give those tickets away. One day we'll manage to see him live though, he just needs to get back to touring Australia more! Anyways, I enjoyed this book which as mentioned above wasn't a surprise. What was a surprise is that he said something interesting which I have been pondering for the last few days... Basically, its nice to get on stage and say things, either entertaining the audience or in my case perhaps educating them a little (I give technical conference talks). However, that's not the most important thing. You need to work out why you're on that stage before you go out there. What is the overall thing you're trying to convey? Once you know that, everything else falls into place. I think this is especially true for keynote speeches, which need to appeal to a more general audience than…

Continue ReadingBest Foot Forward

Support for Raspberry Pi and Orange Pi GPIOs in Home Assistant

So, I've been off in the GPIO library salt mines for a while, but am now ready to circle back and document how to get GPIO inputs and outputs working in Home Assistant. This now works on both Raspberry Pi and OrangePi, assuming that my patch gets merged. First off, let's talk about GPIO outputs. This is something which has been working for a while on both platforms (a while being a week or so, assuming you've patched Home Assistant with my pull request, but you're all doing that right?). To configure an output in Home Assistant, you would add the following to configuration.yaml: rpi_gpio: board_family: orange_pi switch: - platform: rpi_gpio ports: PA7: LED Where board_family can be either "raspberry_pi" or "orange_pi". Note that for Raspberry Pis, the pin numbers are always numbers whereas for OrangePi we are using "SUNXI" numbering, which is of the form "PA7". The circuit for this LED is really simple: Now we have a switch we can control in Home Assistant: GPIO inputs are similar. The configuration looks like this: rpi_gpio: board_family: orange_pi binary_sensor: - platform: rpi_gpio invert_logic: true ports: PA7: PUSHYBUTTON With a circuit like this: invert_logic set to true is required because our…

Continue ReadingSupport for Raspberry Pi and Orange Pi GPIOs in Home Assistant

Updated examples for OrangePi GPIOs

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. So here's a quick post about that. Assuming that we have an LED on GPIO PA7, which is pin 29, then the code to blink the LED would look like this with the new library: import OPi.GPIO as GPIO import time # Note that we use SUNXI mappings here because its way less confusing than # board mappsings. For example, these are all the same pin: # sunxi: PA7 (the label on the board) # board: 29 # gpio: 7 GPIO.setmode(GPIO.SUNXI) GPIO.setwarnings(False) GPIO.setup('PA7', GPIO.OUT) while True: GPIO.output('PA7', GPIO.HIGH) time.sleep(1) GPIO.output('PA7', GPIO.LOW) time.sleep(1) The most important thing there is the note about SUNXI pin mappings. I find the whole mapping scheme hugely confusing, unless you use SUNXI and then its all fine. So learn from my fail people! What about input? Well, that's not too bad either. Let's assume that you have a button in a…

Continue ReadingUpdated examples for OrangePi GPIOs

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...') if GPIO.input(17) == GPIO.HIGH: print('Pressed') else: print('Released') time.sleep(1) That code is of course horrid. Its horrid because its polling the state of the button, and its quite likely that I can sneak a button press in during one of those sleeps and it will never be noticed. Instead we can use edge detection callbacks to be informed of button presses as they happen: 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) def event_callback(channel): print('Event detected: %s' % GPIO.input(17)) GPIO.add_event_detect(17, GPIO.BOTH, callback=event_callback, bouncetime=50) while True: time.sleep(1) This second program provides helpful output like this: pi@raspberrypi:~ $ python gpio_button_edge_detect.py Event detected: 1 Event detected: 0 Which is me pressing the button once (it go high when pressed, and then low again when released). This is of course with a button wired to GPIO17 with a current limiting resistor between the button and the 3.3v…

Continue ReadingGPIO inputs on Raspberry Pi

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 resistor constants in OPi.PGIO (merged, and released) A simple burn in script for the workshop boards (merged) Automated generation of dhcpd.conf for the workshop network (merged) Clarifications for the workshop prerequisites (merged) Not all pins on Orange Pi support edge detection Clarify where the GPIO header is on the LCA2019 shield

Continue ReadingPull Requests for the LCA2019 Home Automation tutorial

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 /dev/mem gives you a whole bunch of access to the machine that Home Assistant probably shouldn't have. Alastair went off spelunking because he's more patient than me and found yet another OrangePi GPIO library. I think we're up to three or four of these at the moment, but this is the first one we've found which supports the sysfs interface to GPIO pins. That's exciting because it removes our run-as-root requirement. Its unexciting in that the sysfs interface has been deprecated by the kernel, but will remain supported for a while. I think people would be within their rights to conclude that the state of GPIO libraries for OrangePi is a bit of a dumpster fire right now. Anyways, the point of this post is mostly to write down how to use the sysfs interface to GPIO pins so that I can remember it later,…

Continue ReadingFurther adventures in Home Assistant OrangePi GPIO

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 with GPIO pins at all on either Raspberry Pi or Orange Pi. The first step seemed to be to get GPIO working at all on a Raspberry Pi (which is currently supported out of the box with Home Assistant). This online tutorial has a simple example of a circuit and the associated python code to blink a LED on a Raspberry Pi, so off I went to build that circuit. The circuit has a LED with a 330 ohm pull up resistor on GPIO pin 18 on the board. The sample python code on the page above just blinks that LED, which I used to make sure that the circuit as working as intended. To configure the GPIO pin as a switch in Home Assistant, I added the following to configuration.yaml (noting that the empty rpi_gpio entry isn't strictly required, but will be later): rpi_gpio: switch: -…

Continue ReadingAdventures in Home Assistant Raspberry Pi GPIO

The Consuming Fire

  • Post author:
  • Post category:Book

Another fast run read from Mr Scalzi, this book is the sequel to The Collapsing Empire. I think this book is actually better than the first, which I guess is fair given the first had to set the universe up. I particularly like the twist about two thirds of the way through this one, and I think the universe has a lot of potential to be really interesting in future books. Mr Scalzi remains on my I-buy-everything-he-does list. I wish he'd write another book in the Old Man's War universe.

Continue ReadingThe Consuming Fire

End of content

No more pages to load