nebulous / infinitude

Open control of Carrier/Bryant thermostats
MIT License
225 stars 50 forks source link

FR: Output numeric fields in API JSON as numbers #56

Closed mattster98 closed 4 years ago

mattster98 commented 6 years ago

Sorry, I'm back. My main stumbling block with using the API json status and config info is that all of the numeric fields contain string array values instead of just numbers.

Current: "rh": [ "64" ], "rt": [ "73.0" ]

Desired: "rh": 64, "rt": 73.0

The json output appears to be simply dumping the XML into a JSON outputter, so I'm not sure where this would be plumbed in, unless it would require storing it differently in the first place.

nebulous commented 5 years ago

It would be possible to output items that are interpretable as numeric to be numeric, but I'm not convinced that this is a bug, since as you say, we're taking the (non-typed, textual) xml and mapping it into json. You say your main stumbling block... what are you trying to achieve? Maybe there's a simple way to get you what you need.