Press "Enter" to skip to content

Posts published in “Networking”

Controlling the Elecraft K4 and KPA1500 with Home Assistant

For awhile now I have wanted to be able to have my “Goodnight” scene in HomeAssistant turn off my network attached ham gear. I finally had a chance to do some experimenting and created this config to turn on and off the KPA1500.This sends a command via UDP to the amp to turn it off and uses Wake_On_LAN to turn it on. A similar thing could be added for other device types. This is added to the configuration.yaml file.

Put your real MAC address of the amp next to mac. If you mac address is 54:10:01:02:0A:0B, then the line will read mac: 54:10:01:02:0A:0B

switch:
– platform: wake_on_lan
name: Elecraft KPA1500 Amplifier
mac: 54:10:01:02:0A:0B
turn_off:
service: shell_command.turn_off_kpa1500shell_command:
turn_off_kpa1500: “echo ‘^ON0;’ | nc -u 192.168.1.2 1500”

It assumed the IP address of your amp is 192.168.1.2 and it is listening on the default port 1500. Note this is a UDP connection so the command is sent with netcat (nc). ^ON0; turns off the amp. Reference to wake_on_LAN in HomeAssistant is here: https://www.home-assistant.io/integrations/wake_on_lan/. This also assumes you are on the same network as the amplifier.

If you are doing this from a script on a Raspberry PI for example, you can use etherwake (sudo apt-get install etherwake)

Now for the K4…
Since the K4 does not yet support Wake_On_LAN, you have to resort to the old ways to remotely turn on the radio. But once the radio is on, then HA can check the status and allow you to turn it off. So for my use case, I can send a command to the radio to turn off as part of my ham shack off scene (goodnight).
In the switch section of the configuration.yaml, add the following:
– platform: telnet
    switches:
      k4:
        name: “Elecraft K4 Transceiver”
        resource: “192.168.1.108”
        port: 9200
        command_off: “PS0;”
        command_on: “PS1;”
        command_state: “PS;”
        value_template: “{{ ‘PS1’ in value }}”
        timeout: 0.9

Network upgrades

While it pains me to say it, the cable Internet service is fairly reliable here. The one BIG exception is when we have power outages. One can imagine that Spectrum has never heard of a UPS to use on their router along the way between each home and their cable plant. When we get power outages here in Madeira Beach due to thunderstorms, it is not unusual for the Internet to go out. Sometimes it is just a few seconds and other times it has gone into the minutes. We had a case in March 2021 where the Internet was down for 6 hours (by far the largest time out of service in the 5 years we have been here). The following is a bit of background on the network changes using UniFi equipment. The second post in this series goes into the LTE network backup device and how the VLANs ensure that things like TVs and other heavy streaming users do not utilize the LTE backup (and hit the data limit I have on my 5 GB/month plan). But first–the gear and VLANs.

Coupled with this issues, I discovered that the UPS in my LAN rack was not working properly. I suspected a dead battery but it has been intermittent. So while it may have been overkill, I decided to pull the UPS out of the cabinet (Cyber Power brand which I now disfavor). I replaced it with an APC UPS with a network interface for monitoring.

At the same time, we also removed two Ubiquiti 24 port POE EdgeSwitches and installed a single UniFi 48 port POE switch. This was to get the switch more in line with the UniFi framework (since I already have the UDM Pro). This lets me setup VLANs a bit easier. I could have still done what I needed with the EdgeSwitches but I traded cost for ease of configuration.

The goal of all this was to allow me to easily setup multiple networks to segment the traffic on my LAN. But first, some background is necessary.

I have many Internet of Things (IoT) devices like WeMo lights switches, Amazon Echos (Alexa), Lutron Caseta switches, a Ring doorbell (hardwired by POE), the Kohler generator, smart thermostats, a sprinkle controller and some other miscellaneous items. A common security practice is to set these devices up so they cannot access the main LAN. This is based on the idea that if there were a security issue in one of these IoT devices (such as its is compromised by the proverbial hacker) they could not access any devices except other IoT devices. So the question is how do we do this?

The answer is VLANs. In the UniFi world, these are setup a unique networks. The UDM Pro abstracts VLANs into different Networks. Each network is served up am IP address from a different network (192.168.X.Y) where each network is a different value (or subnet) of X. With some additional firewall rules, the “sub” networks cannot talk to the main LAN network. There are some exceptions for the main DNS servers (PiHoles) which are on the main LAN. A firewall rule also prevents the sub networks from accessing the ssh and web interfaces on the UDM Pro gateway.

My next post will be about using an LTE backup device from UniFi to make sure if the main Internet goes down everything still has connectivity. Well, almost everything as we do not want Netflix to use LTE as a backup–contrary to the conventional wisdom by others in the house, NetFlix is not critical :).

Networking Info for the UDM Pro No Internet Detected error

Just a note for anyone else searching for UDM Pro No Internet Detected issue.

I have a Netgear cable modem so it is not a router at all. I installed the UDM Pro but it could never get to the Internet. I searched and found some references to setting the time but my time was correct. I then read something about the UDM Pro wanting to get to “something” but not telling us what. For some reason, that clicked as a potential DNS issue. Sure enough, on the Advanced options on the UDM Pro, I saw the Internet set to DHCP as it should be but no DNS filled in. Since this is a router, it appears that the DHCP from Spectrum did NOT send the DNS servers along. I filled in DNS with the 8.8.8.8 for Google and it worked.

Note the UDM Pro updated itself but never left the screen. After 10 minutes, I went to the default 192.168.1.1 again and it came up with the full interface.

I hope this helps someone else.