The Master Key: An Electrical Fairy Tale is not one of L. Frank Baum’s better known fantasies, and really there’s a reason for this, as it’s not one of his better works. That said, people do tend to like one particular aspect of it, the Demon of Electricity. The protagonist, a boy named Rob (named after Baum’s own son), accidentally summons the Demon, and the following conversation ensues:

“Not necessarily,” returned his visitor. “If you will take the trouble to consult your dictionary, you will find that demons may be either good or bad, like any other class of beings. Originally all demons were good, yet of late years people have come to consider all demons evil. I do not know why. Should you read Hesiod you will find he says:

‘Soon was a world of holy demons made,
Aerial spirits, by great Jove designed
To be on earth the guardians of mankind.'”

“But Jove was himself a myth,” objected Rob, who had been studying mythology.

The Demon shrugged his shoulders.

“Then take the words of Mr. Shakespeare, to whom you all defer,” he replied. “Do you not remember that he says:

“Oh, if Shakespeare says it, that’s all right,” answered the boy. “But it seems you’re more like a genius, for you answer the summons of the Master Key of Electricity in the same way Aladdin’s genius answered the rubbing of the lamp.”

“To be sure. A demon is also a genius; and a genius is a demon,” said the Being. “What matters a name? I am here to do your bidding.”

The Demon is correct, as the Greek term daimon did not originally have negative connotations. They were basically just spirits, less powerful than the gods but more so than mankind. Plato wrote of a daimon as a spiritual guide for his teacher Socrates.
According to Plato, demons could influence people toward the good or the bad. The idea that these beings were entirely evil came from the Septuagint, the translation of the Hebrew Bible into Greek. Here, daimon was chosen as the substitute for several Hebrew words meaning evil spirits, and the rest is history.

As for a genius, this was sort of the Roman equivalent of the daimon, although closer in many ways to the concept of a guardian angel. When the Middle Eastern concept of jinn came into Europe, the term “genius” was used for them as well. And jinn had already been associated with demons, as in the story of King Solomon’s magical command of such beings, although like the original Greek daimones they could be either good or bad.

Baum’s treatment of demons bears some similarity to his take on witches. Although the origins of the word “witch” are obscure, it doesn’t appear that its original meaning contained any value judgment. It was only later, largely due to religious influence, that the term “witch” could automatically be taken negatively. In The Wonderful Wizard of Oz, Dorothy expresses the belief that all witches are wicked, to which the Good Witch of the North replies, “Oh, no, that is a great mistake.” The short story “The Witchcraft of Mary-Marie” expands upon this idea:

“Why don’t you become a witch?” asked the man.

“Me!” gasped Mary-Marie, amazed. “A witch!”

“Why not?” he inquired, as if surprised.

“Well,” said the girl, laughing. “I’m not old enough. Witches, you know, are withered dried-up old hags.”

“Oh, not at all!” returned the stranger.

“And they sell their souls to Satan, in return for a knowledge of witchcraft,” continued Mary-Marie more seriously.

“Stuff and nonsense!” cried the stranger angrily.

“And all the enjoyment they get in life is riding broomsticks through the air on dark nights,” declared the girl.

“Well, well, well!” said the old man in an astonished tone. “One might think you knew all about witches, to hear you chatter. But your words prove you to be very ignorant of the subject. You may find good people and bad people in the world; and so, I suppose, you may find good witches and bad witches. But I must confess most of the witches I have known were very respectable, indeed, and famous for their kind actions.”

No demons appear in the Oz books (at least under that name), but Baum uses the term in The Life and Adventures of Santa Claus. As I indicated here, that book includes the Black Demons of Patalonia, who are evil. It also, however, mentions Wind Demons, and there’s no indication that they’re malevolent. The King of the Wind Demons attends the council set up to determine whether Santa Claus deserves immortality, and he is described as “slender of frame, restless and uneasy at being confined to one place for even an hour.” In the Rankin-Bass adaptation, he’s called a Commander instead of a King.
“A Kidnapped Santa Claus” has the Daemons of the Caves, most of whom represent negative traits, but one of them is the Daemon of Repentance.
Of course, you can’t repent unless you’ve done something wrong. Well, unless you believe in original sin, I guess. So demons, like fairies, seem to come in many different types in Baum’s universe. I wonder if there are any others comparable in power to the Demon of Electricity. The Nuclear Demon, perhaps? Or, to get punnier about it, a Speed Demon who can control how fast things travel.