Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Devices #15

Open
mabunixda opened this issue Mar 25, 2020 · 16 comments
Open

Devices #15

mabunixda opened this issue Mar 25, 2020 · 16 comments
Labels
enhancement New feature or request

Comments

@mabunixda
Copy link

Hi,

i saw already the json definitions in your sdk. so is it just a matter of implementing the go code in the terraform provider, to get also devices configurable?
Even I am missing the accesspoint stuff - usg and usw seems to be available.

Thanks, Martin

@paultyng
Copy link
Owner

I believe so, the "settings" stuff is hard to follow a little, and I haven't played around with it much. The way I mostly do this is connect to the my controller via IP address and look at the XHR requests in the browser to see what is being sent and received then try to emulate that over the SDK. It may require changes to the SDK as well, specifically I run in to marshalling problems as Unifi's marshalling for things like ints is sometimes weird (ie, they will return an empty string or quoted number occasionally).

@mabunixda
Copy link
Author

Can you create a short update on the SDK how to extend it? Or did I miss it in the readme?

@dekarl
Copy link

dekarl commented Dec 22, 2020

(y) This would be a great feature. I have just reset my controller and stumbled upon the click-fest that is configuring all radios, again...

I'd love to apply a common set of radio settings to my APs. Basically iterating over the "All APs" ap_group and configuring them according to optimising-unifi-performance
(leaving the radio channel alone for now)

@paultyng
Copy link
Owner

I'm definitely open to adding this, I haven't found an easy way to simulate adoption for automated testing though, so makes it a bit harder to work with if this would require adoption to use those API endpoints in the controller (similar to the RADIUS testing in #30). I don't have a test setup at home, just my actual wifi, so testing on that upsets the family 😊.

@paultyng
Copy link
Owner

Switches and port configuration is in. Its kind of weird as you can't create or destroy the resource, so you have to terraform import it but I'm using this to manage port profiles on my switch ports now successfully. I haven't figured out testing on it quite yet, still investigating that.

@joshuaspence
Copy link
Collaborator

I don't have time to debug it at the moment but this isn't working for me. It fails on import:

Error: unable to decode body: GET s/default/stat/device unable to unmarshal alias: unable to unmarshal alias: json: cannot unmarshal number into Go struct field .channel of type string

@paultyng
Copy link
Owner

Argh, this is the problem with limited testing of these adopted things, I know what this is though, let me get a hotfix up.

@paultyng
Copy link
Owner

If you have the capability to run a custom build you can try #120, I fixed the marshalling I hope to handle both numbers and strings for the channel fields (they can be JSON numbers or the string "auto").

@paultyng
Copy link
Owner

Sorry, build error, let me bump it again real quick.

@joshuaspence
Copy link
Collaborator

I get a different error now...

Error: unable to decode body: GET s/default/stat/device unable to unmarshal alias: unable to unmarshal alias: json: cannot unmarshal number into Go struct field .tx_power of type string

@paultyng
Copy link
Owner

paultyng commented Mar 22, 2021

Argh, this is going to be whack-a-mole I guess. TxPower is another one that allows for a number or "auto". I can at least look for all occurrences of "auto".

@paultyng
Copy link
Owner

It looks like TxPower is the only other occurrence, let me bump the SDK again.

@paultyng
Copy link
Owner

paultyng commented Mar 22, 2021

New version pushed in #120.

@joshuaspence
Copy link
Collaborator

Works for me now, thanks

@paultyng
Copy link
Owner

Great, will ship a hotfix release of the provider. Thanks for testing!

@dunderrrrrr
Copy link

Seems like this is still an issue? I'm having trouble importing a device.

│ Error: unable to decode body: GET s/default/stat/device unable to unmarshal alias: json: cannot unmarshal string into Go struct field .x of type float64

What's the .x all about? I'm on a controller with version 7.3.83.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants