Getting Vevor 7in1 weather stations working with rtl_433, MQTT, and Home Assistant

Now that we've defeated QNAP's slightly broken udev, we can run a Docker container with rtl_433 in it to wire up our Vevor 7in1 weather station to Home Assistant via MQTT. First off, we need a Docker container running rtl_433, which assumes you've already setup the udev rule mentioned in the previous post, even if you're not using a QNAP! I like to write little shell scripts to run Docker containers. In this case this one: #!/bin/bash docker rm -f vevor_weather || true device=$(readlink -f /dev/rtl433) docker run --restart always -d \ --name vevor_weather \ --device ${device} \ hertzg/rtl433:master-debian -f 868M -Y classic -R 263 \ -F json -Fmqtt://mqttserver,retain=0,events=rtl_433[/model][/id] What this script does is remove any previous version of the container that might be running. It then uses our reliable symlink from the previous post to lookup the real device file. That real device file is then passed through to the Docker container. I am not entirely sure of the subtleties here, but rtl_433 refused to use the device if I passed it through as the symlink, and Docker doesn't appear to be able to remap device files like it does for ports or mounts. Regardless, this worked at least.…

Continue ReadingGetting Vevor 7in1 weather stations working with rtl_433, MQTT, and Home Assistant

Hacking on Arlec Christmas lights with tasmota

