powerSource available through publish, not serial print

So I’m trying to use System.powerSource() and .batteryState() with this test code:

(using an electron, running 1.5.2)

int powerSource;
int batteryState;

void setup() {
    Particle.variable("pwrSrc", powerSource);
    Particle.variable("battState", batteryState);

void loop() {
    powerSource = System.powerSource();
    batteryState = System.batteryState();
    Serial.printlnf("pwr src: %f || batt state: %f", powerSource, batteryState);

In my serial monitor (i’ve actually got this running with other code thats using a .publish, it’s seeing the same thing), i get 0 for both powerSource and batteryState. what confuses me, is that when i look at the variable through the console, it’s giving me the right numbers for them both. Where am I going wrong here?

In your code powerSource and batteryState are both ints but in your Serial.printlnf you are using %f which is for floats. Try using %d, the formatting specifier for ints instead.