I'm trying to modify a better beds command module that will detect when there is a thunderstorm and prevent players from sleeping. I'm planning a charged creeper farm, so I want to maximise the amount of thunder time we get. Is there a way that I can detect thunderstorms to get an output? I've seen plenty of methods to detect rain, but none for thunderstorms.
CommandBlockGuy: The problem with daylight detectors is that light levels in rain & thunder weather overlap, so the detector isn't capable of detecting thunder specifically.
Cubes: This idea has crossed my mind, but using it to deactivate sleeping would be ineffective as the appearance of thunder is random, so I can't even use a testfor and cooldown timer to prevent sleeping. It'd either fail to prevent sleeping throughout the thunderstorm, or prevent sleeping in normal weather if a bolt happens to strike at the end of the storm.
With command blocks, you can't exactly detect storms, but you can test for Lightning Bolts, which are actually entities.
LightningBolts are not savegame entities and therefore cannot be tested for. They simply have a special clause with the /summon command, in that if "LightningBolt" is the direct input ID (as opposed to doing a table lookup for all other cases), it will ignore dataTags and create the lightning bolt.
As what Skyliner said, LightningBolt are what I call "fake entities", they exist in the summon command, but the game doesn't reconize it as an entity. (The entity counter in F3 debug will count up for visible entites, but the total entity count doesn't count up. So they can't really be targeted.)