The Cookie Machine - Click here to drag window

DUMMY TEXT - Real text set in assets/js/theCookieMachine.js

If you can read me, I'm broken!

ToC Skip

Introduction

HomA (Home Automation) automatically searches LAN, WiFi and Bluetooth. It allows you to turn devices on and off from your computer. Devices such as:

Extra features


Top ToS Skip

Table of Contents


Top ToS ToC Skip

Menus

There are two types of menus in HomA:

The top-left corner of HomA’s main window contains four dropdown menus; File, Edit, View and Tools. Click on the name and the dropdown menu options appear:

File Dropdown Menu

Some options will be disabled out when they are not applicable. For example, the Save Playlist and Close Playlist options are disabled (greyed out) until a Playlist is opened.

Edit Dropdown Menu

View Dropdown Menu

Tools Dropdown Menu


Right-Click Popup Menus

In the Network Devices view, you can move the mouse over a device and right click for a context-sensitive popup menu.

All devices have these menu options:

Some devices such as a Sony TV and a Bluetooth LED have extra right-click popup menu options.

Sample Right-Click Popup Menu

Here is a sample screenshot of right-clicking on a Bluetooth LED Light Strip:

Right-click menu Bluetooth LED
Right-click menu Bluetooth LED.png

Bluetooth LED Light Strip

When you right-click on a Bluetooth LED Light Strip, the following menu options appear:

Sony Bravia Professional Display TV

When you right-click on a Sony Bravia Professional Display TV, the following menu options appear:

Google Android TV

When you right-click on a Google Android TV, the following menu options appear:

Laptop Display

When you right-click on a Laptop Display, the following menu options appear:

Laptop Base or Computer

When you right-click on a Laptop Base or your computer, the following menu options appear:


HomA Help Buttons

HomA windows contain “Help” buttons that:

Help Button Sample Video

Help Button Sample Video Highlights


Top ToS ToC Skip

Rediscover Now

Rediscover Now is accessed from the Dropdown Menus at the top of the screen. Select:

Rediscovery is automatically run every minute. However, you can run it immediately using Rediscover Now.

If you use your TV remote to turn the TV on or off, HomA will not register the fact for a minute. To force HomA to see the power state change, run Rediscover Now.

If you connect a new device to your network, HomA will not register it for a minute. To force HomA to see the new device immediately, run Rediscover Now.

Sample Rediscover Now Video

The above video shows how the Rediscover Now feature is activated with the mouse. The network searched by IP address and each matching device in HomA is highlighted in green. The power status is checked and set to:


How Network Devices are discovered

Most Network Devices are discovered using arp -a, getent hosts, ip addr and hostnamectl status. The exception is a Bluetooth device where you need to specify the MAC address. Another exception is your computer which is already running HomA in the first place.


arp -a Capabilities

If you type arp -a at the command line your network devices are displayed. For example:

$ arp -a

SONY.Light     (192.168.0.15) at 50:d4:f7:eb:41:35 [ether] on enp59s0
Hitronhub.home (192.168.0.1)  at a8:4e:3f:82:98:b2 [ether] on enp59s0
SONY.LAN       (192.168.0.19) at ac:9b:0a:df:3f:d9 [ether] on enp59s0
TCL.LAN        (192.168.0.17) at c0:79:82:41:2f:1f [ether] on enp59s0
F3_Pro         (192.168.0.22) at 00:fe:1e:2a:5b:eb [ether] on enp59s0
TCL.Light      (192.168.0.20) at 50:d4:f7:eb:46:7c [ether] on enp59s0

NOTE:  Lines above have spaces inserted between fields for column alignment.

The fields on each arp line (in order of appearance) are:


getent hosts Capabilities

The program getent is a Linux command that reads the file /etc/hosts. When you type getent hosts at the command line you will see something like this:

