IKEA Server / Comms Cabinet

Hello!

I have had for the last few years, a growing pile of electronics that I called my homelab. It looked a bit sad.

This was it recently…
This was back in 2017 ๐Ÿ˜ญ๐Ÿ™ƒ

I decided recently that it really deserved some love, and it’s really very rewarding to put in a bit of effort for something that looks good.

So I started looking into ideas on how to clean it up.

Initially I was planning on getting either a 9u or 12u rack/cabinet, and just leaving it in the same place. But as much as I love my servers and gadgets, I don’t think a black metal box in the living room/ kitchen looks great to guests. So I figured I should try something that looks better.

An IKEA lack was off the table, as it’s much too large for something up against the wall in my opinion, so I browsed the website for a while until I came across the TRYSIL. It’s a chest of r draws, that extends a mere 40cm from front to back. Perfect for up against the wall! And at only $129, it was just $4.05 more expensive than a 9u rack.

So I ordered one and picked it up Friday night. Assembly was pretty straightforward, just follow the pictures as you would expect. But what I didn’t do was install the bottom two draws, I left that section completely open.

I purchased two metal strips for.the hardware for about $0.80 each, and laid the two draw fronts together about the correct spacing apart, and bolted them together using the metal strips.

I then measured out and attached two butt hinfes ($4.95 for the pair) to the new door and cabinet.

I had this wall-mount server rack thing left over from a previous intention to wall mount my servers in the garage, and flipping it on its side gave me a perfect 3u mounting space.

I used M5 bolts and some washers to secure it in place, and it’s not going ANYWHERE.

This fits really well, leaving a bit of space on either side for cable management and other things.

I then test fit a PowerPoint art he back and started on my way to cutting out a hole in the base to mount a pair of 200mm fans for airflow.

In Australia you can’t do mains voltage work without a license, so I called over a sparky friend do wire things up for me.

I went out to my local Jaycar to pickup a few things I would need, and while I was there I found a 4 Port USB outlet for only $15! I grabbed this and a mounting box for it as well, this will be useful for odd things like an esp8266 to monitor temperature and drive LEDs, and the Mi-Light wifi bridge.

Now that sparky mate has installed those for me I went back to working on cutting out my hole for the fans. I probably could have cut it out before assembly but I was in the mood to get things done in one day so I didn’t want to trek out to Robots and Dinosaurs with some wood to cut out using their tools!

I cut a hole on the upper left side for a cable feed hole for ethernet connectivity, but I’m thinking I’ll replace this with a 6 way Keystone plate to keep the cabinet modular. I want to move the nbn cable NTD into the roof, so that rather than an RG-6 cable to deal with I just have CAT6…

I also got an IEC socket installed on the back to be fed from the external UPS which is too large to fit inside, this also means it’s relatively simple to unplug and move should I have to do that.

Once I had the holes cut out to my satisfaction, keeping in mind that they won’t really be seen so I wasn’t too fussed, I used cable ties to hold the two 200mm fans together, and screwed them into the underside of the cabinet over the hole.

Oh I also attached the $2.95 magnetic latch you see here.

Once I had mounted and wired up my fans, it was time to start moving my network hardware over.

I started with the switch as it will serve as the shelf for the other hardware. (don’t worry it’s properly bolted in)

I then installed the power distribution bar, NTD and pfsense router. I blacked out the pfsense because it’s a surprise for another post soon.

I affixed the Mi-Light bridge and zigbee2mqtt devices using command Velcro, and screwed in a fan controller harvested from the same PC the fans came from.

I began to test fit the various power supplies inside, there’s a few because I’m using micro PC’s as servers… I’m considering consolidating the Synology units into a single 150w PSU though.

I test fit and began cabling everything in, I have ordered a brushed 1u panel to clean up the wiring a bit more but it will be a few weeks from china.

Once everything was in, I did a final test to make sure I was happy with the airflow and the path the air seems to be taking through the cabinet, which will improve after I install the brushed plate and a blank panel.

With ally tests done and happy, I hooked up the ups and turned on all the servers one after another. I monitored them as they came back online to ensure all VMs and services started correctly, and so far only Wireguard refuses to start! ๐Ÿ™

Good enough for me!

And with that the move was virtually complete!

I have since added some lights, and a DHT22 temp/humidity sensor inside to keep track of how it’s going, but temps so far seem very acceptable.

The 120mm fans bolted directly to the cabinet are audible so I would like to replace them with noctuas, mounted via rubber or foam dampeners.

Overall I’m super happy with how it turned out, everything fit perfectly, it was fun to work on and build, it looks so much better than an ominous pile of electronics next to the kitchen and dust will hopefully be a bit less an issue now!

Best of all, it looks nothing like a server cabinet!

A Smarter Smart TV

My TV at home features both Google TV through a Xiaomi Mi Box, and Kodi running on an old Chromebox. This alone is what most would call, a ‘smart tv’

However Is it really smart if you still have to turn it on? and change channel?
In some occasions, HDMI CEC can help here, as it is capable of turning the TV on and changing to the input it needs ! However for my use case, this doesnt work. and it is rarely able to turn OFF the TV.

Luckily, in one of my recent posts I covered how I added RS232 control to the TV. so actually changing inputs and power on and off are now discrete commands we have at our disposal!

Using some simple logic in Node-Red it was a simple case of checking which device changes to playing, and then switching the TV on, and changing over the input to match!

There is probably a more streamlined way to do this but this is what I have come up with:

It works like so;

First we have this state changed node that outputs true, if the device is not playing.

If it IS playing, it outputs a false, which triggers the ‘Turn on TV’ call service node.

followed by a wait until node, just to add a 1 second delay to allow the TV to startup.

and finally another call service node to actually change the input!

Meanwhile, if the TV state is anything OTHER than playing, it will first go to this wait until node, and wait 60 minutes in case it begins playing again (this gives time to choose the next video or show using a remote ! I will probably shorten this though)

finally followed by the turn off switch for the TV.

I also need to get around to renaming the entities of the switches used here, as they’re not very well named at present.

Ill include the flow below!

[{"id":"4e63a44b.f401bc","type":"server-state-changed","z":"e94d3e8b.2d81e","name":"When Kodi stops Playing","server":"33a2704d.0e654","version":1,"entityidfilter":"media_player.kodi_libreelec_local","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"playing","halt_if_type":"str","halt_if_compare":"is_not","outputs":2,"output_only_on_state_change":true,"x":290,"y":760,"wires":[["9a3def91.d13ae"],["432da1ba.4b195"]]},{"id":"432da1ba.4b195","type":"api-call-service","z":"e94d3e8b.2d81e","name":"Turn on TV","server":"33a2704d.0e654","version":"1","service_domain":"homeassistant","service":"turn_on","entityId":"switch.sharp_tv_rs232","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":850,"y":700,"wires":[["9be17d6c.92cdf"]]},{"id":"11a5db01.9c8e75","type":"api-call-service","z":"e94d3e8b.2d81e","name":"Turn off TV","server":"33a2704d.0e654","version":1,"service_domain":"homeassistant","service":"turn_on","entityId":"switch.turn_off","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":850,"y":780,"wires":[[]]},{"id":"9a3def91.d13ae","type":"ha-wait-until","z":"e94d3e8b.2d81e","name":"","server":"33a2704d.0e654","outputs":2,"entityId":"media_player.kodi_libreelec_local","property":"state","comparator":"is","value":"playing","valueType":"str","timeout":"60","timeoutUnits":"minutes","entityLocation":"","entityLocationType":"none","checkCurrentState":true,"blockInputOverrides":true,"x":620,"y":760,"wires":[["432da1ba.4b195"],["11a5db01.9c8e75"]]},{"id":"9f2ad7cf.baa538","type":"api-call-service","z":"e94d3e8b.2d81e","name":"Change Input","server":"33a2704d.0e654","version":1,"service_domain":"switch","service":"turn_on","entityId":"switch.displayport","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1200,"y":680,"wires":[[]]},{"id":"9be17d6c.92cdf","type":"ha-wait-until","z":"e94d3e8b.2d81e","name":"","server":"33a2704d.0e654","outputs":2,"entityId":"switch.displayport_2","property":"state","comparator":"is","value":"on","valueType":"str","timeout":"1","timeoutUnits":"seconds","entityLocation":"","entityLocationType":"none","checkCurrentState":true,"blockInputOverrides":true,"x":1000,"y":680,"wires":[["9f2ad7cf.baa538"],["9f2ad7cf.baa538"]]},{"id":"33a2704d.0e654","type":"server","z":"","name":"Home Assistant [Lewys]","legacy":false,"hassio":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true}]

