Closed fetzerch closed 2 years ago
Maybe I will add valueType
: float | int | str
as another option to pass?
The JSON specification doesn't differentiate between int or float, and a quick grep in the JSON files in the repo shows only int type. But, there are also some custom types like switchPoints. I'm wondering if it would make sense to just expect the user to pass in JSON compatible data and pass the argument via json.loads
.
Then stuff like 1.0
, '"some string value"'
, '[{"dayOfWeek": "Mo", "setpoint": "on", "time": 330}, ...]'
should work. What would be a little uncomfortable is that neither stringvalue
works (missing quotes) nor "string value"
(shell eats quotes). But you can could catch the json.loads
exception and tell the user that the datatype must be json.
Fixed in 0.18.
First of all, thanks for this awesome library!
I was about to test if adapting
/heatSources/energyMonitoring/correctionFactor
would get the energy recordings closer to what I measure with an extra sensor at the gas meter.Unfortunately modifying numeric values (as in
"type": "floatValue"
) withbosch_cli
currently silently fails. The following command just seems to run ok - at least\r\n
doesn't look like an error:But then the next query just returns the old value again:
The reason seems to be that the value passed as shell parameter (str) is just directly added to the JSON which is sent to the system. Modifying the script to convert value to float yields the expected result:
Note that now the response is
true
instead of\r\n
and alsoquery
shows the updated value:I'm not comfortable enough with the codebase to suggest a fix. I guess the safest would be to perform an internal query first, read the type and perform the conversion accordingly.