Raspberry stem fly — the main methods of struggle
- 1 Linux
- 2 Contents
- 3 Compiling the source code
- 4 Allow non-root user to access ttyUSB* ports
- 5 Starting Domoticz automatically when the system boots
- 6 Updating Domoticz
- 7 Problems locating Python
- 8 Add support for Tellstick
- 9 Игра в раннем доступе
- 10 Приобретите игру и начните играть — примите участие в ее развитии
- 11 Почему ранний доступ?
- 12 Сколько примерно эта игра будет в раннем доступе?
- 13 Чем планируемая полная версия будет отличаться от версии в раннем доступе?
- 14 What to expect during Early Access
- 15 Каково текущее состояние версии в раннем доступе?
- 16 Изменится ли цена игры после выхода из раннего доступа?
- 17 Как вы планируете вовлекать сообщество в разработку игры?
- 18 Купить Astrox Imperium
- 19 Купить Astrox : Space Miners Unite! НАБОР (?)
- 20 Об этой игре
- 21 How to Win the Battle Against the Suckers in Your Garden
- 22 What Is a Sucker?
- 23 Why Do Suckers Form?
- 24 Why Are Suckers a Problem?
- 25 How to Deal With Suckers
- 26 When Are Suckers Not a Problem?
- 27 Insomnia
- 28 Can’t sleep? Understand the causes of insomnia and how you can finally get a good night’s sleep.
- 29 What is insomnia?
- 30 Causes of insomnia: Figuring out why you can’t sleep
- 31 Identifying habits that cause insomnia and disrupt sleep
- 32 Fighting insomnia with a better sleep environment and routine
- 33 Neutralizing anxiety that keeps you from falling or staying asleep
- 34 What to do when insomnia keeps you up in the middle of the night
- 35 Using insomnia supplements and medication wisely
- 36 When to see a doctor about insomnia
This page describes how to compile/build the latest beta snapshot of Domoticz for Debian-based Linux operating systems. There’s no need for all this if you’re just installing a pre-built binary (see the downloads page for that).
Compiling the source code
Allow non-root user to access ttyUSB* ports
If you don’t plan on interfacing Domoticz with USB and/or serial devices, you can skip this step.
By default (at least on Ubuntu) a non-root user has no permission to access the ttyUSB* ports. So if you have Domoticz running under a separate user (which is always a good idea to make the system more secure), Domoticz isn’t allowed access to your RFXCOM for example. Here are two methods of doing it. For most people the first one by adding the user to the dialout goup is enough and by far the easiest.
Adding the user to the dialout group
This can be done by running the command below:
(Where you replace YOURUSERNAME with the user that runs Domoticz.)
Setting up a udev rule
Alternatively you can setup (as root) a udev rule that matches the RFXCOM device. To find which attributes match your device use the command:
Where /dev/ttyUSB1 is the device. If you wish to run Domoticz under the YOURUSERNAME credentials, who is member of the YOURGROUPNAME group and your device has serial YOURSERIAL a suitable udev rule would be:
Save it to a file under /etc/udev/rules.d/ with the .rules extention and run:
Unplug and replug the device and execute:
You should see something like
The added SYMLINK+= creates an additional link to the device node. This is a static name that is useful when you have multiple usb-serial devices that go into your box. Use the static link in Domoticz. For more information on udev rules have a look here: http://www.reactivated.net/writing_udev_rules.html
Starting Domoticz automatically when the system boots
There are basically two ways to do this — via init.d (which starts things serially) or via systemd (which starts things up in parallel and therefore leads to faster booting). On modern systems the systemd method is generally preferred.
Option 1: Init.d Method
To let Domoticz start automatically when the system boots (which is probably the case, as most people run it on a headless server), run the commands below, (You want to end up in /home/YOURUSERNAME/domoticz/)
Edit the startup script.
The lines you usually need to change are USERNAME, DAEMON and DAEMON_ARGS
- Change the USERNAME variable to the user you want domoticz to be run as. It’s recommended to run domoticz as its own user and not as root, due to security reasons.
- If you installed Domoticz in the USERNAME home directory /home/yourusername/domoticz you don’t need to change the DAEMON variable. If you installed it in an alternate location for example /usr/local/domoticz/ you should change DAEMON to /usr/local/domoticz/$NAME
- If you want to use another web interface port change the ‘8080’ in: DAEMON_ARGS=»-daemon www 8080″ to your own port.
Note: To be able to use ports below 1024, for example the standard port for webbrowsing, 80, you need to run domoticz as the root user.
If you want to see more arguments for DAEMON_ARGS run this in the domoticz directory. This is usually not needed.
Domoticz will now start automatically when you reboot your machine.
Manually controlling the Domoticz service
This only works if you followed the above steps.
You can now start/stop/restart and check the status of domoticz with:
If your system supports it you can instead use:
Option 2: Systemd Alternative (Preferred)
Open the systemd configuration file, here you can change the port number you wish to use. To use a port below 1024 you can run as root (not reccomended) or you can un-comment one of the marked lines in the file — you should only un-comment one of the lines depending on your Ubuntu version :
or on Raspberry Pi Stretch as root (remove ‘#’ on User and Group lines to run as ‘Pi’ user):
on Raspbian Linux 10 (buster), I had to add this just before ExecStartPre=setcap now it works. I don’t know about security implications!!
The service file must add the directive «PermissionsStartOnly=true», in order to be able to execute the «ExecStartPre=/sbin/setcap ‘cap_net_bind_service=+ep’ . » one!
I got this hint from the Discussion of this Wiki page
Enable the service
Start the service
Note: Use only one of these two alternatives (init.d method or systemd method) for auto-start.
Once in a while, a new Domoticz version is released, and of course you want to update. You can do this with the commands below:
- Navigate to the directory where Domoticz is installed: cd domoticz (You want to end up in /home/YOURUSERNAME/domoticz/)
- Update to the latest Beta with: ./updatebeta
- Update to the latest Release with: ./updaterelease
If all went correctly, Domoticz should be updated to the latest version and should be running again automatically.
Attention: when you use Monit, be sure to disable it before doing the update process, otherwise after you have stopped Domoticz by hand yourself, it will get restarted automatically by Monit within a few minutes (because that is what is Monit should do normally).
Stopping Monit can be done by sudo /etc/init.d/monit stop and after updating it can be started again with sudo /etc/init.d/monit start .
You could also use this command: make && sudo /etc/init.d/domoticz.sh start && sudo /etc/init.d/monit start to update, start Domoticz & start Monit when updating is done.
Script to update almost automatically
For updating almost automatically, i made this script
Save it as domoupdater.sh, give it executable rights ( chmod +x domoupdater.sh ) and call it by sh /home/YOURUSERNAME/domoupdater.sh
It will change the current path to the Domoticz folder, stop Monit, stop Domoticz, pull binaries, compile, start Domoticz, start Monit again.
Very handy to run & go do something else.
In theory it can work automatically (weekly cronjob for example), however when running as a non-root user (which is the case in my situation), it will ask for the password of the user. But after you have provided the password (almost immediately after the script has started), it will continue without needing any further user input.
In theory it is possible to let it run fully automated, but i myself prefer a bit of feedback (watching afterwards if all went well). If you want to work around this sudo password asking, look here.
when compiling the main Domoticz binary. For more information read this thread on the forum: Link
Problems locating Python
Some users, particularly those on old operating systems see the following message when starting Domoticz:
this shows that, even though python3 may be on the system, the python library can not be located. This error will not stop Domoticz from starting but will mean that hardware supported by the Python Plugin Framework will not be available. To fix this, install the newest version of libpython3 for the platform. For example, RaspberryPi Jessie has python 3.4 on it but the library is not included. Executing:
should solve the issue. Note that python 3.4 is the earliest support version of python, where available later versions should always be used.
If you are building from source and python 3 is installed but Make is not able to progress, try to add
just before find_package(PythonLibs 3.4) in the CMakeLists.txt
If your platform does not have a compatible version, for example RaspberryPi Wheezy, then one can be built from source using:
Don’t miss the enabled-shared flag otherwise libpython will not be built.
Note: Only peform this step if you are building from source and are having issues, it should not be required.
After building Python 3.5.x change CMakeLists.txt
Add support for Tellstick
If you need support for Tellstick or Tellstic Duo you need to install telldus-core before compiling Domoticz. On Debian-based systems (For example Ubuntu and Raspbian) telldus-core can be installed by doing the following:
Игра в раннем доступе
Приобретите игру и начните играть — примите участие в ее развитии
Примечание: Данная игра в раннем доступе находится на стадии разработки. Она может измениться в будущем, а может остаться в текущем состоянии, так что, если вам не по вкусу то, что игра может предложить сейчас, рекомендуем дождаться её дальнейшего развития. Узнать больше
Почему ранний доступ?
Сколько примерно эта игра будет в раннем доступе?
Чем планируемая полная версия будет отличаться от версии в раннем доступе?
“There are a few main features I want to add before I would call the game complete. The base building aspect that will allow players to build up the sectors using the various structures already present in the game. These structures will effect a number of attributes, such as the environment, economy, and security of sector. I also want to add unique story lines for all the main 6 factions. Where currently, there is only 2 paths to take, based on the 2 main rival factions.
I am considering a number of game modes for sandbox play. These various modes would allow you to play in a completely different way, with new objectives and rules , all in a universe of your design.
What to expect during Early Access
Каково текущее состояние версии в раннем доступе?
Изменится ли цена игры после выхода из раннего доступа?
Как вы планируете вовлекать сообщество в разработку игры?
“Astrox brings with it a small community of fans, who like me, enjoy simple space game fun. I have taken much of the feedback from the original Astrox players, and created something that we can all grow together into something special. The potential for this game is huge, and where we decide to take it is beyond exciting.
By hosting open discussions here on the Steam forums, as well as the official website and our discord, we can explore the ideas that made us fall in love with space games in the first place. I look forward to working with you all!”
Этот продукт не поддерживает ваш язык. Пожалуйста, перед покупкой ознакомьтесь со списком поддерживаемых языков.
Купить Astrox Imperium
Купить Astrox : Space Miners Unite! НАБОР (?)
Сообщайте об ошибках и оставляйте отзывы в обсуждениях этой игры
Об этой игре
Astrox Imperium is my attempt to create the space game that I wanted to play, but no one had created. I wanted a single player, open-world space game that is similar to games I enjoyed, like Homeworld and EVE, with economies, factions, and a story. A game where I could set all the parameters, and the universe would come alive with new challenges each time I played. I tried to take the best of what I liked from many of my favorite space games, and combine them into something simple but deep, familiar yet fresh, and enjoyably addicting to play.
The human struggle to survive is an all too familiar one. As the planet collapsed into an ecological depression, mankind as a whole is forced to expand his vision to the skies. A grand ship was built, and the ‘Imperium’ was scheduled to launch mankind into the future. With a new Quantum technology at its core, the Imperium was mankind’s greatest achievement. Putting aside all differences, the people of world came together. Under a common goal, the efforts of an entire generation came to fruition. The Imperium was ready to carry the dreams of us all, and with it, the hopes of finding a second chance.
Not any one person knows the whole truth, but from what can be gathered, here is what we know. The Imperium was destroyed, and many of the human pioneers perished during the event. The survivors congregated together and began to build a temporary home from the wreckage of the ship itself. At first they waited for rescue, but it wasn’t long before the first ones accepted their fate.
It has been 230 years now, and mankind has been quite busy out there in the stars. The story of the Imperium, passed down through the generations, have all but faded away completely.
The main game play loops are fairly simple, and familiar. What makes Astrox Imperium unique, is the way that you can easily glide between the various loops to maintain a nice level of progression, without it feeling any more ‘grindy’ than you want it to. Sure, you can just mine rocks if you want, but Astrox Imperium provides you many different ways to progress your pilot.
As with most space games of this genre, mining is a big mechanic of Astrox. It is the easiest way to earn credits, and most players are familiar with how it works. You can also complete contract missions. These are randomly generated missions that offer a variety of task and objectives to complete. Some of these contracts are combat missions that will involve raiders, pirates, and sometimes regular npcs. The combat missions offer a bit more action to an otherwise relaxed game. The rate at which you choose to progress is up to you. You are given a number of game options allowing you to adjust ‘the grind’ and speed of the game. There are a number of small, interesting little mechanics sprinkled throughout the game that were given a lot of thought and care, but you will not find anything groundbreaking or innovative here. This game is meant to feel comfortable and familiar. The game play loops are designed to be simple enough to understand quickly, and complex enough to enjoy over many hours of play.
Many of the classic mechanics from the space game genre have been incorporated into Astrox Imperium. Basic interface controls were designed using elements from some RTS and FPS games. All the fan favorites and core game play elements have been included; mining, crafting, trading, refining, fleets, combat, exploration, survival, and more. This game will seem familiar to fans of the space survival / exploration game genre. Here is a list of features that are currently in the game. Check out our community forum if you are looking for more information about upcoming features.
How to Win the Battle Against the Suckers in Your Garden
Here’s something that almost every gardener with a tree or large shrub is bound to deal with: the sucker. This cheerful name described very vigorous stem growth coming from a plant’s root system but some distance away from the crown. You need to recognize and learn how to deal with suckers to preserve your plant’s health at the least, its good looks often as well, and in some important cases, the very stability of its identity!
If that piqued your interest, read on and find out how a couple of times a year you might need to prune out or rip off those nasty suckers before they turn your plant into something you don’t want.
What Is a Sucker?
When a root sends up a new stem away from the main stem, we call it a sucker. Suckers are also any new vertical growth that arises from the base of a trunk. On a grafted plant, anything that grows vigorously below the graft union can be called a sucker.
Picture asparagus. You can recognize suckers by their fast growth and usually long internodes, long and weak wooded. Often clusters of many suckers will arise from a single point. Think of asparagus growing: asparagus is a suckering plant whose suckers we cut down and eat.
Asparagus is great, but on almost all trees and many landscape shrubs, suckers are generally unwanted. They’re sort of like parasitic rebels. Even if distant from the original plant, the new stem is connected to the main trunk or crown of the plant by the roots underground, sharing its food and water, though from above ground it looks like a separate plant from the parent. Suckers are very similar, by the way, to water sprouts, which are the same kind of youthful, rampant, vertical, generally unwanted growth, but from a branch rather than from a root.
Suckers are like a new baby plant that has suddenly come into being connected to the relatively massive root system of its older parent: in short, it is young, vigorous, and has a lot of food. For this reason, suckers are able to grow very, very fast, easily many feet in a single season. They are your toddler outgrowing pairs of shoes. Your teenager stealing the credit card and going on a spree. Suckers are ravenous nuisances.
Why Do Suckers Form?
Plants are different from most animals in that under the right conditions, almost any part of a plant can create any other part of the plant. Your finger can’t grow an eyeball and your bones can’t grow blood vessels, but plants actually can do things like this. The veins of a leaf pinned to moist soil can often grow roots. And roots, even a piece of a root, can almost always grow new stems, which then can grow all other parts. This ability lets us propagate plants to make new ones, but it’s also how suckers happen.
Normally hormones from the growing tips of plants prevent wrong parts of the plant lower down from growing. Harm to the growing tip that produces the hormones, or to the tissues in between that transport the hormones, makes suckers much more likely. They can also happen to very healthy plants, or to plants of certain species very prone to suckering (not necessarily a bad thing to do in the wild).
Why Are Suckers a Problem?
As I said above, a sucker grows very quickly. Isn’t this a good thing? Usually, no. Here are the main reasons:
- Suckers are in the wrong place. A sucker is directing energy towards the growth of stems where you probably don’t want them. Little stems growing in the shade of a large shade tree look strange. New shrubs near your old shrubs might ruin the effect of your planned grouping, especially if you are the more controlling kind of gardener.
- Suckers rob energy from the main plant. On a large tree, the energy loss is not a big deal. On smaller plants, the loss can reduce your flower or fruit set. On grafted plants, the robbing of energy is devastating, and a special case.
- In grafted plants, suckers from the rootstocks devastate and take over the plant. When you have a grafted plant, this is the most important case to remove suckers. In these cases, suckers are of a different variety from the plant you purchased. It is likely to grow much faster than your variety and overtake it, sometimes literally engulf it, creating a “new” plant that will not be the one you wanted.
A lot of woody plants you buy in the nursery are grafted onto rootstocks of a different variety or species from the one you bought, and nurseries never tell you this. For this reason, it’s a decent idea to assume suckers are a problem unless you know otherwise. If the sucker has leaves or flowers that look different from the main plant, you know you have a rootstock renegade.
How to Deal With Suckers
Depending on your plant and your needs, you’ll need to know how to deal with suckers in a variety of ways. Usually, you’ll want to cut them off just as you’d expect. Sometimes you’ll need to rip them out by hand! Sometimes, in cases like those covered below, you might want to leave them right where they are, or transplant them.
When Are Suckers Not a Problem?
There are exceptions to every rule. On the right plants in the right garden, suckers are an opportunity.
Can’t sleep? Understand the causes of insomnia and how you can finally get a good night’s sleep.
What is insomnia?
Do you struggle to get to sleep no matter how tired you are? Or do you wake up in the middle of the night and lie awake for hours, anxiously watching the clock? If so, you’re in good company. Insomnia is the inability to fall asleep or stay asleep at night, resulting in unrefreshing or non-restorative sleep. And it’s a very common problem, one that takes a toll on your energy, mood, and ability to function during the day. Chronic insomnia can even contribute to serious health problems.
Because different people need different amounts of sleep, insomnia is defined by the quality of your sleep and how you feel after sleeping—not the number of hours you sleep or how quickly you doze off. Even if you’re spending eight hours a night in bed, if you feel drowsy and fatigued during the day, you may be experiencing insomnia.
Although insomnia is the most common sleep complaint, it is not a single sleep disorder. It’s more accurate to think of insomnia as a symptom of another problem. The problem causing the insomnia differs from person to person. It could be something as simple as drinking too much caffeine during the day or a more complex issue like an underlying medical condition or feeling overloaded with responsibilities.
The good news is that most cases of insomnia can be cured with changes you can make on your own—without relying on sleep specialists or turning to prescription or over-the-counter sleeping pills. By addressing the underlying causes and making simple changes to your daily habits and sleep environment, you can put a stop to the frustration of insomnia and finally get a good night’s sleep.
Symptoms of insomnia:
- Difficulty falling asleep despite being tired
- Waking up frequently during the night
- Trouble getting back to sleep when awakened
- Unrefreshing sleep
- Relying on sleeping pills or alcohol to fall asleep
- Waking up too early in the morning
- Daytime drowsiness, fatigue, or irritability
- Difficulty concentrating during the day
Causes of insomnia: Figuring out why you can’t sleep
In order to properly treat and cure your insomnia, you need to become a sleep detective. Emotional issues such as stress, anxiety, and depression cause half of all insomnia cases. But your daytime habits, sleep routine, and physical health may also play a role. Try to identify all possible causes of your insomnia. Once you figure out the root cause, you can tailor treatment accordingly.
- Are you under a lot of stress?
- Are you depressed? Do you feel emotionally flat or hopeless?
- Do you struggle with chronic feelings of anxiety or worry?
- Have you recently gone through a traumatic experience?
- Are you taking any medications that might be affecting your sleep?
- Do you have any health problems that may be interfering with sleep?
- Is your sleep environment quiet and comfortable?
- Do you try to go to bed and get up around the same time every day?
Common psychological and medical causes of insomnia
Sometimes, insomnia only lasts a few days and goes away on its own, especially when the insomnia is tied to an obvious temporary cause, such as stress over an upcoming presentation, a painful breakup, or jet lag. Other times, insomnia is stubbornly persistent. Chronic insomnia is usually tied to an underlying mental or physical issue.
Anxiety, stress, and depression are some of the most common causes of chronic insomnia. Having difficulty sleeping can also make anxiety, stress, and depression symptoms worse. Other common emotional and psychological causes include anger, worry, grief, bipolar disorder, and trauma. Treating these underlying problems is essential to resolving your insomnia.
Medical problems or illness. Many medical conditions and diseases can contribute to insomnia, including asthma, allergies, Parkinson’s disease, hyperthyroidism, acid reflux, kidney disease, and cancer. Chronic pain is also a common cause of insomnia.
Medications. Many prescription drugs can interfere with sleep, including antidepressants, stimulants for ADHD, corticosteroids, thyroid hormone, high blood pressure medications, and some contraceptives. Common over-the-counter culprits include cold and flu medications that contain alcohol, pain relievers that contain caffeine (Midol, Excedrin), diuretics, and slimming pills.
Sleep disorders. Insomnia is itself a sleep disorder, but it can also be a symptom of other sleep disorders, including sleep apnea, restless legs syndrome, and circadian rhythm disturbances tied to jet lag or late-night shift work.
Identifying habits that cause insomnia and disrupt sleep
While treating underlying physical and mental issues is a good first step, it may not be enough to cure your insomnia. You also need to look at your daily habits. Some of the things you’re doing to cope with insomnia may actually be making the problem worse.
For example, maybe you’re using sleeping pills or alcohol to fall asleep, which disrupts sleep even more over the long-term. Or maybe you drink excessive amounts of coffee during the day, making it harder to fall asleep later. Other daytime habits that can negatively impact your ability to sleep at night include having an irregular sleep schedule, napping, eating sugary foods or heavy meals too close to bedtime, and not getting enough exercise or exercising too late in the day.
Not only can poor daytime habits contribute to insomnia, but a poor night’s sleep can make these habits harder to correct, creating a vicious cycle of unrefreshing sleep:
Oftentimes, changing the habits that are reinforcing sleeplessness is enough to overcome the insomnia altogether. It may take a few days for your body to get used to the change, but once you do, you will sleep better.
If you’re having trouble identifying insomnia-inducing habits
Some habits are so ingrained that you may overlook them as a possible contributor to your insomnia. Maybe your Starbucks habit affects your sleep more than you realize. Or maybe you’ve never made the connection between that late-night glass of wine and your sleep difficulties. Keeping a sleep diary is a helpful way to pinpoint habits and behaviors contributing to your insomnia.
Fighting insomnia with a better sleep environment and routine
Two powerful weapons in the fight against insomnia are a quiet, comfortable sleep environment and a relaxing bedtime routine. Both can make a big difference in improving the quality of your sleep.
Make sure your bedroom is quiet, dark, and cool. Noise, light, a bedroom that’s too hot or cold, or an uncomfortable mattress or pillow can all interfere with sleep. Try using a sound machine or earplugs to mask outside noise, an open window or fan to keep the room cool, and blackout curtains or an eye mask to block out light. Experiment with different levels of mattress firmness, foam toppers, and pillows that provide the support you need to sleep comfortably.
Stick to a regular sleep schedule. Support your biological clock by going to bed and getting up at the same time every day, including weekends. Get up at your usual time in the morning even if you’re tired. This will help you get back in a regular sleep rhythm.
Turn off all screens at least an hour before bed. Electronic screens emit a blue light that disrupts your body’s production of melatonin and combats sleepiness. So instead of watching TV or spending time on your phone, tablet, or computer, choose another relaxing activity, such as reading a book or listening to soft music.
Avoid stimulating activity and stressful situations before bedtime. This includes checking messages on social media, big discussions or arguments with your spouse or family, or catching up on work. Postpone these things until the morning.
Avoid naps. Napping during the day can make it more difficult to sleep at night. If you feel like you have to take a nap, limit it to 30 minutes before 3 p.m.
Things to avoid before bed:
Drinking too many liquids. Waking up at night to go to the bathroom becomes a bigger problem as we age.
By not drinking anything an hour before sleep and going to the bathroom several times as you get ready for bed, you can reduce the frequency you’ll wake up to go during the night.
Alcohol. While a nightcap may help you to relax and fall asleep, it interferes with your sleep cycle once
you’re out, causing you to wake up during the night.
Big evening meals. Try to eat dinner earlier in the evening, and avoid heavy, rich foods within two
hours of going to bed. Spicy or acidic foods can cause stomach trouble and heartburn which can wake you during the night.
Caffeine. The American Academy of Sleep Medicine recommends that you stop drinking caffeinated beverages at least six hours before bedtime. People who are sensitive to caffeine may need to stop even earlier.
Neutralizing anxiety that keeps you from falling or staying asleep
The more trouble you have with sleep, the more it starts to invade your thoughts. You may dread going to sleep because you just know that you’re going to toss and turn for hours or wake up at 2 a.m. again. Or maybe you’re worried because you have a big day tomorrow, and if you don’t get a solid 8 hours, you’re sure you’ll blow it. But agonizing and expecting sleep difficulties only makes insomnia worse. Worrying about getting to sleep or how tired you’re going to be floods your body with adrenaline, and before you know it, you’re wide-awake.
Learning to associate your bed with sleeping, not sleeplessness
If sleep worries are getting in the way of your ability to unwind at night, the following strategies may help. The goal is to train your body to associate the bed with sleep and nothing else—especially not frustration and anxiety.
Use the bedroom only for sleeping and sex. Don’t work, watch TV, or use your computer in bed or the bedroom. The goal is to associate the bedroom with sleep alone, so that your brain and body get a strong signal that it’s time to nod off when you get into bed.
Move bedroom clocks out of view. Anxiously watching the minutes tick by when you can’t sleep—knowing that you’re going to be exhausted when the alarm goes off—is a surefire recipe for insomnia. You can use an alarm, but make sure you can’t see the time when you’re in bed.
Get out of bed when you can’t sleep. Don’t try to force yourself to sleep. Tossing and turning only amps up the anxiety. Get up, leave the bedroom, and do something relaxing, such as reading, drinking a cup of herbal tea, or taking a bath. When you’re sleepy, go back to bed.
Challenge worries and thoughts that fuel insomnia
It’s also helpful to challenge the negative attitudes about sleep and your insomnia problem that you’ve developed over time. The key is to recognize self-defeating thoughts and replace them with more realistic ones.
|Challenging self-defeating thoughts that fuel insomnia|
|Self-defeating thought:||Sleep-promoting comeback:|
|Unrealistic expectations: I should be able to sleep well every night like a normal person. I shouldn’t have a problem!||Lots of people struggle with sleep from time to time. I will be able to sleep with practice.|
|Exaggeration: It’s the same every single night, another night of sleepless misery.||Not every night is the same. Some nights I do sleep better than others.|
|Catastrophizing: If I don’t get some sleep, I’ll tank my presentation and jeopardize my job.||I can get through the presentation even if I’m tired. I can still rest and relax tonight, even if I can’t sleep.|
|Hopelessness: I’m never going to be able to sleep well. It’s out of my control.||Insomnia can be cured. If I stop worrying so much and focus on positive solutions, I can beat it.|
|Fortune telling: It’s going to take me at least an hour to get to sleep tonight. I just know it.||I don’t know what will happen tonight. Maybe I’ll get to sleep quickly if I use the strategies I’ve learned.|
Remember, learning how to stop worrying takes time and practice. You may find it helpful to jot down your own list, taking note of the negative thoughts that pop up and how you can dispute them. You may be surprised at how often these negative thoughts run through your head. Be patient and ask for support if you need it.
What to do when insomnia keeps you up in the middle of the night
Many people with insomnia are able to fall asleep at bedtime, but then wake up in the middle of the night. They then struggle to get back to sleep, often lying awake for hours. If this describes you, the following tips may help.
Stay out of your head. Hard as it may be, try not to stress over your inability to fall back to sleep, because that stress only encourages your body to stay awake. To stay out of your head, focus on the feelings in your body or practice breathing exercises. Take a breath in, then breathe out slowly while saying or thinking the word, “Ahhh.” Take another breath and repeat.
Make relaxation your goal, not sleep. If you find it hard to fall back to sleep, try a relaxation technique such as visualization, progressive muscle relaxation, or meditation, which can be done without even getting out of bed. Even though it’s not a replacement for sleep, relaxation can still help rejuvenate your mind and body.
Promote relaxation by rubbing your ears or rolling your eyes. Rubbing the Shen Men acupressure point at the top of the ear can promote calmness and relaxation. Another simple way to promote sleep is to close your eyes and slowly roll them upwards a few times.
Do a quiet, non-stimulating activity. If you’ve been awake for more than 20 minutes, get out of bed and do a quiet, non-stimulating activity, such as reading a book. Keep the lights dim and avoid screens so as not to cue your body that it’s time to wake up.
Postpone worrying and brainstorming. If you wake during the night feeling anxious about something, make a brief note of it on paper and postpone worrying about it until the next day when it will be easier to resolve. Similarly, if a great idea is keeping you awake, make a note of it on paper and fall back to sleep knowing you’ll be much more productive after a good night’s rest.
Relaxation techniques that can help you get back to sleep
Abdominal breathing. Breathing deeply and fully, involving not only the chest, but also the belly, lower back, and ribcage, can help relaxation. Close your eyes and take deep, slow breaths, making each breath even deeper than the last. Breathe in through your nose and out through your mouth.
Progressive muscle relaxation. Make yourself comfortable. Starting with your feet, tense the muscles as tightly as you can. Hold for a count of 10, and then relax. Continue to do this for every muscle group in your body, working your way up from your feet to the top of your head.
Mindfulness meditation. Sit or lie quietly and focus on your natural breathing and how your body feels in the moment. Allow thoughts and emotions to come and go without judgment, always returning to focus on breath and your body.
Using insomnia supplements and medication wisely
When you’re tossing and turning at night, it can be tempting to turn to sleep aids for relief. But before you do, here’s what you need to know.
Dietary supplements for insomnia
There are many dietary and herbal supplements marketed for their sleep-promoting effects. Although they may be described as “natural,” be aware that sleep remedies can still have side effects and interfere with other medications or vitamins you’re taking. For more information, talk to your doctor or pharmacist.
While scientific evidence is still being gathered for alternative sleep remedies, you might find that some of them work wonderfully for you. The two supplements with the most evidence supporting their effectiveness for insomnia are melatonin and valerian.
- Melatonin. Melatonin is a naturally occurring hormone that your body produces at night. Melatonin helps regulate your sleep-wake cycle. Melatonin is also available as an over-the-counter supplement. While melatonin doesn’t work for everyone, it may be an effective insomnia treatment for you—especially if you’re an extreme “night owl” with a natural tendency to go to bed and get up much later than others.
- Valerian. Valerian is an herb with mild sedative effects that may help you sleep better. However, the quality of valerian supplements varies widely.
Prescription sleeping pills for insomnia
While prescription sleep medications can provide temporary relief, it’s important to understand that sleeping pills are not a cure for insomnia. And if not used carefully, they actually make insomnia worse in the long run. It’s best to use medication only as a last resort, and then, only on a very limited, as-needed basis. First, try changing your sleep habits, your daily routine, and your attitudes about sleep. Evidence shows that lifestyle and behavioral changes make the largest and most lasting difference when it comes to insomnia.
When to see a doctor about insomnia
If you’ve tried a variety of self-help techniques without success, schedule an appointment with a sleep specialist, especially if insomnia is taking a heavy toll on your mood and health. Provide the doctor with as much supporting information as possible, including information from your sleep diary.
Therapy vs. sleeping pills for insomnia
In general, sleeping pills and sleep aids are most effective when used sparingly for short-term situations, such as traveling across time zones or recovering from a medical procedure. Your insomnia won’t be cured by sleeping pills—in fact, over the long-term they can actually make insomnia worse.
Since many people complain that frustrating, negative thoughts and worries prevent them from sleeping at night, cognitive-behavioral therapy (CBT) can be much more effective in addressing insomnia. CBT is a form of psychotherapy that treats problems by modifying negative thoughts, emotions, and patterns of behavior. It can be conducted individually, in a group, or even online. A study at Harvard Medical School found that CBT was more effective at treating chronic insomnia than prescription sleep medication—but without the risks or side effects.
Get more help
Improving Sleep – A guide to a good night’s rest (Harvard Medical School Special Health Report)
Facts About Insomnia (PDF) – Symptoms and common causes of insomnia, as well as proven treatments and cures. (National Institutes of Health)
Insomnia – What it is, how it affects you, and how to get back your restful nights. (National Sleep Foundation)
Stress Less, Sleep More – Tips for reducing stress to promote better sleep, including the use of acupressure. (UCLA)
Insomnia Treatment: Cognitive Behavioral Therapy Instead of Sleeping Pills – Your attitudes about sleep and certain behaviors are often the root cause of insomnia. (The Mayo Clinic)
Cognitive Behavioral Therapy for Insomnia – How CBT works treating insomnia. (National Sleep Foundation)