Upgrading from ResinOS to Ubuntu

My Home Assistant / Hass.io install was an old ResinOS image from the hass.io website running on an Intel NUC.

Occasionally I would have to reboot the machine, as it would loose network connectivity for an unknown reason (The machine was still connected, and the host OS, but Home Assistant could not connect out to the internet? as in, the logs were full of time outs and refused connections due to ‘max retries exceeded’

I wanted to migrate this over to a Ubuntu Docker install so that I had better control over the hardware and could do other tasks on the machine, and to hopefully repair the issue with connectivity.

I took a snapshot of hass.io through the web UI, copied it off as well as manually backed up the files, and then installed Ubuntu 18.04.3 onto the NUC.

I installed Hass.io following the manual install directions on the website, and then the samba addon. Copied the file back into the correct folder and rebooted.
Once it was back up, I selected the snapshot and hit restore.

It took about half an hour to complete for some reason, but once it had, it was pretty much exactly how it was before I started.

There was a few things that required attention, for example Node-Red was not connecting. I didn’t do anything to it but restarting and it connected once more.
There was also problems with MariaDB that I couldn’t understand, it could not connect, but was listening and running fine? I ended up just removing this addon and reinstalling it, as it was pretty simple.

Once it was all up and running again, It seemed to be working fine. I setup Portainer manually and connected it to the local docker instance, and added my other docker endpoints to it.

All was good.

Until the next day. My alarm didnt go off in the morning, which was the first red flag, I tried opening Home Assistant to adjust my Air Conditioner and it would not load, I checked Portainer and the container was still running, so it should be working? Checking the logs it looks like its running but cannot connect to the internet again. This is similar but not exactly the same messages as previously. I restarted the Home Assistant container and the logs indicated it was having connectivity problems out to the internet, but this should not stop the Local UI from working on https://IP:8123 … yet it was? I had to leave for work at this point so I figured no biggie, ill fix it on lunch over VPN.

(update: the alarm didn’t go off because the MP3 it plays is hosted on the internet, I need to switch it over to a local MP3 to remove this internet dependency)

But heres where the plot thickens.

Just yesterday I was toying with settings on my OpenVPN Server with my buddy Tom while we were trying to figure out why DNS doesnt work for local clients when connected to VPN, and something we touched must have been wrong as now my VPN is playing up and apparently he is having internet troubles too.

The next day:

So it turns out I didn’t break anything, Telstra had messed up my account for some reason and after an hour talking to them they were able to revert their changes and fix it. Now everything’s back to normal!

Updating my last Arduino based ESP to ESPHome

I have most of my ESP based IoT devices running ESPHome by now, but there was one left that I hadn’t spent the time figuring out how to adapt.

That was the one that lives inside my wall, and opens the buildings door by shorting two contacts on the intercom system.

My requirements for this were backwards compatibility so that my scripts and automations that were setup to control the door via MQTT could still function, this way I can continue to operate as normal but with the addition of OTA updates and telemetry from the node thats hardest to reach!

The original code involved subscribing to a topic, and waiting for a payload, then turning the relay on and then off again, for a momentary press.

#include <ESP8266WiFi.h>
#include <PubSubClient.h>

#define CLIENT_ID "buildingdoor-singlerelay"

#define RELAY_PIN 0


// Update these with values suitable for your network.
const char* ssid = "WiFiSSID";
const char* password = "WiFiPassword";
const char* mqtt_server = "MQTTServerIP";

WiFiClient espClient;
PubSubClient client(espClient);
long lastMsg = 0;

void setup()
{
  pinMode(LED_BUILTIN, OUTPUT);
  pinMode(RELAY_PIN, OUTPUT);
  Serial.begin(115200);
  setup_wifi(); 
  client.setServer(mqtt_server, 1883);
  client.setCallback(callback);
  digitalWrite(RELAY_PIN, HIGH);
  pinMode(D3, OUTPUT);
  pinMode(D1, OUTPUT);
  digitalWrite(D1, LOW);
}

void setup_wifi() {
  delay(10);
  // We start by connecting to a WiFi network
  Serial.println();
  Serial.print("Connecting to ");
  Serial.println(ssid); //We don't want the ESP to act as an AP
  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, password);

  while (WiFi.status() != WL_CONNECTED) 
  {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.println("WiFi connected");
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());
}