127.0.0.1       localhost
127.0.1.1       Alien
192.168.0.1     Hitronhub.home Admin                          a8:4e:3f:82:98:b2
192.168.0.10    Alien          AW 17R3 WiFi                   9c:b6:d0:10:37:f7
192.168.0.12    Alien          AW 17R3 Ethernet               28:f1:0e:2a:1a:ed
192.168.0.11    Phone          Moto E4 Plus                   fc:d4:36:ea:82:36
192.168.0.13    Dell           Inspiron 17R-SE-7720 Ethernet  5c:f9:dd:5c:9c:53
192.168.0.14    Dell           Inspiron 17R-SE-7720 WiFi      60:6c:66:86:de:bd
192.168.0.15    SONY.Light     hs100 Sony TV Bias Light       50:d4:f7:eb:41:35
192.168.0.16    SONY.WiFi      Sony Bravia KDL TV WiFi        18:4f:32:8d:aa:97
192.168.0.17    TCL.LAN        TCL / Google TV Ethernet       c0:79:82:41:2f:1f
192.168.0.18    TCL.WiFi       TCL / Google TV WiFi           fc:d4:36:ea:82:36
192.168.0.19    SONY.LAN       Sony Bravia KDL TV Ethernet    ac:9b:0a:df:3f:d9
192.168.0.20    TCL.Light      hs100 TCL TV Bias Light        50:d4:f7:eb:46:7c
192.168.0.21    TCL.LAN2       amazon-54d22a1a9.hitronhub     98:28:a6:ba:76:f6
192.168.0.22    F3_Pro         Umidigi F3 Pro 5G              46:f0:89:36:f5:1d
192.168.0.254   Router.Login   Hitron Technology              00:05:ca:00:00:09

NOTE: extra spacing inserted above for readability.

The fields on each arp line (in order of appearance) are:

The MAC Address is not in the typical /etc/hosts file. It is required for you to add it in order to allow HomA to link rows to arp output and override dynamic IP addresses.


ip addr Capabilities

The program ip will show / manipulate routing, devices, policy routing and tunnels. When you type ip addr at the command line you will see something like this:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
2: enp59s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 28:f1:0e:2a:1a:ed brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.12/24 brd 192.168.0.255 scope global dynamic enp59s0
       valid_lft 594184sec preferred_lft 594184sec
    inet6 fe80::2af1:eff:fe2a:1aed/64 scope link
       valid_lft forever preferred_lft forever
3: wlp60s0: <BROADCAST,MULTICAST> mtu 1500 qdisc mq state DOWN group default qlen 1000
    link/ether 9c:b6:d0:10:37:f7 brd ff:ff:ff:ff:ff:ff

HomA looks at relevant lines in ip addr:


hostnamectl status Capabilities

When you type hostnamectl status at the command line you will see something like this:

   Static hostname: alien
   Pretty hostname: Dell AW17R3
         Icon name: computer-laptop
           Chassis: laptop
        Machine ID: 1ff17e6df1874fb3b2a75e669fa978f1
           Boot ID: 562af12a56c640faa3e74c465277267d
  Operating System: Ubuntu 16.04.7 LTS
            Kernel: Linux 4.14.216-0414216-generic
      Architecture: x86-64

HomA only looks at one line in hostnamectl status:


Top ToS ToC Skip

Edit Preferences

To edit Preferences, access the Dropdown Menus at the top of the screen. Select:

Sample Edit Preferences Notebook Video

The above video walks through all the tabs in the Edit Preferences notebook. The fields in each tab are documented in the sections below.

Bonus footage shows how the Sensors and Devices views are toggled with the button at the bottom of the window:

Sensors

Sensors




Devices

Devices


Preferences Notebook Tabs

NOTES:


Preferences Notebook Sony TV tab:

Sony TV Description
SONY_PWD Sony TV REST API Password. Default “123”.
CURL_TIME How long to wait for curl command to finish. Default “0.2”.
KDL_TV HomA internal type code for Sony TV. Static value is “20”.

Preferences Notebook Google TV tab:

