How to control a redstone lamp with command block?

Solution 1:

Use two command blocks, one connected to a daylight sensor and one to an inverted daylight sensor. Set them both to repeat.

Inverted:

/setblock x y z minecraft:redstone_lamp

Regular:

/setblock x y z minecraft:lit_redstone_lamp

x, y, and z are the coordinates of the lamp. No blocks around the lamp are required.

Solution 2:

In the current version of Minecraft, you need to use this command

/setblock x y z minecraft:redstone_lamp[lit=true]