Image copyright Getty Images Image caption Hookah pipe smoking is an integral part of Lebanese culture

One of the most familiar sights in the Middle East is of local citizens gathering in cafes smoking hookah pipes as they drink coffee strong enough to knock out an Arabian horse.

But in Beirut, Lebanon's capital, such traditional pastimes are being given a hi-tech twist.

Not only is the city as hip and cool as any city in the West, Lebanese technology is even changing the nature of the hookah pipe.

Finding the ideal tobacco flavour in the bowl at the right temperature is the Holy Grail of hookahs, but a start-up called Nara - Arabic for flame - is solving this with the first "internet of things" hookah pipe.

Compact fast-lighting spheres of charcoal are supplemented by a dense battery and internet-connected sensors that measure air flow, moisture and temperature - all vital elements for a perfect smoke.

Image copyright Getty Images Image caption Beirut, as seen from Zaitunay Bay, looks a lot more prosperous and peaceful these days

Nara does its best to keep everything in the bowl perfectly balanced. And the collected data can be used by cafe owners to prepare a personal mix for returning customers.

With more than 500 million people across the region enjoying a daily hookah pipe, this is one of several innovations that the Beirut start-up ecosystem is beginning to create.

Teen prodigy

Nara is the brainchild of Lebanese-born Fady Isshak, Joe Zoghzoghy, and Mark Haidar - the latter now a highly successful US-based entrepreneur.

But Mr Haidar's start in life was far less auspicious.

Raised in a "mixed" South Lebanese refugee area of Bedouins, Palestinians and other displaced peoples, Mr Haidar created his first product, a smart chair, when he was 17 and without the use of electricity.

Image copyright Banque du Liban Image caption Mark Haidar made his money in the US but is now investing in his home country, Lebanon

Smart and ambitious, he left Beirut when he was 23. Four days later he had received his US visa, after charming the interviewer by saying he'd learned English by watching the "two best documentaries on America": The Simpsons and Seinfeld.

'$300 for food'

The reason for his swift departure was the beginning of the 2006 war.

His father ordered him to get out of Beirut and gave his son the family's life savings of $2,200 (£1,785), asking only for him to leave "$300 for food".

Mr Haidar took his chance, managed to get to the border, and like many refugees after him, travelled through Syria, Turkey and Germany before finally flying to the US and getting a job in a Detroit petrol station.

The rest was another example of the American Dream come true. His companies include Silvr, a payments company, and Dialexa, a technology and product development firm.

Smoke less, learn more

While Mr Haidar has invested in a Beirut start-up as part of Lebanon's diaspora, several other companies are starting life in the city itself. And smoking seems to be a key theme.

Samer El Gharib founded Slighter, a smart cigarette lighter that helps smokers quit gradually. The lighter records the user's smoking habits in the first week that they use the device and then sends them notification of times they are allowed to smoke - one of several steps on the way to giving up completely.

Image copyright Slighter Image caption The Slighter smart lighter and app aims to help people quit smoking

Another (non-smoking) Lebanese start-up is Play My Way, an educational way to stop children spending too much time on their smartphones and tablets.

At parent-specified intervals, Play My Way interrupts any running app with an educational question and will only return to the app once the question is answered.

Of clearly global appeal, last month the app was the third most downloaded app, not in Lebanon, but in the UK.

Influential

Other global players in the tech scene are taking an interest in Beirut.

Two months ago, Apple co-founder Steve Wozniak made his first visit to the city. He was the keynote speaker at the BDL [Banque du Liban] Accelerate conference in November, one of the 10 biggest tech conferences in the world. Tony Fadell, creator of the iPod and iPhone, also addressed the 25,000-strong audience.

Event organiser Samer Karam was originally a photojournalist in Lebanon, covering all the traumatic events of the region in the early 21st Century. Now, he is probably the most influential tech person across the Middle East North Africa (MENA) region.

Image copyright Getty Images Image caption Beirut, renowned for its nightlife and cuisine, is also becoming a tech hub

In 2010, he raised $700,000 and founded Seeqnce, one of MENA's first start-up accelerator programmes and whose first two batches of start-ups raised more than $10m.

He regularly advises the Central Bank of Lebanon on best practices in venture capital and was a member of the founding steering committee of Lebanon's $600m start-up fund, BDL Circular 331.

'Tech gateway'

The Lebanese tech sector witnessed significant growth between 2009 and 2014 - the so-called "youth bulge".

Young talented individuals have been able to start companies in their own country, rather than having to move abroad like so many others. There are 15 million Lebanese living in other countries, from Brazil to Melbourne.

The establishment of new incubators and accelerators such as the UK Lebanon Tech Hub - an initiative between the Central Bank of Lebanon and the UK government - is creating jobs, revenues and investment for start-ups.

"We have already seen the ICT sector here take huge strides forward as a result of incentives, such as the introduction of Circular 331," says Colm Reilly, chief executive of UK Lebanon Tech Hub.

"There is huge R&D capability from academia here and if we get this right, Lebanon can become the tech gateway to the Middle East."

While nothing in Beirut is ever certain, at least it is now much easier to find that perfect hookah pipe smoke, thanks to technology.

Follow Technology of Business editor Matthew Wall on Twitter and Facebook

Click here for more Technology of Business features