panasonic-comfort-cloud-client
panasonic-comfort-cloud-client copied to clipboard
Added human readable JSON output for Device
Human readable device information, instead of displaying enum values it will output enum key when JSON serializing the objects. Device setters also supports enum key.
Earlier, JSON.stringify(groups) outputted
[{
"_id":8440,
"_name":"My House",
"_devices":[{"_guid":"***","_name":"***","_operate":1,"_operationMode":3,"_temperatureSet":21,"_fanSpeed":0,"_fanAutoMode":3,"_airSwingLR":2,"_airSwingUD":2,"_ecoMode":0,"_actualNanoe":0,"_ecoNavi":0,"_nanoe":1,"_iAuto":0,"_airDirection":0,"_ecoFunctionData":0,"_insideTemperature":0,"_outTemperature":0,"lastSettingMode":0}]
}]
and now
[{
"id":8440,
"name":"My House",
"devices":[{"guid":"***","name":"***","operate":"On","operationMode":"Heat","temperatureSet":21,"fanSpeed":"Auto","fanAutoMode":"AirSwingLR","airSwingLR":"Mid","airSwingUD":"Mid","ecoMode":"Auto","ecoNavi":0,"nanoe":"Off","iAuto":0,"actualNanoe":0,"airDirection":0,"ecoFunctionData":0,"insideTemperature":0,"outTemperature":0}]
}]
That may be a breaking change, it depends. Although it's more correct to do it this way since the serialized value is the same as the class definition.
I've made it backwards compatible now, it will output the same as before with no breaking changes. To get the new output you have to set ComfortCloudClient.outputMode = 'pretty'
What do you think @marc2016 ?