I'm loving the wide array of electrically certified home automation devices we're seeing now. Light bulbs, sensors, power boards, and even Christmas lights. Specifically Arlec is shipping these app controllable Christmas lights this year, which looked very much like they should work with Tasmota. (Sorry for the terrible product picture, I can't find this product online any more, I suspect Bunnings has sold out for the year?) Specifically, it turns out that these Arlec lights are an ESP8266 which can be flashed with tuya-convert v2 to run tasmota. Once flashed, you can control all of the functions available on the device itself, although there are parts of the protocol I haven't fully understood yet. Let's start off by flashing the device: First off boot your raspberry pi with tuya-convert. I used v2, and I suspect that's important here so make sure you upgrade if you're using something old. Next, put the bud lights into programming mode by holding the button on the control box down until the light strand turns off. Release and the strand should start blinking every couple of seconds. Now run the tuya-convert flashing script. Now go to the tasmota-XXXX essid and enter your wifi details into…

Continue ReadingHacking on Arlec Christmas lights with tasmota

1-Wire home automation tutorial from linux.conf.au 2019, part 3

This is the third in a set of posts about the home automation tutorial from linux.conf.au 2019. You should probably read part 1 and part 2 before this post. In the end Alistair decided that my home automation shield was defective, which is the cause of the errors from the past post. So I am instead running with the prototype shield that he handed me when I started helping with the tutorial preparation. That shield has some other bugs (misalignments of holes mainly), but is functional apart from that. I have also decided that I'm not super excited by hassos, and just want to run the orangepi with the OWFS to MQTT gateway into my existing home assistant setup if possible, so I am going to focus on getting that bare component working for now. To that end, the gateway can be found at https://github.com/InfernoEmbedded/OWFS-MQTT-Bridge, and is a perl script named ha-daemon.pl. I needed to install some dependancies, which in my case were for armbian: $ apt-get install perl libanyevent-perl cpanminus libdist-zilla-perl libfile-slurp-perl libdatetime-format-strptime-perl $ dzil listdeps | cpanm --sudo Then I needed to write a configuration file and put it at ha.toml in the same directory as the daemon.…

Continue Reading1-Wire home automation tutorial from linux.conf.au 2019, part 3

1-Wire home automation tutorial from linux.conf.au 2019, part 2

For the actual on-the-day work, delegates were handed a link to these instructions in github. If you're playing along at home, you should probably read 1-Wire home automation tutorial from linux.conf.au 2019, part 1 before attempting the work described here. Its especially important that you know the IP address of your board for example. Relay tweaks The instructions are pretty self explanatory, although I did get confused about where to connect the relay as I couldn't find PC8 in my 40 pin header diagrams. That's because the shields for the tutorial have a separate header which is a bit more convenient: I was also a bit confused when the relay didn't work initially, but that turns out because I'd misunderstood the wiring. The relay needs to be powered from the 3.3v pin on the 40 pin header, as there is a PCB error which puts 5v on the pins labelled as 3.3v on the GPIO header. I ended up with jumper wires which looked like this: 1-Wire issues Following on the tutorial instructions worked well from then on until I tried to get 1-Wire setup. The owfs2mqtt bridge plugin was logging this: 2019-04-08 19:23:55.075: /opt/OWFS-MQTT-Bridge/lib/Daemon/OneWire.pm:148:Daemon::logError(): Connection to owserver failed: Can't connect…

Continue Reading1-Wire home automation tutorial from linux.conf.au 2019, part 2

1-Wire home automation tutorial from linux.conf.au 2019, part 1

I didn't get much of a chance to work through the home automation tutorial at linux.conf.au 2019 because I ended up helping others in the room get their Orange Pi is booting. Now that things have settled down after the conference, I've had a chance to actually do some of the tutorial myself. These are my notes so I can remember what I did later... Pre-tutorial setup You need to do the pre-tutorial setup first. I use Ubuntu, which means its important that I use 18.10 or greater so that st-link is packaged. Apart from that the instructions as written just worked. You also need to download the image for the SD card, which was provided on the day at the conference. The URL for that is from github. Download that image, decompress it, and then flash it to an SD card using something like Balena Etcher. The tutorial used 32gb SD cards, but the image will fit on something smaller than that. hassos also doesn't put anything on the Orange Pi HDMI port when it boots, so your machine is going to look like it didn't boot. That's expected. For the tutorial we provided a mapping from board number (mac…

Continue Reading1-Wire home automation tutorial from linux.conf.au 2019, part 1

Brilliant Smart Wifi plug with Tasmota

A couple of weeks ago I was playing with Tuya derived smart light globes (Mirabella Genio from K-Mart Australia in my case, but there are a variety of other options as well). Now Bunnings has the Brillant Smart Wifi Plug on special for $20 and I decided to give that a go as well, given it is also Tuya derived. The basic procedure for OTA flashing was the same as flashing the globes, except that you hold down the button on the device for five seconds to put it into flash mode. That all worked brilliantly, until I appear to have fat fingered my wifi details in Tasmota -- when I rebooted the device it never appeared on my network. That would be much more annoying on the globes, but it turns out these smart plugs are really easy to open and that Tuya has documented the pin out of the controlling microprocessor. So, I ended up temporarily soldering some cables to the microprocessor to debug what had gone wrong. It should be noted that as a soldering person I make a great software engineer: Once you've connected with a serial console, its pretty obvious who can't be trusted to…

Continue ReadingBrilliant Smart Wifi plug with Tasmota

Mirabella Genio smart lights with Tasmota and Home Assistant

One of the things I like about Home Assistant is that it allows you to take hardware from a bunch of various vendors and stitch it together into a single consistent interface. So for example I now have five home automation vendor apps on my phone, but don't use any of them because Home Assistant manages everything. A concrete example -- we have Philips Hue lights, but they're not perfect. They're expensive, require a hub, and need to talk to a Philips data centre to function (i.e. the internet needs to work at my house, which isn't always true thanks to the failings of the Liberal Party). I'd been meaning to look at the cheapo smart lights from Kmart for a while, and finally got around to it this week. For $15 you can pickup a dimmable white globe, and for $29 you can have a RGB one. That's heaps cheaper than the Hue options. Even better, the globes are flashable to run the open source Tasmota stack, which means no web services required! So here are some instructions on flashing these globes to be useful: Buy the globes. I bought this warm while dimmable and this RBG option. Flash to…

Continue ReadingMirabella Genio smart lights with Tasmota and Home Assistant

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

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

End of content

No more pages to load