Namaste
There appears to be an indirect reference in the Athavaveda regarding use of it's ingredient in medicine, in conjunction with various herbs. In is found in Ayurvedic medicine in relation to increasing appetite and in some aliments.
While some sadhus are known to use it, in general the Devatas do not want demons to, and will in some cases intervine to remove it from the hands of demons as is noted by some village traditions, which speaks volumes. It does show up in some Saiva Tantric works, but not commonly so. I think perhaps this is where the connection to Shiva comes about, certainly it is not mainstream Saiva practice.
I do not personally recommend it, I am mainstream. I do not try to preach anything to any Sadhus (unless they are fake sadhus who are simply pot smokers), if by chance they use it, so I don't tell them what to do.
Here is a very bad analogy which actually doesn't exactly fit the example, but... I will make it anyway. The way I look at it, let's use the context of certain military situations, black ops, or extreme environmental conditions during battle or espionage. It was a fact, for example, that German Stuka dive bomber pilots on the Russian front who had to take off on repeated anti-tank missions in ice and snow, as well as in some instances of US Army Airforce WWII, black ops in Vietnam and some LRRPs into Laos and Cambodia, Russian Red Army WWII, British fire brigades during Viewergeltungswaffe 2 rocket attacks on London, many other examples, stimulant "speed" drugs were given to personnel just to allow them to stay awake and continue on. Does this mean the military condoned such use?
No, it was rare and in extreme circumstance. So in the same manner, there may be a use for such things as bhang in certain circumstances, but please do not think this is mainstream, and do not go to a temple loaded.
Om Namah Sivaya