Goggle TV Description
ADB_CON_TIME ADB connection time. Default “0.3”.
ADB_PWR_TIME ADB power on / power off time. Default “2.0”.
ADB_KEY_TIME ADB remote control keycode wait time. Default “5.0”.
ADB_MAGIC_TIME Wake-on-lan command wait time. Default is “0.2”.
TCL_TV TCL / Google Android TV type code. Static value is “30”.

Preferences Notebook Smart Plug tab:

Smart Plug Description
PLUG_TIME TP-Link/Kasa Smart Plug wait time. Default is “2.0”
HS1_SP Smart Plug type code. Static value is “10”

Preferences Notebook LED Lights tab:

LED Lights Description
LED_LIGHTS_MAC MAC Address of Bluetooth LED Light Strip. Must be entered.
Use View Bluetooth Devices to see MAC addresses.
LED_LIGHTS_STARTUP On HomA startup, lights are turned on (“1”) or off (“0”).
LED_LIGHTS_COLOR Last used color when Set Bluetooth LED Color was applied.
LED_RED+GREEN_ADJ When Red and Green are mixed together, boost red by 50%.
Necessary for Happy Lighting showing light green instead of yellow.
BLUETOOTH_SCAN_TIME How many seconds to scan for Bluetooth devices.
Longer scan time may reveal more devices.
BLE_LS Bluetooth Low Energy LED Light Strip type code value is “40”.
Value used internally by HomA and cannot be changed.

Preferences Notebook Miscellaneous tab:

Miscellaneous Description
TIMER_SEC Seconds to run “Tools”, “Timer”. Default “600” (ten minutes).
TIMER_ALARM .wav filename to play when timer ends. Default “Alarm_01.wav”.
SENSOR_CHECK How often the sensors command is run. Defaults to 1 second.
SENSOR_LOG How often to log sensor values. Default “3600” every hour.
FAN_GRANULAR Log sensor override when fan speed changes > x. Default “200” RPM.

Preferences Notebook Refresh tab:

Refresh Description
CONFIG_FNAME Configuration filename. Static value is “config.json”
DEVICES_FNAME Previously discovered network devices. Static value “devices.json”.
VIEW_ORDER_FNAME Saved order network devices are display in. Value “view_order.json”.
REFRESH_MS How many milliseconds screen is refreshed. Default “16” ms.
REDISCOVERY_SECONDS How often new network devices are checked. Default “60” seconds.
RESUME_TEST_SECONDS How many “disappearing” seconds represent suspend. Default “30”.
RESUME_DELAY_RESTART How many seconds after resume for network on-line. Default “5”.

Preferences Notebook Computer tab:

Computer Description
DESKTOP Desktop computer (anything not a laptop) type code is “100”.
LAPTOP_B Laptop Base (“brains”) CPU, GPU, Fans, USB, etc. Type code “110”.
LAPTOP_D Laptop Display type code. Static value is “120”.
BACKLIGHT_NAME Automatically obtained from /sys/class/backlight.
BACKLIGHT_ON Value for laptop display backlight on. Default is “0”.
BACKLIGHT_OFF Value for laptop display backlight off. Default is “4”.
POWER_OFF_CMD_LIST Command and arguments to suspend. Default systemctl suspend.
POWER_OFF_EXCL_LIST Devices HomA doesn’t need to power on/off during resume/suspend.

The POWER_OFF_EXCL_LIST field contains three type codes for devices that do not need to be powered off. These devices are powered down automatically during system suspend:


Top ToS ToC Skip

View Bluetooth LED Breathing Colors Statistics

The View Breathing Statistics window displays in realtime the color values (Red, Green and Blue) communicated to the LED Light Strips via the computer’s Bluetooth adapter.

Sample Breathing Statistics Video

NOTE: After clicking play, move the mouse off the video in order to see the color changing button bar at the bottom of the video.


View Breathing Statistics Window Fields

