Skip to content

Commit

Permalink
psrt fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
divi255 committed Oct 30, 2021
1 parent 4d50421 commit 1544dcb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
6 changes: 4 additions & 2 deletions lib/eva/client/remote_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,10 @@ def set_mqtt_notifier(self):
params = self.mqtt_update.split(':')
n = params[0]
notifier = eva.notify.get_notifier(n)
if not notifier or notifier.notifier_type != 'mqtt':
logging.error('%s: invalid mqtt notifier %s' % \
if not notifier or notifier.notifier_type not in [
'mqtt', 'psrt'
]:
logging.error('%s: invalid mqtt/psrt notifier %s' % \
(self.oid, n))
else:
self.mqtt_notifier = notifier
Expand Down
18 changes: 11 additions & 7 deletions lib/eva/item.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ def update_config(self, data):
params = data['mqtt_update'].split(':')
n = params[0]
notifier = eva.notify.get_notifier(n)
if not notifier or notifier.notifier_type != 'mqtt':
if not notifier or notifier.notifier_type not in ['mqtt', 'psrt']:
logging.error('%s: invalid mqtt notifier %s' % \
(self.oid, n))
else:
Expand Down Expand Up @@ -481,7 +481,9 @@ def set_prop(self, prop, val=None, save=False):
n = params[0]
import eva.notify
notifier = eva.notify.get_notifier(n)
if not notifier or notifier.notifier_type != 'mqtt':
if not notifier or notifier.notifier_type not in [
'mqtt', 'psrt'
]:
return False
if len(params) > 1:
try:
Expand Down Expand Up @@ -523,7 +525,7 @@ def subscribe_mqtt_update(self):
not self._mqtt_updates_allowed:
return False
notifier = eva.notify.get_notifier(self.mqtt_update_notifier)
if not notifier or notifier.notifier_type[:4] != 'mqtt':
if not notifier or notifier.notifier_type[:4] not in ['mqtt', 'psrt']:
return False
try:
notifier.update_item_append(self)
Expand All @@ -538,7 +540,7 @@ def unsubscribe_mqtt_update(self):
not self._mqtt_updates_allowed:
return False
notifier = eva.notify.get_notifier(self.mqtt_update_notifier)
if not notifier or notifier.notifier_type[:4] != 'mqtt':
if not notifier or notifier.notifier_type[:4] not in ['mqtt', 'psrt']:
return False
try:
notifier.update_item_remove(self)
Expand Down Expand Up @@ -990,7 +992,7 @@ def subscribe_mqtt_control(self):
if not self.mqtt_control:
return False
notifier = eva.notify.get_notifier(self.mqtt_control_notifier)
if not notifier or notifier.notifier_type[:4] != 'mqtt':
if not notifier or notifier.notifier_type[:4] not in ['mqtt', 'psrt']:
return False
try:
notifier.control_item_append(self)
Expand All @@ -1003,7 +1005,7 @@ def unsubscribe_mqtt_control(self):
if not self.mqtt_control:
return False
notifier = eva.notify.get_notifier(self.mqtt_control_notifier)
if not notifier or notifier.notifier_type[:4] != 'mqtt':
if not notifier or notifier.notifier_type[:4] not in ['mqtt', 'psrt']:
return False
try:
notifier.control_item_remove(self)
Expand Down Expand Up @@ -1186,7 +1188,9 @@ def set_prop(self, prop, val=None, save=False):
n = params[0]
import eva.notify
notifier = eva.notify.get_notifier(n)
if not notifier or notifier.notifier_type != 'mqtt':
if not notifier or notifier.notifier_type not in [
'mqtt', 'psrt'
]:
return False
if len(params) > 1:
try:
Expand Down

0 comments on commit 1544dcb

Please sign in to comment.