zigpy / zigpy-cli

Command line interface for zigpy
GNU General Public License v3.0
44 stars 12 forks source link

Add parameter to set channel #6

Closed mdeweerd closed 1 year ago

mdeweerd commented 2 years ago

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.

puddly commented 2 years ago

Command line options will be rolled into https://github.com/zigpy/zigpy-cli/pull/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
Hedda commented 2 years ago

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 ;)

puddly commented 1 year ago

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

mdeweerd commented 1 year ago

Thanks for the update.

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