void callback(char* topic, byte* payload, unsigned int length) {
  Serial.print("Message arrived [");
  Serial.print(topic);
  Serial.print("] ");
  for (int i = 0; i < length; i++) {
    Serial.print((char)payload[i]);
  }
  Serial.println();

  // Switch on the LED if an 1 was received as first character
  if ((char)payload[0] == '1') {
    client.publish("building/door/relay", "1");
    delay(100);
    digitalWrite(RELAY_PIN, LOW);
    delay(200);
    digitalWrite(RELAY_PIN, HIGH);
  }  } else {
    digitalWrite(RELAY_PIN, HIGH);
    delay(100);
    client.publish("building/door/relay", "0");
  }

}

void reconnect() {
  // Loop until we're reconnected
  digitalWrite(LED_BUILTIN, LOW);
  while (!client.connected()) {
    Serial.print("Attempting MQTT connection...");
    // Attempt to connect
    if (client.connect(CLIENT_ID)) {
      Serial.println("connected");
      client.subscribe("building/door/relay/set");
      digitalWrite(LED_BUILTIN, HIGH);
    } else {
      Serial.print("failed, rc=");
      Serial.print(client.state());
      Serial.println(" try again in 5 seconds");
      // Wait 5 seconds before retrying
      delay(5000);
    }
  }
}

void loop()
{
  if (!client.connected()) {
    reconnect();
  }
  client.loop();
}

The new ESPHome code, does this, in addition to supporting the Home Assistant API and reporting back some values such as the WiFi Signal Strength!

esphome:
  name: buildingdoor
  platform: ESP8266
  board: esp01_1m

wifi:
  ssid: 'WiFiSSID'
  password: 'WiFiPassword'
  domain: .local
  fast_connect: true
  manual_ip:
    static_ip: 172.16.0.XX
    gateway: 172.16.0.1
    subnet: 255.255.255.0
mqtt:
  broker: 172.16.0.XX
  username: MQTTUsername
#  password: MyMQTTPassword
  on_message:
    topic: building/door/relay/set
    then:
      - switch.turn_on: building_door_switch
api:

# Enable logging
logger:

ota:

switch:
  - platform: gpio
    pin:
      number: 0
      inverted: yes
    icon: "mdi:office-building"
    name: "Building Door Open Switch"
    id: building_door_switch
    retain: false
    discovery: false
    availability:
      topic: building/door/status
      payload_available: online
      payload_not_available: offline
    state_topic: building/door/relay
    command_topic: building/door/relay/set
    on_turn_on:
    - logger.log: "Building Door Relay Activated!"
    - delay: 0.2s
    - switch.turn_off: building_door_switch
    on_turn_off:
    - logger.log: "Building Door Relay Deactivated!"

sensor:
  - platform: wifi_signal
    name: "Building Door WiFi Signal"
    update_interval: 60s
text_sensor:
  - platform: wifi_info
    ip_address:
      name: Building Door ESP IP Address
    ssid:
      name: Building Door ESP Connected SSID
    bssid:
      name: Building Door ESP Connected BSSID

I first connected it externally next to the wall, and listened to hear that they indeed, both fired when they were supposed to, and once confirmed, I opened up the wall, switched out the ESP-01S modules and closed it all back up!

Controlling an RS232 Device over UART / WiFi

I recently had the need to connect part of my AV setup to my Home Assistant instance, however to do so I had two options, using the LAN control option built into the device, or via an RS232 serial port.

Naturally I attempted to use the LAN control part first, which involves opening a TCP socket to port 10008 of the device.
But I ran into problems as the connection kept wanting a user to login, even though there was no user account, and I was unable to figure out how to pass the login prompt and send commands automatically.

So I went to JayCar and grabbed one of these:

https://www.aliexpress.com/item/32722395554.html

Basically, it converts a TTL level signal to RS232 level signals.
I hooked it up to a Wemos D1 Mini, on the ESP, you want to use one of the HARDWARE UART pins, so for me, I went with D4, which is GPIO2 / TXD1.

My equipment had a 3.5mm socket for RS232 control, the manual had a pinout for DB9 to 3.5 so that was a simple cable to make, but your equipment might have something else.

Code wise, this is what ive settled on using and has been working MOSTLY well:

esphome:
  name: sharptv
  platform: ESP8266
  board: d1_mini

wifi:
  ssid: '********'
  password: '********'

api:

# Enable logging
logger:

ota:

mqtt:
  broker: 172.16.0.60
  username: rs232
  password: ********

uart:
  baud_rate: 38400
  tx_pin: D4

switch:
  - platform: uart
    name: "Power On"
    data: [0x50, 0x4F, 0x57, 0x52, 0x20, 0x20, 0x20, 0x31, 0x0D, 0x0A]
    on_turn_on:
      then:
      - mqtt.publish:
          topic: esphome/rs232/sharp/state
          payload: "ON"
          retain: true

  - platform: uart
    name: "Power Off"
    data: [0x50, 0x4F, 0x57, 0x52, 0x20, 0x20, 0x20, 0x30, 0x0D, 0x0A]
    on_turn_on:
      then:
      - mqtt.publish:
          topic: esphome/rs232/sharp/state
          payload: "OFF"
          retain: true

  - platform: uart
    name: "HDMI 1"
    data: [0x49, 0x4E, 0x50, 0x53, 0x20, 0x20, 0x31, 0x30, 0x0D, 0x0A]
    on_turn_on:
      then:
      - mqtt.publish:
          topic: esphome/rs232/sharp/input
          payload: "HDMI1"
          retain: true

  - platform: uart
    name: "HDMI 2"
    data: [0x49, 0x4E, 0x50, 0x53, 0x20, 0x20, 0x31, 0x33, 0x0D, 0x0A]
    on_turn_on:
      then:
      - mqtt.publish:
          topic: esphome/rs232/sharp/input
          payload: "HDMI2"
          retain: true

  - platform: uart
    name: "HDMI 3"
    data: [0x49, 0x4E, 0x50, 0x53, 0x20, 0x20, 0x31, 0x38, 0x0D, 0x0A]
    on_turn_on:
      then:
      - mqtt.publish:
          topic: esphome/rs232/sharp/input
          payload: "HDMI3"
          retain: true

  - platform: uart
    name: "DISPLAYPORT"
    data: [0x49, 0x4E, 0x50, 0x53, 0x20, 0x20, 0x31, 0x34, 0x0D, 0x0A]
    on_turn_on:
      then:
      - mqtt.publish:
          topic: esphome/rs232/sharp/input
          payload: "DISPLAYPORT" 
          retain: true

I say mostly, because when the ESP reboots, it sticks some data out of the pin, which the equipment holds in its buffer. So if the ESP has just reboot, and I try and send a command, the unit wont respond, as it gets more data than it thought. ๐Ÿ™‚

This can be fixed by including a line break and carriage return at the START of the command, to clear the buffer, or by sending the command twice. but i havent done that yet because i โ€ฆ havent got around to itโ€ฆ 

Ill also mention, the TX/RX might be wrong on the Chinese board because ive seen a few different photos, if it doesnt work on TX try RX :^)

Ive ordered a handful of these to test making it smaller (think a cable with a bulge in the middle)

https://www.aliexpress.com/item/32834977750.html


Vivid 2018 LED IoT Apparel !

Hello! 

Continuing with the tradition of creating something beautiful and covered in LED lights, this year we have something special!

Previously, we had the LED Jacket with Tearschu, and the LED Dress with Naifel. Taking inspiration from these, and solving a lot of the problems I faced with them, I bring the latest iteration of light up fun.

This year, I have taken a pair of high heel boots, and an umbrella from Daiso, added plenty of pretty lights, and of course, this year marks the first year the entire project is connected to the internet.

 

 

The project was built using mostly the same core components for each item. 

The shoes each have:

  • Lithium Ion Battery (1000mAh)
  • LiIon Charge / Boost circuit MP2636 
  • WeMos D1 Mini
  • A random switch for power
  • A strip of WS2812 LEDs

The umbrella is similar, except instead of the MP2636 boost circuit and 3.7v Lithium battery, I used a 3s LiPo battery, and a 5v step down regulator capable of high current.

 

The physical build was pretty straight forward, hook up everything how you please, battery to boost/charge, from there to the WeMos / LEDs, and then route the wires how you please. For LED placement on the shoes, I went with up along the front as I feel this will look the best having the light cover the most area, and for the umbrella I ran the lights down the spokes of the umbrella.

Unfortunately with my design you cant really CLOSE the umbrella anymore but as this is just for Vivid I am not too fussed ๐Ÿ™‚ 

To attach the LEDs to the umbrella I initially tried to use hot glue, but it was actually melting through the umbrella, and the parts that didn’t, did not hold very well, so I ended up using clear packing tape, as it does not seem to get in the way of anything and is barely noticeable! 

The LEDs here are hooked up in parallel with each other, so each spoke on the umbrella will be the same.

Once it is all made up physically, we can move on to the code.

I was looking into using the McLighting project for control of these, as it has both an internal web interface as well as support for things like MQTT, but I could not get it to work reliably, and it didn’t support running in AP mode, only client mode, which was a big turn off for me.

So what I ended up using was the JSON LED code from BRUH Automation, because I use this for other things at home and it works pretty reliably.

One thing to note here, for my LEDs I had to add the following two lines of code, BEFORE including the libraries, to prevent flickering of the strip. (not sure why this works?)

#define FASTLED_INTERRUPT_RETRY_COUNT 0
#define FASTLED_ALLOW_INTERRUPTS 0

 

(at the verryy top of the sketch)

 

Now my initial plan included taking a small portable router, and a Raspberry Pi 3 out with me to vivid, running a local MQTT server on a local network, with the Pi running Home Assistant (Hass.IO) all locally so I could connect to it to control things. However I ran into many problems attempting to do this, I am not sure if its because I don’t know how to properly setup static IP’s in resin, or just because it hates me, but I kept not being able to connect or it wouldn’t respond to my commands, it just wasn’t working great.

 

One day though, my good friend Mark came over and we needed a project to work on, so what we set up was a private mosquitto MQTT broker, that requires authentication, running in Docker on a Ubuntu Server 18.04 LTS install!

What this meant,  was I now had a secure way of connecting a remote node to my Home Assistant running back home.

 

I went right ahead and adjusted the code on the three items for the new server, forwarded the ports in my router, added the config to my production Home Assistant server, and hey presto, was I glad to see, everything JUST WORKED.

 

I made a view in Home Assistant and threw all the entities into it, and here’s how that looks:

So as you can see, we can control both shoes together, each individually, the umbrella on its own, or everything as a group!

We also can change the animation speed of the various effects.

I will be heading out to vivid to shoot a small video and some photos with this, with my good friend Tsugumi modelling it for me, on the 9th of June 2018 from about 6PM onward, Not sure if I will be at Circular Quay or Darling Harbor yet, keep your eye on my Instagram to find out! ๐Ÿ˜‰ 

 

Thanks for reading!!!

Image Recognition for Home Assistant

I was browsing the Home Assistant Community Forums earlier today, when I noticed a post by Robin Cole!

Rob has created a custom component for Home Assistant that allows us to use image classification via Tagbox, on a camera feed that Home Assistant has access to.

Following the instructions on github was pretty straight forward, the only thing I changed was to reference an external image_procesing.yaml rather than having it all in my configuration.yaml as I’m trying to be a bit cleaner.

 

In this case, my docker is running on Windows, the Tagbox instructions were fine for this, I didn’t realise you can just run the image and if its not installed, it will download it ๐Ÿ™‚ 

 

So now that it’s all setup it appears to be working great! 

