Occusim errors

Hi,

Running on latest Hassio & Appdeamon. Both are running fine but my Occusim app now generates below errors. Any ideas?

2018-12-23 18:27:34.249328 INFO Occupancy Simulator: Executing step Evening kitchen_on_0
2018-12-23 18:27:34.275275 WARNING AppDaemon: ------------------------------------------------------------
2018-12-23 18:27:34.276118 WARNING AppDaemon: Unexpected error in worker for App Occupancy Simulator:
2018-12-23 18:27:34.276988 WARNING AppDaemon: Worker Ags: {'name': 'Occupancy Simulator', 'id': UUID('43fd7b9b-c171-45ba-82b4-ff40d496f854'), 'type': 'timer', 'function': <bound method OccuSim.execute_step of <occusim.OccuSim object at 0x7456d510>>, 'kwargs': {'random_kitchen_on_1': 'scene.kitchen_timer', 'step': 'Evening kitchen_on_0', 'constrain_input_boolean': 'input_boolean.vacation,on'}}
2018-12-23 18:27:34.277708 WARNING AppDaemon: ------------------------------------------------------------
2018-12-23 18:27:34.279782 WARNING AppDaemon: Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/appdaemon/appdaemon.py", line 586, in worker
funcref(self.sanitize_timer_kwargs(app, args["kwargs"]))
  File "/config/appdaemon/apps/occusim.py", line 217, in execute_step
self.log_notify("Executing step {}".format(self.step))
  File "/config/appdaemon/apps/occusim.py", line 253, in log_notify
self.notify(message)
  File "/usr/lib/python3.6/site-packages/appdaemon/plugins/hass/hassapi.py", line 22, in func_wrapper
