zigpy / zigpy-cli

Command line interface for zigpy

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add parameter to set channel

mdeweerd opened this issue · comments

commented

In order to force the channel, I updated the 'form' function like this:

async def form(app):
    app.config[conf.CONF_NWK][conf.CONF_NWK_CHANNEL]=11
    app.config[conf.CONF_NWK][conf.CONF_NWK_CHANNELS]=[11]
    await app.startup(auto_form=True)
    await app.form_network()
    dump_app_info(app)

I suggest to add a command line option allowing to force the channel or channel list.

Command line options will be rolled into #2. I'm planning on exposing all of the configurable settings in https://github.com/puddly/zigpy/blob/b350c3298a907559a343547c1d86e5e9c2b0bf23/zigpy/state.py#L32-L68:

$ RADIO=/dev/serial/by-id/...
$ zigpy -vv radio znp $RADIO change --channel=11  # Changes channel
$ zigpy -vv radio znp $RADIO form --channel=11  # Forms a new network
commented

Are all the needed parameters to set a channel in order to allow changing Zigbee channels now in place in zigpy-cli/zigpy?

Does it send out a message to all devices to notify them about the channel change so they should try to switch to that channel?

PS: I know channel change should not be done on a whim but would love a UI setting in the ZHA integration as a feature ;)

The change-channel command now exists. You can also change the channel by performing a backup, editing the JSON, and then a restore.

commented

Thanks for the update.

However, I opened this issue with regards to the "form" command, not per se to change a channel already set.