As you can see, the component creates a new entity called image_processing.tagbox_name, with a state of the most likely item in the image, and then some attributes of the next most likely, and a count of any specific tags from the config.

I’ll play around with it to see what I can use it for more practically,  I can think of all sorts of things this component will be useful for! From identifying if a car spot is free or taken, to seeing if the bins were already taken out! 

 

I just wish I could specify a region within a camera feed for it to analyse. 

 

Why I play around with Home Automation

Hello, I’m posting this just before bed to clear something up. Apologies if things don’t make sense.

When people find out about my smart home setup, the most common thing I get from people next to “was it expensive” is “you’re really lazy”

Its not about the effort I save by not getting up to flick a light switch.

For me, this is my hobby. I take great joy in setting up different systems to work and play together nicely, for example, most of the sensors in my apartment are on a ZigBee network, while most of the lights are WiFi, even the different brands of bulbs, and then there’s a few Z-Wave devices in the mix.

I go to a lot of trouble and effort to set these things up, to maintain them, its very time and effort consuming.

I am learning HEAPS as I go along, about how things work, how different technologies work together, improving my understanding of code and syntax and even learning new languages.

Theres a huge level of satisfaction I get when something I’ve spend hours, even days working towards, finally works.

Such as the other day when I was at work, not even thinking about the weather outside, and I got a Facebook message telling me the temperature in my bedroom had exceeded 27ยฐc.

This reminded me I could set the thermostat to 23ยฐc befoee I left work, so that when I got home my room was nice and cool.

Or when I walk into the kitchen and the light turns itself on when I enter, turning itself back off when I leave again.

Even simple things like all the lights turn themselves off at 1am in case we have fallen asleep and left them on.

Its all these end results that I work hard to achieve.

The feeling of moving aroundy normal life, and having these things just happen when they need to, makes me feel more free, if I want to watch a movie, I select it on my phone, the tv turns on and starts playing the movie, the lights dim while its playinf, then when it’s finished, the tv turns off and the lights come back up, is amazing, it feels so natural, things happening when I need them, not just when I do them.

So next time you hear that I’ve set up my light to be voice controlled, instead of thinking “that’s so lazy” think more about how it can be helpful, like “wow of your hands are full you can still turn on the lights” or even “wow if you’re tired and don’t want to get out of bed, you can turn them off from there!”

This post isn’t targeted, I’m just attempting to convey my point of view.

If it was a matter of being lazy, I wouldn’t go to the copious amounts of effort that I do in order to setup this stuff.

WiFi speaker upgrade and Home Assistant TTS

A while ago I picked up a wi-fi enabled speaker from Target or Kmart for $50. It was advertised as on special for $80 down from $160, so I figured how bad could it be? Then when scanned in it came up as $50 so even better.

The speaker natively has Spotify connect and DLNA support, I don’t really have anything that streams to DLNA, so Spotify connect was what I had planned for it.
I did hope that I could get Home Assistant talking to it over DLNA but couldn’t find any DLNA components so wasn’t too confident on that.
The speaker itself feels well built, looks pretty decent, and sounds okay. It’s a bit bass heavy, and the PSU always sparks when you connect it (why is it 15v? Why not 12v???)
I used it for a day or two then it kind of got abandoned, as nice as a wifi speaker is, when it’s limited to just Spotify that’s less than amazing.
So fast forward a few weeks, I remembered that I have some Chromecast audio laying around doing nothing.
I had purchased them to test out the multiroom audio playback, something that has always interested me.

But after testing it out I didn’t really have a need for it.

I’m not walking around my apartment enough.

And the tv already has a regular Chromecast.
So the audios were just sitting on my modem in a triangle.
I grabbed one and hooked it up to the aux input on the wifi speaker to see how it sounds, and well, having the ability to stream content from almost any multimedia app, website or device is much more appealing than just Spotify.

Oh right I should mention that the speaker has a tendency to just, enter a sleeping state, where it disconnects from wifi, and doesn’t reconnect until you wake it up (I had to power cycle it ?)

This makes it REALLY annoying to use.
So I set out in a venture to install my Chromecast audio inside the wifi speaker,
What follows is a whole lot of work and overengineering that for the most part ended up being redundant.
I disassembled the wifi speaker and found that it does indeed have the rated speakers, and a fairly sized mainboard.