Window Field Description
Dimmest value Lowest LED value used is 4. Range is 0 to 255.
Brightest value Highest LED value used is 30. Range is 0 to 255.
Dimmest hold seconds Number of seconds to hold dimmest value used is 1.5 seconds.
Brightest hold seconds Number of seconds to hold brightest value used is 0.5 seconds.
Breathe duration How much time is spent moving from dimmest to brightest.
Step duration How much time is spent on each color change. Value 0.275.
Step count Calculated by Breathe duration (6.0) / Step duration (0.275)
Step value Calculated by Breathe duration (6.0) / Step count (21)
Red Current red value of LED. 0 = Off.
Green Current green value of LED. 0 = Off.
Blue Current blue value of LED. 0 = Off.
Sunlight Percentage Range 0% (nighttime) to 100% (full sunlight). Controlled by
GNOME Nightlight or Pippim Eyesome. Percentage boosts the
the dimmest and brightest values but not the number of steps.
Set LED Color Time spent setting LED colors.
Set LED Sleep After setting LED color, how much time sleeping before next.
Regular Refresh This refresh allows screen updating and mouse input.
Fast Refresh This refresh appears to “freeze” HomA but keeps CPU use low.
LED Failures How many times Bluetooth lost communication for 1 second.
MAX_FAIL How many sequential LED failures until Breathing quits.



Breathing Statistics Control Parameters

The first five fields are parameters you can control:

Field Internal argument name
Dimmest value low value is 4. If too low light will be off.
Brightest value high value is 30. Max is 255 but is way to bright.
Dimmest hold seconds bots value is 1.5. Abbreviation is for “bottom seconds”.
Brightest hold seconds tops value is 0.5. Abbreviation is for “top seconds”.
Breathe duration span value is 6.0. Longer span allows gradual color change.
Step duration step value is 0.275. Longer step allows regular refresh.



# homa.py - BluetoothLedLightStrip(DeviceCommonSelf) class - breathColors() method:

def breatheColors(self, low=4, high=30, span=6.0, step=0.275, bots=1.5, tops=0.5):

Top ToS ToC Skip

View Bluetooth Devices

In order to control Bluetooth Low Energy (BLE) LED Light Strips, you need to enter the MAC address using Edit Preferences. In order to discover the MAC address use the View Bluetooth Devices feature found on the View dropdown menu.


Sample View Bluetooth Devices Window

Here is a sample window that appears:

HomA - View Bluetooth Devices
HomA - View Bluetooth Devices.png

The device name QHM-T095 is highlighted in yellow and the MAC address is highlighted in red. For devices to appear in the window, they MUST BE powered on.

The highlighting appears after HomA knows the MAC address for your Bluetooth LED Light Strip. If the MAC address hasn’t been entered into HomA, via the Edit Preferences feature, there is NO highlighting.

After the device name, E.G. QHM-T095, appears the number of times the device was discovered. E.G. (4) means the device was discovered 4 times.

The discovery period defaults to 10 seconds. Over that period, a given device can be discovered many times.

Do not be surprised if there are many device names you don’t recognize. These devices belong to your neighbor(s) or passerby’s. For example, someone passing by could have Bluetooth Earbuds or a Bluetooth Smartwatch.


Use Happy Lighting to Discover LED Device Name

The smartphone Happy Lighting App can display the Bluetooth LED Light Strip device name:

HomA Happy Lighting Device
HomA Happy Lighting Device.png

The Happy Lighting smartphone app works with many common Bluetooth Smart LED Light Strips.

For the App to work, HomA cannot be running and connected to the LED Light Strip using Bluetooth.

In the App, selected the icon with three green horizontal lines. Then click “My Device”.

In this screenshot, the device name is QHM-T095.

After running the Happy Lighting App, exit it so it doesn’t conflict with HomA operations.


Enter Bluetooth LED MAC Address in HomA

You need to enter the discovered Bluetooth LED MAC address into HomA using the Edit Preferences feature:

HomA Enter Bluetooth LED MAC Address
HomA Enter Bluetooth LED MAC Address.png

After entering the MAC address you can select the File dropdown menu option Rediscover Now. The Bluetooth LED Light Strips should be added to the bottom of the Network Devices view. If not, restart HomA.


Top ToS ToC Skip

