Wednesday, January 7, 2026

Home Assistant Gree Versati III modbus ESP32

 

Versati III has an interface that communicates via the Modbus software protocol over RS-485 (physical layer standard). RS-485 can between -7 and +12V.

This needs to be converted to TTL, Transistor-Transistor Logic, which operates at low voltages. TTL can be read by ESP32 (not RS-485)


Based on 

https://github.com/peca2345/ESPHome-modbus-heatpump-Gree-Versati-III/blob/main/README.md

Wiring Diagram

Versati_Modbus----RS485--DollatekModule--TTL----ESP32


Hardware

ESP32 NodeMCU Module USB Type-C ESP32 Development Board Dual-Core 2.4GHz WiFi + Bluetooth CH340C for Arduino
https://www.amazon.com.be/dp/B0D8VN3J77?ref=ppx_yo2ov_dt_b_fed_asin_title&th=1

Pinout
https://lastminuteengineers.com/esp32-pinout-reference/



Note that the pinout can be differently ordered.

DollaTek 5 x 5V MAX485 / RS485 TTL Module to RS-485 MCU Development Board



A & B are the connector for RS-485.
DI, DE, RE, RO are the connectors for TTL.

Good article explaining TTL-RS485




Thursday, November 6, 2025

Azure

 

Azure has several hierarchical levels.

From a technical perspective, the order is (highest first):

Subscription (PROD, DEV, ...).

Resource Group (grouping everything related to a service , like firewall, servers, ...)

Inside Resource Group we can have

- VMs 

- interfaces

- disks

-Virtual Networks

    - a VNET contains a big subnet which can then be split into smaller subnets.

    - Peering between VNETs

-  A routing table 

 - Network Security Group (Rules inbound outbound)

- NAT Gateway

- IP addresses

    


Thursday, July 3, 2025

test

import os
import argparse
import json

def load_json_file(filepath):
    with open(filepath, 'r') as f:
        return json.load(f)

def find_json_by_id(ref_value, folder):
    for root, _, files in os.walk(folder):
        for fname in files:
            if fname.endswith(".json"):
                path = os.path.join(root, fname)
                try:
                    with open(path, "r") as f:
                        content = json.load(f)
                        if isinstance(content, dict) and content.get("listId") == ref_value:
                            return content
                except Exception:
                    continue
    return {}

def find_app_template_by_id(appref, folder):
    for root, _, files in os.walk(folder):
        for fname in files:
            if fname.endswith(".json"):
                path = os.path.join(root, fname)
                try:
                    with open(path, "r") as f:
                        content = json.load(f)
                        if content.get("appId") == appref or content.get("id") == appref:
                            return content.get("serverNames", [])
                except Exception:
                    continue
    return []

def process_policy(input_json, base_dir):
    output = []
    lines = json.dumps(input_json, indent=2).splitlines()
    i = 0
    while i < len(lines):
        line = lines[i]
        output.append(line)

        if '"ref"' in line:
            ref_value = line.split(":")[1].strip().strip('",')
            prev_line = lines[i - 1] if i > 0 else ""

            if "DataPrefixList" in prev_line:
                data = find_json_by_id(ref_value, os.path.join(base_dir, "policy_lists", "DataPrefix"))
                name = data.get("name")
                if name:
                    output.append(' ' * 10 + f'"name": "{name}",')
                for entry in data.get("entries", []):
                    if "ipPrefix" in entry:
                        output.append(' ' * 10 + f'"ipPrefix": "{entry["ipPrefix"]}",')

            elif "appList" in prev_line:
                data = find_json_by_id(ref_value, os.path.join(base_dir, "policy_lists", "App"))
                name = data.get("name")
                if name:
                    output.append(' ' * 10 + f'"name": "{name}",')
                for entry in data.get("entries", []):
                    if "app" in entry:
                        output.append(' ' * 10 + f'"app": "{entry["app"]}",')
                    if "appRef" in entry:
                        #output.append(' ' * 10 + f'"appRef": "{entry["appRef"]}",')
                        servers = find_app_template_by_id(entry["appRef"], os.path.join(base_dir, "policy_templates", "CustomApp"))
                        for server in servers:
                            output.append(' ' * 10 + f'"serverName": "{server}",')

        i += 1
    return output

def main():
    parser = argparse.ArgumentParser(description="Expand Cisco SD-WAN policy file with inlined entries.")
    parser.add_argument("base_dir", help="Base directory (extracted from policy.tar)")
    parser.add_argument("input_file", help="Filename of the input policy (e.g. CHINA-DATA-POLICY-S1.json)")
    args = parser.parse_args()

    input_path = os.path.join(args.base_dir, "policy_definitions", "Data", args.input_file)
    input_data = load_json_file(input_path)

    output_lines = process_policy(input_data, args.base_dir)

    output_path = os.path.splitext(args.input_file)[0] + "_expanded.json"
    with open(output_path, "w") as f:
        f.write("\n".join(output_lines))

    print(f"✅ Expanded file written to: {output_path}")

if __name__ == "__main__":
    main()

Thursday, May 15, 2025

Asus Entware

 Installed on USB device

Has tcpdump

If command doesn't work 

(caused when router reboots)

 do :

cd /tmp

ln -s /tmp/mnt/opt opt

Wednesday, September 11, 2024

Wednesday, September 4, 2024

eve-ng NAT cloud not giving IP via DHCP

 find /etc -type f | xargs grep "172.29.129"

which gave me
/etc/udhcpd.conf:start 172.29.129.1 #default: 192.168.0.20
/etc/udhcpd.conf:end 172.29.129.253 #default: 192.168.0.254
/etc/udhcpd.conf:opt router 172.29.129.254

so now I know that the process is called udhcpd. Then did a
systemctl restart udhcpd

and now I'm getting an IP.



Monday, September 2, 2024

eve-ng c8000v image gives white console after template push

 Issue Cause: When vManage controls the cEdge, it change the CLI from "platform console serial" to "platform console virtual", once it changed, you lost the eve-ng console.

Following is what you need to do:

a) Create a CLI Add-On feature template, add "platform console serial" to the template

b) Associate this add-on template to the device template under the Additional Templates Section

c) Reboot your cEdge, then that fix the issue

YAML Files for ESP32

 Gree Versati III https://gist.github.com/slanckma/3bad4ff49545488a3719766bdf0cdc76 TUF-2000M Water flow sensor https://gist.github.com/slan...