Ocusim question

Started to use Ocusim late last year so no it’s the first time I use Ocusim in the summer. And now I inf out that the sequence has some issues. For example my ‘day’ starts when sunrise +15 but in the summer this is before ‘morning’ resulting in the fact that day never starts (and the morning lights stay on…).

Now I could change everything to be relative to sunrise/sunset but the I cannot build in the fixed moments we also have (like getting up in the morning always around the same time and going to bed).

Any tips on how I could set this up better?

step_morning_name = Morning
step_morning_start = 06:30:00
step_morning_end = 08:45:00
step_morning_on_1 = switch.badkamer_licht_255
step_morning_on_2 = scene.sfeer
step_morning_on_3 = scene.kitchen_timer

step_day_name = Day
step_day_start = sunrise + 00:15:00
step_day_off_1 = switch.badkamer_licht_255
step_day_off_2 = scene.sfeer_off
step_day_off_3 = scene.kitchen_timer_off

step_evening_name = Evening
step_evening_start = sunset - 00:45:00
step_evening_on_1 = scene.sfeer
step_evening_on_2 = switch.greenwave_powernode_1_port_switch_31_0

step_night_name = Night
step_night_start = 22:30:00 
step_night_end = 23:30:00
step_night_on_1 = scene.sleeptime
step_night_on_2 = light.trappenhuis_24
step_night_on_3 = switch.badkamer_licht_255
step_night_on_4 = light.slaapkamer_ouders_177

step_upstairs_hall_name = Upstairs Hall Off
step_upstairs_hall_relative = Night
step_upstairs_hall_start_offset = 00:01:00
step_upstairs_hall_end_offset = 00:10:00
step_upstairs_hall_off_1 = light.trappenhuis_24
step_upstairs_hall_off_2 = switch.badkamer_licht_255

step_lightsout_name = Lights Out
step_lightsout_relative = Night
step_lightsout_start_offset = 00:01:00
step_lightsout_end_offset = 00:20:00
step_lightsout_off_1 = light.slaapkamer_ouders_177

random_toilet_name = Evening toilet
random_toilet_start = Evening
random_toilet_end = Night
random_toilet_minduration = 00:03:00
random_toilet_maxduration = 00:05:00
random_toilet_number = 3
random_toilet_on_1 = light.licht_toilet_176
random_toilet_off_1 = light.licht_toilet_176

random_kitchen_name = Evening kitchen
random_kitchen_start = Evening
random_kitchen_end = Night
random_kitchen_minduration = 00:02:00
random_kitchen_maxduration = 00:10:00
random_kitchen_number = 5
random_kitchen_on_1 = scene.kitchen_timer
random_kitchen_off_1 = scene.kitchen_timer_off

random_attic_name = Evening attic
random_attic_start = Evening
random_attic_end = Lights Out
random_attic_minduration = 00:02:00
random_attic_maxduration = 00:05:00
random_attic_number = 3
random_attic_on_1 = switch.qubino_zmnhbdx_flush_2_relays_switch_12_0_2
random_attic_off_1 = switch.qubino_zmnhbdx_flush_2_relays_switch_12_0_2

My solution to this has been to use a combination of occusim and light levels.

In my normal operation I have day and evening triggered by specific light levels. When Occusim is active, I leve them in place and use Occusim to emulate human interactions like “morning” (usually triggered by motion first thing) and “night time” (manually triggered when we are tired) - everything else is automated anyway so why change it when on vacation, and make it look different?

Also, in my regular setup, I treat morning as optional. If Day occurs (due to light levels) then that locks out morning, as there is no need for morning lighting if it is already light.

That is a good point but in my house the set morning lights does not work that well. Guess there is no possibility to add day of the week (or weekday vs weekend)? With that option I can solve it also as my main objective (issue) is that I want the lights to stay on longer in the morning in the weekend.

Alternatively I could build an automation outside Appdeamon (I’m just a user of apps, can’t build them) that checks if the lights is till on on a certain time I don’t want that (while I’m on vacattion)

I’m thinking of an OccuSim v2 that would use YAML instead of the current config - I think adding weekday constraints to each step or random would be fairly easy to do as I already have schedule day constraints in AppDaemon.

No promises, but I’ll see about getting around to it!


Would be great! Thanks anyway for all your great stuff!

Problem: I don’t seem to be able to get HA 0.50.1 + appdaemon 2.0.8 +OccuSim 1.1.2 to work (on RPI Hassbian, PIP installs, no Docker). The problem seem to be what format I should use for the config.

Question: how should I configure appdaemon so that I can use occusim? Should I try a full “.cfg” old style config?

Note: hello world app for appdaemon has no problems working.


  cert_verify: 'False'
  errorfile: STDERR
  logfile: STDOUT
  threads: '10'
HADashboard: {}
Occupancy Simulator:
  class: OccuSim
  dump_times: '1'
  enable: input_boolean.vacation,off
  log: '1'
  module: occusim
  step_day_name: Day
  step_day_on_1: event.MODE_CHANGE,mode
  step_day_start: sunrise + 00:45:00
  step_evening_name: Evening
  step_evening_on_1: event.MODE_CHANGE,mode
  step_evening_start: sunset - 00:45:00
  step_night_end: '22:30:00'
  step_night_name: Night
  step_night_on_1: event.MODE_CHANGE,mode
  step_night_start: '21:30:00'
  test: '1'


2017-08-05 23:18:56.007698 INFO /home/homeassistant/.homeassistant/conf/appdaemon.yaml modified
2017-08-05 23:18:56.064277 INFO App 'Occupancy Simulator' changed - reloading
2017-08-05 23:18:56.065049 DEBUG Clearing callbacks for Occupancy Simulator
2017-08-05 23:18:56.065648 INFO Loading Object Occupancy Simulator using class OccuSim from module occusim
2017-08-05 23:18:56.068261 WARNING ------------------------------------------------------------
2017-08-05 23:18:56.068845 WARNING Unexpected error:
2017-08-05 23:18:56.069350 WARNING ------------------------------------------------------------
2017-08-05 23:18:56.074368 WARNING Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/appdaemon/appdaemon.py", line 846, in check_config
    new_config[name]["module"], new_config[name]
  File "/usr/local/lib/python3.4/dist-packages/appdaemon/appdaemon.py", line 584, in init_object
    module = __import__(module_name)
ImportError: No module named 'occusim'
2017-08-05 23:18:56.075151 WARNING ------------------------------------------------------------

So basically, I tried the yaml format for appdaemon in 2 ways. one: DIY, and one converting the sample config file from occusim into the yaml format.
Either way, appdaemon starts without errors, but if I change anything (a single minute in the config), I get that error.

Terry (trying to set some somewhat random lights / on/off to simulate presence: a perfect fir for occusim :slight_smile: )

Self-solved. (writing the answer here in case someone else has the same issue).
While trying many things, I changed the config folder location, and basically once I moved the files around, I had the application files in the conf folder instead of conf/apps
Looking at the appdaemon.py file (near the end) showed that it appends “apps” to the config path.

i.e. the bug was between my chair and my keyboard.

1 Like

Glad you figured it out!