Installation

HomA (Home Automation) is found in the HomA GitHub Repository ⧉ 🔗.

Click the above link and then click the green code button shown below:

HomA - Download ZIP
HomA - Download ZIP.png

Open a terminal window and type these two commands:

/home/<USER>/HomA-main/src/homa-indicator.py &
/home/<USER>/HomA-main/src/homa.py

WHERE: <USER> is your username.

The first command runs HomA Indicator in the System Tray / Task Bar as a background job. When you close the terminal, HomA Indicator will disappear from the System Tray. Later, you can add HomA Indicator to your Startup Applications Preferences in Ubuntu. Then it will be automatically started after you log in and stay there until you log out.

The second command runs HomA. Although you can run HomA via the HomA Indicator, it is recommended the first few times you use HomA in the terminal so you can see any unusual error messages.

For example, if you see something like “module serial not found”, type:

sudo apt install python3-serial.

If you are on Ubuntu 16.04 it would be python-serial (without the 3).

Read more about installing dependencies in the next section.

Under Construction

Under Construction.png
Under Construction.png

HomA is still under construction. Installation requires manually downloading files from GitHub and installing any missing dependencies with apt get install in Debian/Ubuntu or pip install on other Operating Systems.

Requirements include:

For granular sunrise/sunset brightness control you can use Pippim Eyesome.

IMPORTANT NOTES:


Top ToS ToC Skip

How to Start HomA

You can start homa.py from the command line, from a desktop icon or start it from homa-indicator.py.

In this section, the examples assume HomA was installed to /home/<USER>/HomA-main. Where <USER> is your User Id.

Starting HomA From the Command Line

If HomA is not in your path, change to the directory where HomA is installed:

cd /home/<USER>/HomA-main/src

Then type homa.py and press Enter:

$ homa.py

  ######################################################
 //////////////                            \\\\\\\\\\\\\\
<<<<<<<<<<<<<<    HomA - Home Automation    >>>>>>>>>>>>>>
 \\\\\\\\\\\\\\                            //////////////
  ######################################################
                    Started: 4:18 PM

= = = = = System Monitor Processor Temps & Fans = = = = =
 Seconds | CPU Temp Fan RPM | GPU Temp Fan RPM |   Time  
-------- | ---------------- | ---------------- | --------
    7.67 |  75.0°C 4500 RPM |  77.0°C 4300 RPM |  4:18 PM
 3608.15 |  70.0°C 4500 RPM |  74.0°C 4300 RPM |  5:18 PM
 7208.30 |  75.0°C 4500 RPM |  77.0°C 4300 RPM |  6:18 PM
 9003.52 |  95.0°C 4700 RPM |  82.0°C 4600 RPM |  6:48 PM
 9005.66 |  86.0°C 5000 RPM |  81.0°C 4800 RPM |  6:48 PM
 9933.77 |  75.0°C 5300 RPM |  75.0°C 5000 RPM |  7:04 PM

When homa.py is called with no parameters there are minimal lines printed. The sensors for processor temperature (CPU & GPU) and fan speed for each processor is printed. Sensors are always logged each hour and whenever a fan’s speed changes by more than 200 RPM:

homa.py Command Line Parameters

Optional parameters (A.K.A. arguments) can be passed to homa.py:

Parameter Usage
-s -s invokes silent mode. Nothing will print to the console.
-f -f invokes fast mode. Network discovery is delayed.
-v -v invokes verbose mode. Method names are printed.
-vv -vv Extra verbosity. Command names are printed.
-vvv -vvv Super verbosity. Results of every command are printed.

When homa-indicator.py calls homa.py, it uses the parameters -s -f.

If homa.py is not performing as expected, use -v, -vv or -vvv in that order to narrow down the problem.


Starting HomA using homa-indicator.py

homa-indicator.py is an “Application Indicator” that sits in the System Tray / Task Bar. There are no optional parameters when calling it. Simply type:

/home/<USER>/HomA-main/src/homa-indicator.py

