Background

As a kid, I was fortunate to have access to computer in early 90s. While experimenting and learning from early days of CGA display, 386 processor, and MS DOS OS it grew my interest towards computers and programming.

I started learning programming languages like GW basic, LOGO, FOX PRO and it quickly became my passion to just code. The language C was the first main stream language I learned.

2002 | Pixel Run C

After couple of years of experimenting I wrote my own game named Pixel Run in C language using graphics APIs (inspired by the game from the time called Light Cycle).

2003 | PixelRun VB6

Having hands on with Windows and I learned the power of GUI which got me into Visual Basic 6. Rewrote the C game Pixel Run in VB6 with some added features, nicer graphics and sounds (I know who writes a game in VB :); back in time VB was the only feature rich language I knew).

2004 – 2008 | Freelance projects

Through my academics I got access to various other programming languages. and I started working on few projects as a freelancing job. These are NOT my academic projects but the software written and meant to be used in production.

Few data and reporting applications using C#.NET, MS Access & Crystal reports

  • Fees collection and tracking system
  • A transport and parcel tracking application
  • Insurance policy issuance application
  •  

2005 | Pick and place robot

I took part in college robotics competitions and built a few robots by reusing components from scrap (VCR gear system for steering robotic car, reuse electronics from toy RC cars and put some relays to drive higher power robotic car)

2009 | G-Trigger Windows Mobile 6

A random idea – one of the features I was missing on my HTC Diamond Windows phone at the time, was to quickly launch favorite actions. It occurred to me that it would be cool if I can shake the phone in particular way to activate defined actions. I discovered that someone has reverse engineered and exposed the HTC device’s gravity sensor data through API. I used the same and created a C# .NET Windows mobile app called G-Trigger. The purpose of this app was to continuously poll gravity sensor x, y, z data (learning – polling continuously data on an embedded device is not a good idea) and trigger defined action based on specific shake gesture pattern. The various shake gesture patterns were identified by plotting graphs of x, y, z coordinate values returned by sensor over time. Basically endless trial and error exercise. The outcome was a successful app which was tested by many XDA developers community members.

I’m surprised that the forum post on XDA developers is still live: https://forum.xda-developers.com/t/app-10-jul-09-g-trigger-v0-9-2-beta-g-sensor-based-shake-detector.494267/

2011 | G-Trigger Android

With unfortunate demise of my favorite mobile OS – Windows Mobile 6.x, I moved on with android device and realized that I miss my G-Trigger app. As I could not find similar alternative app at the time I thought why not port the .NET mobile app in JAVA android app. And I did. It turned out not too bad. However favoring other priorities in life the project was left behind.

Here’s a glimpse of the G-trigger app on android.

 

2018 onwards | Home Automation

I started my home automation journey in late 2018 taking baby steps at time. There was a simple and clear goal in my mind:

To create a non-intrusive, privacy focused, home automation which can be deployed a piece-by-piece.

Being a big fan of open source software and python, I came across Home Assistant as a central brains to the system. This turned out to be a great fit for my goal. I started making small independent sensors using diy electronics as input to my home automation. I used ESP based ESP8266/ESP32 micro controllers to keep watch on surrounding events and integrate these data to the Home Assistant. I designed and retrofitted device controller system within Indian home electrical boxes.

With this journey, I learned how IoT devices work, designing own circuits and creating customized PCBs.

The home assistant server is setup with privacy in mind. All the critical automations are performed 100% in a local network. During the internet outage, most of the automations would be functional with exceptions like mobile notifications, voice assistant announcements, etc. The home assistant app is not directly exposed to internet. Instead a reverse SSH tunnel is created from home hosted application to a known AWS EC2 instance. Then within the EC2 instance the ports are reverse proxied via caddy web server. This enables an ability to stop exposing home assistant server by just turning down the EC2 instance.

Few of my successful automations

  • Turn off lights/fans when room is unoccupied – turn back on with exact same settings when occupied
  • Softly brighten up the room with an ambient light at night when someone gets out of bed
  • Default room lights to daylight white (6500K temp) during day time and post sunset default lights to warm white (4000K temp)
  • Voice and mobile notification reminders for doors left open in the house

My automations are heavy on python based app daemon scripts. For a basic automation work-flow I define a generic script with customizable inputs and then scale up the automation by creating multiple instances of this script with various inputs.

