ericellb / Broadlink-CLI-SmartIR

A CLI tool to help you learn codes for Climate, Fan and Media devices for SmartIR and Home Assistant
8 stars 1 forks source link

Add support for Rm mini 3 #3

Open gitlaman opened 1 week ago

gitlaman commented 1 week ago

Hi there,

the script is just what i need but i have only Broadlink RM mini 3 and if is possible can you please add support for my device?

Thanks

gitlaman commented 1 week ago

I done it myself. Just add this code and it will work for RM mini 3.

`def showAndSelectDevice(devices: List[broadlink.Device]) -> broadlink.Device:

Build hashmap of deviceIp to device

deviceIpToDevice = {}
deviceHosts = []
for device in devices:
    deviceIpToDevice[device.host[0]] = device
    deviceHosts.append(device.host[0])

selectedDeviceIp = questionary.select('Select Device', choices=deviceHosts).ask()

# Fetch the device from the hashmap
device = deviceIpToDevice[selectedDeviceIp]

# Currently only support RM4 Pro, RM4 Mini, and RM mini 3
supported_models = ['rm4 pro', 'rm4 mini', 'rm mini 3']
if not any(model in device.model.lower() for model in supported_models):
    print(f'Invalid Device - {device.model} is not supported')
    exit()

device.auth()
return device

`

ericellb commented 4 days ago

If you want to open a pull with this change would be amazing.