f00d4tehg0dz / MMM-TeslaFi

MagicMirror Module for Tesla using Teslafi.com api
MIT License
1 stars 8 forks source link

Plugged in State #2

Open justynr opened 4 years ago

justynr commented 4 years ago

The "pluggedIn" state returns "Disconnected" when not charging.

It looks like it's expecting a boolean. Now the display always shows the energy no matter if I'm plugged in or driving or parked.

I've changed the variable in the call to Teslafi and added an if statement to give me a boolean -

const pluggedInState = t.charging_state;
var pluggedIn = 1;
  if (pluggedInState == 'Disconnected') {
  pluggedIn = 0;
};

I haven't tried plugging in yet, so I'm not sure what Teslafi will return when it's charging hence the umbrella of (catch anything that's not Disconnected)