Examples of my app daemon automation scripts

Manage occupancy with intelligence

This app can be configured with various boundary, presence sensors and timeout parameters to have customized occupancy sensors for a particular room. Idea is to keep occupancy of a room active longer if someone stays in the room longer. For short visits in a room lights can be turned off quickly. But if someone stays in a room for long time and exits then lights would stay on a little longer anticipating that person will return to the room after a short trip. The occupancy time is also decided based on last detection of boundary motion sensor vs in room presence sensor.

Sample YAML configuration of this app

bedroom:
sleep_time_entity: input_boolean.bedroom_sleep_time
occupancy_delay_off_minimum: 300
occupancy_delay_off_maximum: 1800
boundary_sensors:
- entity_id: binary_sensor.tuya_contact_bedroom_contact
is_door: true
presence_sensors:
- entity_id: binary_sensor.tuya_human_presence_24g_a4c1_presence
false_alarm_notification: true
office:
occupancy_delay_off_minimum: 30
occupancy_delay_off_maximum: 1200
boundary_sensors:
- entity_id: binary_sensor.tuya_contact_office_door
is_door: true
 - entity_id: binary_sensor.tuya_door_pir
presence_sensors:
- entity_id: binary_sensor.third_reality_pir_2_occupancy
- entity_id: binary_sensor.tuya_human_presence_office
false_alarm_notification: false
Easy configuration of RF/Zigbee remote controllers and buttons

An app to configure various buttons with actions using simple YAML data structure. This is to easily scale up with different buttons and remote controllers.

- name: Zigbee2MQTT single button bedroom
on_delay: 0.5
event: MQTT_MESSAGE
id_fields:
topic: "zigbee2mqtt/bedroom_button/action"
buttons:
- command: single
entity_id: light.office_standing_lamp
action: toggle
skip_off_duration: 1
on_data:
color_temp: 190
brightness_pct: 100
- command: double
entity_id: light.office_standing_lamp
action: on
on_data:
- color_temp: 450
brightness_pct: 50
- color_temp: 190
brightness_pct: 100
- command: 'hold'
stop_command: 'release'
entity_id: light.office_standing_lamp
action: dynamic_brightness
dynamic_interval: 0.5
on_data:
brightness_step_pct: -15
transition: 0.5
min_brightness_pct: 17
- name: RF single white with black circle inside
remote_prefix: cfd8
remote_receiver_event: esphome.spago_rf_bridge_rf
buzzer_service: esphome.sensor_node_play_rtttl
on_delay: 0.6
buttons:
- hex_id: '61'
action: scene-cycle
night_entity: binary_sensor.is_night_time
cycle_timeout: 3
cycle_scenes_day:
- scene.bedroom_2_sleep
- scene.bedroom_2_cool_white
- scene.bedroom_2_warm_white
- scene.bedroom_2_night_light
cycle_scenes_night:
- scene.bedroom_2_sleep
- scene.bedroom_2_night_light
- scene.bedroom_2_warm_white
- scene.bedroom_2_cool_white

Door open too long

An app to send mobile notifications and announce in voice assistants about the door left open in the house.

- entity_id: binary_sensor.tuya_garage_sensor_contact
  notify_change: true
  announce_change: true
- entity_id: binary_sensor.tuya_front_door_sensor_contact
  notify_change: true
- entity_id: binary_sensor.back_slider_contact
  notify_change: true
  too_long_duration_min: 20
  too_long_open_reminder_min: 60

2020 onwards | Home Server Lab

Lately I have been working on my home server lab setup. I started with a small raspberry pi hosting home assistant application then a personal computer desktop and now to the fully racked servers.

I use Proxmox as a hypervisor combined with redundant hardware to have high availability and fail-over-mode for certain applications.

So far I have been running below applications

  • OpenMediaVault – NAS server
  • Home Assistant – home automation controller
  • PhotoPrism – manage my photos
  • Syncthing – to sync files instantly between devices
  • AdGuard – to block malicious ads and manage home network with custom internal URLs
  • Grafana – to visualize health of home lab infrastructure 
  •  

Primary hardware stack includes

  • Unifi Dream Machine Pro SE for network management
  • Datto SIRIS 4 1 RU server
  • HP EliteDesk 800 G4
  • HP DL360 G5 1 RU server
  • Raspberry PI

 

Thanks for reading my story!