Open sol0999 opened 1 year ago
I've been looking for the API call for it for some time now and I thought I should ask. I'd like to have pre-set names for it and do it via a script instead of accessing the webpage.
v0.17.0 which I just released has a method def update_channel(self, channel: VueDeviceChannel) -> VueDeviceChannel:
that takes in whatever current VueDeviceChannel
you want to give it. So you can do something like this to get a particular channel on a device, change the name, then save that change. Let me know if that works for your use-case. That's pretty much all the app is doing.
import pyemvue
vue = pyemvue.PyEmVue()
vue.login( token_storage_file='keys.json')
devices = vue.get_devices()
# find the device with gid 1234 and the channel with channel_num 8
device = next((d for d in devices if d.device_gid == 1234), None)
channel = next((c for c in device.channels if c.channel_num == '8'), None)
# change the name to the current time
channel.name = datetime.now().strftime('%H:%M:%S')
# update the channel
channel = vue.update_channel(channel)
Perfect! vue.update_channel works. Thank you!
Would the renaming of the name of the monitor, multiplier and nesting under other devices be relatively easy to implement as well?
I can look into those other endpoints too but that might not be something I can get to tonight. The multiplier should already be on the channel so that should just work with that new method. Changing the device name and how it's nested will likely be a separate call but seems like it shouldn't be difficult assuming it's just a PUT with the whole object like the channel was.
Sounds good, thank you!
The multiplier should already be on the channel so that should just work with that new method.
I see the multiplier in the channel info, but it seems to be wrong. It is always showing as 1.0 for me.
If you can do it in the app then there's an API call for it. I don't think that's exposed in this library yet since this is mostly intended for reading out data and turning things on and off, management of that sort of info seems manual enough that I figured you'd do it in the app. May I ask what your use case is that you want to change the names through the API?