return func(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/appdaemon/plugins/hass/hassapi.py", line 438, in notify
self.call_service(service, **kwargs)
  File "/usr/lib/python3.6/site-packages/appdaemon/plugins/hass/hassapi.py", line 22, in func_wrapper
return func(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/appdaemon/plugins/hass/hassapi.py", line 522, in call_service
r.raise_for_status()
  File "/usr/lib/python3.6/site-packages/requests/models.py", line 940, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: http://192.168.1.196:8123/api/services/notify/notify
2018-12-23 18:27:34.280602 WARNING AppDaemon: ------------------------------------------------------------
2018-12-23 18:37:19.243151 INFO Occupancy Simulator: Executing step Evening kitchen_off_0
2018-12-23 18:37:19.266907 WARNING AppDaemon: ------------------------------------------------------------
2018-12-23 18:37:19.268200 WARNING AppDaemon: Unexpected error in worker for App Occupancy Simulator:
2018-12-23 18:37:19.269338 WARNING AppDaemon: Worker Ags: {'name': 'Occupancy Simulator', 'id': UUID('43fd7b9b-c171-45ba-82b4-ff40d496f854'), 'type': 'timer', 'function': <bound method OccuSim.execute_step of <occusim.OccuSim object at 0x7456d510>>, 'kwargs': {'random_kitchen_off_1': 'scene.kitchen_timer_off', 'step': 'Evening kitchen_off_0', 'constrain_input_boolean': 'input_boolean.vacation,on'}}
2018-12-23 18:37:19.270613 WARNING AppDaemon: ------------------------------------------------------------
2018-12-23 18:37:19.272787 WARNING AppDaemon: Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/appdaemon/appdaemon.py", line 586, in worker
funcref(self.sanitize_timer_kwargs(app, args["kwargs"]))
  File "/config/appdaemon/apps/occusim.py", line 217, in execute_step
self.log_notify("Executing step {}".format(self.step))
  File "/config/appdaemon/apps/occusim.py", line 253, in log_notify
self.notify(message)
  File "/usr/lib/python3.6/site-packages/appdaemon/plugins/hass/hassapi.py", line 22, in func_wrapper
return func(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/appdaemon/plugins/hass/hassapi.py", line 438, in notify
self.call_service(service, **kwargs)
  File "/usr/lib/python3.6/site-packages/appdaemon/plugins/hass/hassapi.py", line 22, in func_wrapper
return func(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/appdaemon/plugins/hass/hassapi.py", line 522, in call_service
r.raise_for_status()
  File "/usr/lib/python3.6/site-packages/requests/models.py", line 940, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: http://192.168.1.196:8123/api/services/notify/notify
2018-12-23 18:37:19.275166 WARNING AppDaemon: ------------------------------------------------------------
2018-12-23 19:36:07.246906 INFO Occupancy Simulator: Executing step Evening toilet_on_2
2018-12-23 19:36:07.272550 WARNING AppDaemon: ------------------------------------------------------------
2018-12-23 19:36:07.273447 WARNING AppDaemon: Unexpected error in worker for App Occupancy Simulator:
2018-12-23 19:36:07.274559 WARNING AppDaemon: Worker Ags: {'name': 'Occupancy Simulator', 'id': UUID('43fd7b9b-c171-45ba-82b4-ff40d496f854'), 'type': 'timer', 'function': <bound method OccuSim.execute_step of <occusim.OccuSim object at 0x7456d510>>, 'kwargs': {'random_toilet_on_1': 'light.licht_toilet_176_2', 'step': 'Evening toilet_on_2', 'constrain_input_boolean': 'input_boolean.vacation,on'}}
2018-12-23 19:36:07.275451 WARNING AppDaemon: ------------------------------------------------------------
2018-12-23 19:36:07.277577 WARNING AppDaemon: Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/appdaemon/appdaemon.py", line 586, in worker
funcref(self.sanitize_timer_kwargs(app, args["kwargs"]))
  File "/config/appdaemon/apps/occusim.py", line 217, in execute_step
self.log_notify("Executing step {}".format(self.step))
  File "/config/appdaemon/apps/occusim.py", line 253, in log_notify
self.notify(message)
  File "/usr/lib/python3.6/site-packages/appdaemon/plugins/hass/hassapi.py", line 22, in func_wrapper
return func(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/appdaemon/plugins/hass/hassapi.py", line 438, in notify
self.call_service(service, **kwargs)
  File "/usr/lib/python3.6/site-packages/appdaemon/plugins/hass/hassapi.py", line 22, in func_wrapper
return func(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/appdaemon/plugins/hass/hassapi.py", line 522, in call_service
r.raise_for_status()
  File "/usr/lib/python3.6/site-packages/requests/models.py", line 940, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: http://192.168.1.196:8123/api/services/notify/notify
2018-12-23 19:36:07.278377 WARNING AppDaemon: ------------------------------------------------------------
2018-12-23 19:39:48.240547 INFO Occupancy Simulator: Executing step Evening toilet_off_2
2018-12-23 19:39:48.265061 WARNING AppDaemon: ------------------------------------------------------------
2018-12-23 19:39:48.265885 WARNING AppDaemon: Unexpected error in worker for App Occupancy Simulator:
2018-12-23 19:39:48.266752 WARNING AppDaemon: Worker Ags: {'name': 'Occupancy Simulator', 'id': UUID('43fd7b9b-c171-45ba-82b4-ff40d496f854'), 'type': 'timer', 'function': <bound method OccuSim.execute_step of <occusim.OccuSim object at 0x7456d510>>, 'kwargs': {'random_toilet_off_1': 'light.licht_toilet_176_2', 'step': 'Evening toilet_off_2', 'constrain_input_boolean': 'input_boolean.vacation,on'}}
2018-12-23 19:39:48.267492 WARNING AppDaemon: ------------------------------------------------------------
2018-12-23 19:39:48.269334 WARNING AppDaemon: Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/appdaemon/appdaemon.py", line 586, in worker
funcref(self.sanitize_timer_kwargs(app, args["kwargs"]))
  File "/config/appdaemon/apps/occusim.py", line 217, in execute_step
self.log_notify("Executing step {}".format(self.step))
  File "/config/appdaemon/apps/occusim.py", line 253, in log_notify
self.notify(message)
  File "/usr/lib/python3.6/site-packages/appdaemon/plugins/hass/hassapi.py", line 22, in func_wrapper
return func(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/appdaemon/plugins/hass/hassapi.py", line 438, in notify
self.call_service(service, **kwargs)
  File "/usr/lib/python3.6/site-packages/appdaemon/plugins/hass/hassapi.py", line 22, in func_wrapper
return func(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/appdaemon/plugins/hass/hassapi.py", line 522, in call_service
r.raise_for_status()
  File "/usr/lib/python3.6/site-packages/requests/models.py", line 940, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: http://192.168.1.196:8123/api/services/notify/notify
2018-12-23 19:39:48.270145 WARNING AppDaemon: ------------------------------------------------------------

what have you changed that caused the error?
could it be that you updated HA?

there have been some trouble and changes in notify components.

Yes, updated hass.io (84.6 from 82.1) to latest but did not touch anything related to Appdeamon (beside changing to token but that was a while ago and seems to be working fine as other Appdeamon app is working fine (motion lights).

Occusim is not using any notify components is it?

i dont know what you have setup in your yaml.
occusim can use notify.

and in your errorlog i see this:

requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: http://192.168.1.196:8123/api/services/notify/notify

several times. so it calls notify

I did nor write the Occusim myself (actually never made one, just copied stuff from others…) but the app at the bottom has:

def log_notify(self, message):
    if "log" in self.args:
        self.log(message)
    if "notify" in self.args:
        self.notify(message)

Also in the apps.yaml there is a reference:

Occupancy Simulator:
  module: occusim
  class: OccuSim
  log: 1
  notify: 1
  enable: input_boolean.vacation,on
  # test = 1
  dump_times: 1
  reset_time: 02:00:00

Any suggestions?

Ok, I have commented “notify=1” out of the apps.yaml and now I don’t see the errors anymore. To early to say if all is working again.

Update: All is working fine.

Thanks Rene for the tip.

1 Like

i didnt write occusim either (Andrew did)
but it has docs :wink:

  • notify set this to any value to make OccuSim send a notification for its scheduled activities

and indeed i think that taking that part out would be the best if you dont use it :wink: