Skip to content

Script couldn't find my device #8

Description

@xR4zgr1z

I'd like to thank you so much for the efforts put into making this awesome tool that helped me extract codes for my Sabiana split using an RM4 mini.

Unfortunately, the main.py script couldn't find my device automatically even if I could ping it with other PCs so I managed to customize the device detection part as it follows to allow the user to manually insert data to help recognize and connect to a Broadlink device:

def scanDevices():
    devices = []
    print('Scanning for devices...\n')
    
    # Attempt to discover devices on the network
    for device in broadlink.xdiscover():
        print(f"Discovered device: {device}")
        devices.append(device)

    if len(devices) == 0:
        print('No devices found automatically.')
        
        # Ask the user if they want to add a device manually
        manual_option = questionary.confirm("Would you like to add a device manually?").ask()
        if manual_option:
            device_ip = questionary.text("Enter the device IP address (e.g., 192.168.1.100):").ask()
            device_mac = questionary.text("Enter the device MAC address (e.g., 34:ea:34:45:67:89):").ask()
            device_type = questionary.text("Enter the device type in hexadecimal (e.g., 0x2737):").ask()

            try:
                # Convert the inputs
                device_type = int(device_type, 16)  # Convert hex string to integer
                device_mac = bytearray.fromhex(device_mac.replace(":", ""))  # Remove colons from MAC
                
                # Manually create a Broadlink device
                manual_device = broadlink.gendevice(device_type, (device_ip, 80), device_mac)
                devices.append(manual_device)
                print(f"Manually added device: {manual_device}")
            except Exception as e:
                print(f"Error adding manual device: {e}")
                exit()
        else:
            print("Exiting as no devices were found and none were added manually.")
            exit()

    return devices

the device type hexadecimal for the RM4 mini is 0x648d and I used NMAP to pull the IP and MAC address of my device.

Once I inserted all the coordinates for the connection, the command recognition sent from the remote was a breeze!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions