For HomeAssistant you can use in both cases the determined azimuth value as is, for direct API calls you must convert it according to the convention:
azimuth = azimuth - 180
172°