Skip to content

Commit 17da845

Browse files
committed
removed openhab2 compatibility
1 parent 1bbf098 commit 17da845

File tree

1 file changed

+15
-31
lines changed

1 file changed

+15
-31
lines changed

python/shared/helper.py

+15-31
Original file line numberDiff line numberDiff line change
@@ -10,42 +10,26 @@
1010
from java.lang import NoSuchFieldException
1111
from org.openhab.core.automation import Rule as SmarthomeRule
1212

13-
try:
14-
from org.eclipse.smarthome.core.types import UnDefType
15-
from org.eclipse.smarthome.model.persistence.extensions import PersistenceExtensions
16-
from org.eclipse.smarthome.core.thing import ChannelUID, ThingUID
13+
from org.openhab.core.types import UnDefType
14+
from org.openhab.core.persistence.extensions import PersistenceExtensions
15+
from org.openhab.core.thing import ChannelUID, ThingUID
1716

18-
from org.joda.time import DateTime
19-
from org.joda.time.format import DateTimeFormat
20-
21-
isOpenhab2 = True
22-
except Exception as e:
23-
24-
from org.openhab.core.types import UnDefType
25-
from org.openhab.core.persistence.extensions import PersistenceExtensions
26-
from org.openhab.core.thing import ChannelUID, ThingUID
27-
28-
from java.time import ZonedDateTime, Instant, ZoneId
29-
from java.time.format import DateTimeFormatter
17+
from java.time import ZonedDateTime, Instant, ZoneId
18+
from java.time.format import DateTimeFormatter
3019

31-
isOpenhab2 = False
32-
3320
from core.jsr223 import scope
3421
from core.triggers import ItemStateUpdateTrigger, ItemStateChangeTrigger
3522

36-
if isOpenhab2:
37-
from core.actions import Telegram #, XMPP
38-
else:
39-
class Telegram(object):
40-
@staticmethod
41-
def sendTelegram(recipient, message):
42-
bot = scope.actions.get("telegram", "telegram:telegramBot:{}".format(recipient))
43-
bot.sendTelegram(message)
44-
45-
@staticmethod
46-
def sendTelegramPhoto(recipient, url, message):
47-
bot = scope.actions.get("telegram", "telegram:telegramBot:{}".format(recipient))
48-
bot.sendTelegramPhoto(url,message)
23+
class Telegram(object):
24+
@staticmethod
25+
def sendTelegram(recipient, message):
26+
bot = scope.actions.get("telegram", "telegram:telegramBot:{}".format(recipient))
27+
bot.sendTelegram(message)
28+
29+
@staticmethod
30+
def sendTelegramPhoto(recipient, url, message):
31+
bot = scope.actions.get("telegram", "telegram:telegramBot:{}".format(recipient))
32+
bot.sendTelegramPhoto(url,message)
4933

5034
from org.slf4j import LoggerFactory
5135

0 commit comments

Comments
 (0)