Skip to content

Commit

Permalink
pj is online as long as we can connect
Browse files Browse the repository at this point in the history
  • Loading branch information
3ll3d00d committed Dec 27, 2023
1 parent 6d460bd commit 5313669
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions cmdserver/pjcontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def __update_state(self):
cmd = Command.Power
try:
self.__connect()
self.__mqtt.online('pj')
power = self.__executor.get(cmd)
if power == PowerState.LampOn:
cmd = Command.Anamorphic
Expand All @@ -63,14 +64,12 @@ def __update_state(self):
'hdr': pic == PictureMode.User5,
'anamorphic': 'A' if ana == Anamorphic.A else 'B' if install == InstallationMode.TWO else None
}
self.__mqtt.online('pj')
self.__mqtt.publish('pj/state', power.name)
self.__mqtt.publish('pj/attributes', json.dumps(self.__state))
update_in = 10
else:
self.__state = {**self.__state, 'powerState': power.name}
self.__mqtt.offline('pj')
update_in = 1 if power == PowerState.Starting or power == PowerState.Cooling else 20
self.__mqtt.publish('pj/state', power.name)
self.__mqtt.publish('pj/attributes', json.dumps(self.__state))
self.__update_state_in(update_in=update_in)
self.__disconnect()
logger.info('Refreshed PJ State')
Expand All @@ -79,6 +78,7 @@ def __update_state(self):
self.__disconnect()
logger.exception(f"Command NACKed - GET {cmd}")
except:
self.__mqtt.offline('pj')
self.__update_state_in(update_in=update_in)
self.__disconnect()
logger.exception(f"Unexpected failure while executing cmd: {cmd}")
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "ezmote-cmdserver"
version = "1.1.6"
version = "1.1.7"
description = "A small webapp which can be used for web based home cinema automation"
authors = ["3ll3d00d <mattkhan+cmdserver@gmail.com>"]
license = "MIT"
Expand Down

0 comments on commit 5313669

Please # to comment.