It had a wifi add on board too.

I left this in there so it will still function as its original purpose.

The plan was to disassemble the Chromecast audio, and solder wires between the aux port on the speaker and the Chromecast.

All the tests I did on this gave me faint audio on the right channel, and slightly louder audio on the right channel.

I couldn’t figure out why this was happening, as I traced all the connections and they were all correct ?

The only thing I can think of was maybe the wire is too high loss ?

Idk it was crappy hook Up wire.

Anyway I ended up just using the Chromecast short 3.5 cable. And melting a hole to plug it into the speaker.
For power I had to be a bit more creative, I wanted to run it off the existing power supply so it would be self contained.

A quick look at the main board of the speaker reveals a header with an i2c? Port on it. Including 3.3v VCC and GND!

I made a quick micro USB to wire lead and hooked up the Chromecast to the 3.3v line to see if that was enough to power it up.

Unfortunately it seems Chromecast needs more current than this port could give.

The Chromecast would power up then keep cycling between orange and white led, I think this is some sort of insufficient power indicator. Else it was just rebooting over and over haha.
Next I tried hooking up a 3.3v to 5v boost converter to see if it was just the low voltage causing the problem, but this has the same effect.

I concluded that this connector probably didn’t have enough current to power the Chromecast, which normally wants at least a good 5v 700-1000mAh of current.
I decided I would have to pull my power from the main +15v input, which obviously has to be stepped down.

So I grabbed a AMS1117 5V voltage regulator, which from memory the data sheet says can handle up to 12v (she’ll be right mate) and can output up to 1amp
Hooking this up between the 15v main input and and h Chromecast seemed to result in the same thing as before though …
It’s at this point I was wishing I had a nice big LM7805 or something.
I did however have an “adjustable voltage regulator module” from aliexpress, which was big and beefy. I wired this up to the 15v and then hooked up my multimeter to its output, it was showing 15v.

I turned it’s pot until it was a stable 5.02v which is close enough and then wired the micro USB to that.

Hooked up the Chromecast and it worked !!!

I shoved it all inside the speaker and reassembled it all.
With the speaker reassembled I gave it a test and all looked great!

Well worked great.
I remembered then, that Home Assistant had the ability to sent TTS to my TV Chromecast, I had disabled discovery of Chromecast because it kept showing up in the main view and nothing was using it,

I wondered if it could send TTS to the Chromecast audio??

So I re enabled discovery of Chromecast and restarted Home Assistant to see if it would pick it up. It did! And I had the option for TTS!

I did some setup stuff in Home Assistant that I didn’t document, but it was pretty straightforward!
Now I can send verbal notifications to the speaker’s by calling the tts service in home assistant, specifying the speaker media_player.wifi_speaker and giving it a message!

I also put another Chromecast Audio hooked up to a small Bluetooth speaker via a 3.5mm cable in the bathroom, so I can have notifications in there (this is also the only room with a sensor node at the moment!)

a notification in there could be: If the humidity reaches 100% and the window is detected as closed, verbally say ‘Please ensure window is opened to prevent mould build up’

or something like that.

 

Home Assistant is also able to message me via Facebook Messenger, which is handy for notifications away from home!
I might do another write up on Home Assistant another time though, once I fully understand it!

 

Thanks for reading ๐Ÿ™‚

Some pictures follow:

ESP8266 Arduino Pro Microย 

I was looking everybody’s favorite online store for Atmega32u4 based MCUs for a friend and stumbled upon this little guy:

http://ebay.com.au/itm/191890522764

It sure as heck isn’t a 32u4 but it is rather interesting !

It looks like it’s an esp8266 module in the form factor of an arduino pro micro, I’m a bit put off by the $20~ price tag but it would be interesting to see if they have routed the pins to the corresponding ones as for the pro micro. 

Then you could use it as a drop in replacement without even having to change the code, except you would suddenly have the option to add wifi to your project! 
IoT is definitely getting much easier these days to implement than when this blog first started! Hahaha
No more fumbling around with an Arduino Uno with Ethernet and then little dodgy radios talking to other Unos with the same radio…..

Oh man that was hell