Using your mouse, left-click or right-click on the icon in the system tray as the video below shows:

The HomA option opens the HomA application at the mouse position. If HomA is already running, it’s window is moved to the mouse position.

The eyesome option only appears when Pippim’s Eyesome is active. When selected, Eyesome Setup opens at the mouse position.

The quit option removes HomA Indicator from the system tray / taskbar. This doesn’t close the HomA application if already opened.


Top ToS ToC Skip

How to Open HomA From the System Tray

The program homa-indicator.py is an “Application Indicator” that runs in the System Tray a.k.a. the Taskbar.

Here is a video showing HomA, already running in one monitor, being moved to another monitor:

The ability to call HomA from any monitor is paramount, because you can use HomA to turn off a monitor it is running on. To turn the monitor back on, you must be able to call HomA from another monitor.

The video shows how the HomA main window is moved, and then the child window View Breathing Statistics is moved overtop. Child windows are automatically moved when the main window is moved. When you try to click on the main window, any child windows are automatically moved overtop. This includes message dialog boxes that might otherwise be “buried” under the main window.


Where HomA Opens When Called From the System Tray

When you call HomA from the System Tray, its position is controlled by the following line in homa-indicator.py:

MOVE_WINDOW_RIGHT_ADJUST = -40  # Move Window Top Right Adjustment

The right edge of the HomA window is the current mouse position plus the adjustment offset. The value shown is -40 so the right edge will be 40 pixels to the left of the current mouse position.


Top ToS ToC Skip

Custom Images

If you grab an image for your device and it is in .webp format you have to convert it to .jpeg or .png format for HomA to display it.

For example, you have a file called hitron CGNM-2250.webp and there are no .webp image converters on your machine:

$ sudo apt install webp

The following additional packages will be installed:
  freeglut3
The following NEW packages will be installed:
  freeglut3 webp
0 upgraded, 2 newly installed, 0 to remove and 2 not upgraded.
Need to get 135 kB of archives.
After this operation, 521 kB of additional disk space will be used.
Do you want to continue? [Y/n] y

$ dwebp "hitron CGNM-2250.webp" -o "hitron CGNM-2250.png"

Decoded hitron CGNM-2250.webp. Dimensions: 1000 x 750 . Format: lossy. Now saving...
Saved file hitron CGNM-2250.png

Credit: https://stackoverflow.com/a/70641330/6929343


Top ToS ToC Skip

Router Modems

There are five types of modems including cable modems, telephone modems, satellite modems, dial modem and digital subscriber line. What is the purpose of a modem? The primary purpose of a modem is to facilitate the connection between a computer or network and an Internet service provider (ISP).Jan 23, 2025

hitron CGNM-2250.png
Hitron Cable Modem Router CGNM-2250

Top ToS ToC Skip

Turn Off Router

Turning off the router doesn’t physically power it off. It merely disconnects your computer from the router.

When you stop the “NetworkManager.service” on a Linux system, your computer will lose its ability to automatically manage network connections, meaning you will not be able to connect to Wi-Fi or wired networks through the graphical user interface or standard network management tools as Network Manager handles the discovery, connection, and configuration of network interfaces; essentially, your system will be unable to connect to the internet unless you manually configure network settings directly in the system’s network interface configuration files.

Key points about stopping NetworkManager:

No automatic connections:

You will need to manually configure network interfaces and connections using the system’s traditional network configuration files, like /etc/network/interfaces.

No network discovery:

Network Manager actively searches for available networks, so stopping it prevents your system from automatically detecting nearby Wi-Fi networks.

Potential for manual configuration complexity:

Depending on your network setup, manually configuring network settings can be a more complex process compared to using Network Manager.

How to stop NetworkManager:

Command: sudo systemctl stop NetworkManager

To start NetworkManager.service, replace stop with start


Top ToS ToC Skip

Top ToS ToC Skip

Top ToS ToC Skip

Top ToS ToC Skip

Top ToS ToC Skip

Top ToS ToC Skip

Top ToS ToC Skip

Top ToS ToC