AppDaemon Q&A

got the language part. So where are you from? Are you actually in Holland or relocated somewhere?

I am born in holland and now i live in Germany. for 11 years already.

oke, i found out my problem.
omxplayer didnt like my setup (old vga monitor with emulated HDMI and sound through the 3,5mm jack)
it functions, but sometimes gave back an error and from that moment appdaemon hangs in the subprocess.

but before i found that out many hours were gone.
i have installed mpg321 player and chaced the code and everything works like a charm.

i have chosen a different way for storing then with lists.
the reason is that i didnt want to lose messages when appdaemon stops running.
i could have implemented a DB but this was easier. (partly because i havent had the chance to work with DB out off python yet)
in a dir i list text files with priority, and i call them back when the list is empty.

at start i needed a delay.

i have placed the app and all the info here:

cool. What part of Germany are you in? I’m trying to convince work to send me over there next September :slight_smile:

i live in the winearea.
50 m from the river mosel.
in a small town called briedel.

Guys,
I am trying to figure out disconnect issue for my AppDaemon, here is the link three days back I was posting some information here in this thread: AppDaemon Q&A

After running AppDaemon with -D DEBUG I have collected few more information if any one can help me please.

2016-12-20 16:25:38.002113 DEBUG get_ha_state: entity is None
2016-12-20 16:35:39.002641 DEBUG Refreshing HA state
2016-12-20 16:35:39.002928 DEBUG get_ha_state: entity is None
2016-12-20 16:45:40.001443 DEBUG Refreshing HA state
2016-12-20 16:45:40.001532 DEBUG get_ha_state: entity is None
2016-12-20 16:55:41.001461 DEBUG Refreshing HA state
2016-12-20 16:55:41.001556 DEBUG get_ha_state: entity is None
2016-12-20 17:05:42.001703 DEBUG Refreshing HA state
2016-12-20 17:05:42.001838 DEBUG get_ha_state: entity is None
2016-12-20 17:08:55.001791 DEBUG get_state: light.living_room_light.None
2016-12-20 17:08:55.001921 DEBUG call_service: homeassistant/turn_on, {'entity_id': 'light.living_room_light'}
2016-12-20 17:08:55.826821 INFO LivingroomLight: notify_pb(): type=101, title=Home Assistant, msg=It's almost dark out, turning on the living room light : 17:08:55.826
2016-12-20 17:08:55.826959 DEBUG get_state: input_boolean.automation_notify.None
2016-12-20 17:15:43.002662 DEBUG Refreshing HA state
2016-12-20 17:15:43.002957 DEBUG get_ha_state: entity is None
2016-12-20 17:23:55.001309 DEBUG Process sun: next_setting, next sunrise: 2016-12-21 13:26:41+00:00, next sunset: 2016-12-21 23:24:25+00:00
2016-12-20 17:25:44.002791 DEBUG Refreshing HA state
2016-12-20 17:25:44.003085 DEBUG get_ha_state: entity is None
2016-12-20 17:35:45.002329 DEBUG Refreshing HA state
2016-12-20 17:35:45.002551 DEBUG get_ha_state: entity is None
2016-12-20 17:45:46.002779 DEBUG Refreshing HA state
2016-12-20 17:45:46.003071 DEBUG get_ha_state: entity is None
2016-12-20 17:55:47.002716 DEBUG Refreshing HA state
2016-12-20 17:55:47.003004 DEBUG get_ha_state: entity is None
2016-12-20 18:05:48.002381 DEBUG Refreshing HA state
2016-12-20 18:05:48.002617 DEBUG get_ha_state: entity is None

As I mentioned apps work fine if it is not dependent on HA, so in above log two lights are getting turned on based on sun but rest nothing is working and it keep trying every 10 minutes and spits out entity is None. As of now I am not using timeout parameter to SSEClient call.
Also I have mentioned I am running SSEClient version 0.0.12 should I upgrade to latest 0.0.14?
Thanks

The “Entity is none” message is expected behavior. It reflects the fact that AppDaemon is asking for the whole state not a specific entity. Those messages merely reflect the fact that the timer thread is working and is refreshing state every 10 minutes, but you don;t seem to be getting any streaming updates from HASS>

I am using SSE v 0.12 happily.

Can you post the whole log - or at least the part where AppDaemon starts up?

Below is the start up log. I have secured HA which uses duckdns and let’s encrypt and appdaemon has 20 threads in my config. Hope I am not filling up space with log details.
Thanks for your help.

home@nha-ubuntu:~/appdaemon$ sudo appdaemon -c conf/appdaemon.cfg -D DEBUG
[sudo] password for home: 
2016-12-21 14:13:14.687658 INFO AppDaemon Version 1.3.6 starting
2016-12-21 14:13:14.687755 DEBUG Entering run()
2016-12-21 14:13:14.692266 DEBUG Creating worker threads ...
2016-12-21 14:13:14.693535 DEBUG Done
2016-12-21 14:13:14.693593 DEBUG Calling HA for initial state
2016-12-21 14:13:14.693645 DEBUG Refreshing HA state
2016-12-21 14:13:14.693697 DEBUG get_ha_state: entity is None
2016-12-21 14:13:19.912906 INFO Got initial state
2016-12-21 14:13:19.913032 DEBUG Reading Apps
2016-12-21 14:13:19.913283 INFO Loading Module: conf/apps/motion_during_armed.py
2016-12-21 14:13:19.944875 INFO Loading Object MotionDuringArmed using class MotionDuringArmed from module motion_during_armed
2016-12-21 14:13:19.945173 INFO Loading Module: conf/apps/ha_restarted.py
2016-12-21 14:13:19.945474 DEBUG Calling initialize() for MotionDuringArmed
2016-12-21 14:13:19.945809 INFO MotionDuringArmed: Hello from MotionDuringArmed
2016-12-21 14:13:19.946169 DEBUG MotionDuringArmed initialize() done
2016-12-21 14:13:20.112137 INFO Loading Object HARestarted using class HARestarted from module ha_restarted
2016-12-21 14:13:20.112334 INFO Loading Module: conf/apps/ring_doorbell.py
2016-12-21 14:13:20.112570 DEBUG Calling initialize() for HARestarted
2016-12-21 14:13:20.112683 INFO HARestarted: Hello from HARestarted : 14:13:20.112
2016-12-21 14:13:20.112768 INFO HARestarted: notify_pb(): type=103, title=Home Assistant, msg=HomeAssistant restarted! :14:13:20.112
2016-12-21 14:13:20.112825 DEBUG get_state: input_boolean.automation_notify.None
2016-12-21 14:13:20.114981 INFO Loading Object RingDoorbell using class RingDoorbell from module ring_doorbell
2016-12-21 14:13:20.115190 DEBUG Calling initialize() for RingDoorbell
2016-12-21 14:13:20.115257 INFO RingDoorbell: Hello from RingDoorbell
2016-12-21 14:13:20.115508 INFO Loading Module: conf/apps/testing.py
2016-12-21 14:13:20.116417 INFO Loading Object Testing using class Testing from module testing
2016-12-21 14:13:20.116645 INFO Loading Module: conf/apps/hello.py
2016-12-21 14:13:20.116838 DEBUG Calling initialize() for Testing
2016-12-21 14:13:20.116900 INFO Testing: Starting Testing App
cool
heat
2016-12-21 14:13:20.117012 DEBUG get_state: sensor.connected_clients.None
2016-12-21 14:13:20.117060 INFO Testing: 1
2016-12-21 14:13:20.117118 DEBUG get_state: input_boolean.audio_notifications.None
2016-12-21 14:13:20.117179 INFO Testing: on
2016-12-21 14:13:20.117342 INFO Loading Object HelloWorld using class HelloWorld from module hello
2016-12-21 14:13:20.117401 DEBUG Testing initialize() done
2016-12-21 14:13:20.117664 DEBUG Calling initialize() for HelloWorld
2016-12-21 14:13:20.117730 INFO Loading Module: conf/apps/insteon_motion.py
2016-12-21 14:13:20.117798 INFO HelloWorld: Hello from AppDaemon : 14:13:20.117
2016-12-21 14:13:20.117995 INFO HelloWorld: notify_pb(): type=103, title=Home Assistant, msg=AppDaemon restarted! :14:13:20.117
2016-12-21 14:13:20.118050 DEBUG get_state: input_boolean.automation_notify.None
2016-12-21 14:13:20.118885 INFO Loading Object InsteonMotion using class InsteonMotion from module insteon_motion
2016-12-21 14:13:20.119169 DEBUG Calling initialize() for InsteonMotion
2016-12-21 14:13:20.119245 INFO Loading Module: conf/apps/garage_door.py
2016-12-21 14:13:20.119303 INFO InsteonMotion: Hello from InsteonMotion
2016-12-21 14:13:20.119844 INFO Loading Object GarageDoor using class GarageDoor from module garage_door
2016-12-21 14:13:20.120911 INFO Loading Module: conf/apps/alarm_security.py
2016-12-21 14:13:20.121019 DEBUG Calling initialize() for GarageDoor
2016-12-21 14:13:20.121079 INFO GarageDoor: Hello from GarageDoor
2016-12-21 14:13:20.121139 DEBUG GarageDoor initialize() done
2016-12-21 14:13:20.121557 INFO Loading Object AlarmSecurity using class AlarmSecurity from module alarm_security
2016-12-21 14:13:20.121704 DEBUG Calling initialize() for AlarmSecurity
2016-12-21 14:13:20.121761 INFO Loading Module: conf/apps/connected_clients.py
2016-12-21 14:13:20.121951 INFO AlarmSecurity: Hello from AlarmSecurity 14:13:20.121
2016-12-21 14:13:20.123705 DEBUG AlarmSecurity initialize() done
2016-12-21 14:13:20.124047 INFO Loading Object ConnectedClients using class ConnectedClients from module connected_clients
2016-12-21 14:13:20.124169 DEBUG Calling initialize() for ConnectedClients
2016-12-21 14:13:20.124234 INFO Loading Module: conf/apps/camera_automation.py
2016-12-21 14:13:20.124295 INFO ConnectedClients: Starting ConnectedClients App
2016-12-21 14:13:20.124504 DEBUG ConnectedClients initialize() done
2016-12-21 14:13:20.124646 INFO Loading Object CameraAutomation using class CameraAutomation from module camera_automation
2016-12-21 14:13:20.124856 DEBUG Calling initialize() for CameraAutomation
2016-12-21 14:13:20.124905 INFO Loading Module: conf/apps/livingroom_light.py
2016-12-21 14:13:20.124943 INFO CameraAutomation: Starting CameraAutomation App
2016-12-21 14:13:20.125292 INFO Loading Object LivingroomLight using class LivingroomLight from module livingroom_light
2016-12-21 14:13:20.125341 DEBUG CameraAutomation initialize() done
2016-12-21 14:13:20.125480 DEBUG Calling initialize() for LivingroomLight
2016-12-21 14:13:20.125544 INFO Loading Module: conf/apps/custom_notification.py
2016-12-21 14:13:20.125589 INFO LivingroomLight: Hello from LivingroomLight
2016-12-21 14:13:20.125703 INFO Loading Object Notifications using class Notifications from module custom_notification
2016-12-21 14:13:20.125763 DEBUG Registering run_at_sunset with kwargs = {'offset': -1800} for LivingroomLight
2016-12-21 14:13:20.126054 DEBUG Registering run_every starting 2016-12-21 22:30:00 in 86400s intervals for LivingroomLight
2016-12-21 14:13:20.126097 INFO Loading Module: conf/apps/porch_light.py
2016-12-21 14:13:20.126153 DEBUG Calling initialize() for Notifications
2016-12-21 14:13:20.126493 DEBUG Registering run_every starting 2016-12-21 23:30:00 in 86400s intervals for LivingroomLight
2016-12-21 14:13:20.126547 INFO Notifications: Hello from CustomNotification
2016-12-21 14:13:20.126711 INFO Loading Object PorchLight using class PorchLight from module porch_light
2016-12-21 14:13:20.126808 DEBUG LivingroomLight initialize() done
2016-12-21 14:13:20.126842 DEBUG Notifications initialize() done
2016-12-21 14:13:20.127030 DEBUG Calling initialize() for PorchLight
2016-12-21 14:13:20.127074 INFO Loading Module: conf/apps/ecobee_automation.py
2016-12-21 14:13:20.127165 INFO PorchLight: Hello from PorchLight
2016-12-21 14:13:20.127343 DEBUG Registering run_at_sunset with kwargs = {'offset': -3600} for PorchLight
2016-12-21 14:13:20.127412 DEBUG Registering run_at_sunrise with kwargs = {'offset': 3600} for PorchLight
2016-12-21 14:13:20.127702 INFO Loading Module: conf/apps/ecobee_tracking.py
2016-12-21 14:13:20.127786 DEBUG PorchLight initialize() done
2016-12-21 14:13:20.128097 INFO Loading Object EcobeeTracking using class EcobeeTracking from module ecobee_tracking
2016-12-21 14:13:20.128284 DEBUG Calling initialize() for EcobeeTracking
2016-12-21 14:13:20.128339 INFO Loading Module: conf/apps/testing_toggle.py
2016-12-21 14:13:20.128393 INFO EcobeeTracking: Starting EcobeeTracking App
2016-12-21 14:13:20.128725 INFO Loading Object TestingToggle using class TestingToggle from module testing_toggle
2016-12-21 14:13:20.128877 DEBUG get_state: sensor.ecobee_dn_counter.None
2016-12-21 14:13:20.128925 DEBUG Calling initialize() for TestingToggle
2016-12-21 14:13:20.128970 INFO Loading Module: conf/apps/christmas_tree_light.py
2016-12-21 14:13:20.129017 DEBUG get_state: sensor.thermostat_downstairs_current_status.None
2016-12-21 14:13:20.129062 INFO TestingToggle: Hello from TestingToggle
2016-12-21 14:13:20.129254 DEBUG get_state: sensor.ecobee_dn_local_runtime.None
2016-12-21 14:13:20.129497 INFO Loading Object ChristmasTreeLight using class ChristmasTreeLight from module christmas_tree_light
2016-12-21 14:13:20.129551 DEBUG TestingToggle initialize() done
2016-12-21 14:13:20.129832 INFO Loading Module: conf/apps/rachio.py
2016-12-21 14:13:20.130809 DEBUG get_state: sensor.dn_last_cool_time.None
2016-12-21 14:13:20.130894 DEBUG Calling initialize() for ChristmasTreeLight
2016-12-21 14:13:20.131033 INFO EcobeeTracking: counter=0, run time=00:00:00, last cool=None, old state=idle, new state=idle at 14:13:20.131
2016-12-21 14:13:20.131096 INFO ChristmasTreeLight: Hello from ChristmasTreeLight
2016-12-21 14:13:20.131278 INFO Loading Object Rachio using class Rachio from module rachio
2016-12-21 14:13:20.131345 INFO EcobeeTracking: Down: 0, idle, 0:00:00, None
2016-12-21 14:13:20.131436 DEBUG Registering run_every starting 2016-12-22 06:00:00 in 86400s intervals for ChristmasTreeLight
2016-12-21 14:13:20.131629 INFO Waiting for App initialization: 7 remaining
2016-12-21 14:13:20.131728 DEBUG Calling initialize() for Rachio
2016-12-21 14:13:20.131797 DEBUG get_state: sensor.ecobee_up_counter.None
2016-12-21 14:13:20.131977 INFO Rachio: Hello from Rachio
2016-12-21 14:13:20.132072 DEBUG get_state: sensor.thermostat_upstairs_current_status.None
2016-12-21 14:13:20.132170 DEBUG Registering run_every starting 2016-12-21 22:30:00 in 86400s intervals for ChristmasTreeLight
2016-12-21 14:13:20.133210 DEBUG get_state: sensor.ecobee_up_local_runtime.None
2016-12-21 14:13:20.133374 DEBUG get_state: sensor.up_last_cool_time.None
2016-12-21 14:13:20.133437 DEBUG ChristmasTreeLight initialize() done
2016-12-21 14:13:20.133512 INFO EcobeeTracking: counter=0, run time=00:00:00, last cool=None, old state=idle, new state=idle at 14:13:20.133
2016-12-21 14:13:20.133596 INFO EcobeeTracking: Up: 0, idle, 0:00:00, None
2016-12-21 14:13:20.133641 DEBUG Registering run_every starting 2016-12-22 00:00:00 in 86400s intervals for EcobeeTracking
2016-12-21 14:13:20.133694 INFO EcobeeTracking: Done
2016-12-21 14:13:20.133727 DEBUG EcobeeTracking initialize() done
<Response [200]>
<Response [200]>
2016-12-21 14:13:20.367597 DEBUG get_state: input_slider.motion_light_on_seconds.None
2016-12-21 14:13:20.367726 INFO InsteonMotion: 30
2016-12-21 14:13:20.367806 DEBUG InsteonMotion initialize() done
<Response [200]>
2016-12-21 14:13:20.487544 DEBUG RingDoorbell initialize() done
<Response [200]>
2016-12-21 14:13:20.497076 DEBUG Rachio initialize() done
2016-12-21 14:13:20.806625 INFO HelloWorld: Done
2016-12-21 14:13:20.806705 DEBUG HelloWorld initialize() done
2016-12-21 14:13:21.069946 INFO HARestarted: Done
2016-12-21 14:13:21.070029 DEBUG HARestarted initialize() done
2016-12-21 14:13:21.132961 INFO App initialization complete
2016-12-21 14:13:21.133111 DEBUG Starting timer thread
2016-12-21 14:13:21.134760 DEBUG Registering run_in in 60 seconds for HARestarted
...
...
2016-12-21 14:14:00.597412 DEBUG Event type:state_changed:
2016-12-21 14:14:00.597514 DEBUG {'new_state': {'last_updated': '2016-12-21T20:14:00.560399+00:00', 'attributes': {'friendly_name': 'UPS Time to empty', 'icon': 'mdi:battery-10'}, 'entity_id': 'sensor.ups_time_to_empty', 'state': '2.0 hours', 'last_changed': '2016-12-21T20:14:00.560399+00:00'}, 'entity_id': 'sensor.ups_time_to_empty', 'old_state': {'last_updated': '2016-12-21T20:00:00.576797+00:00', 'attributes': {'friendly_name': 'UPS Time to empty', 'icon': 'mdi:battery-10'}, 'entity_id': 'sensor.ups_time_to_empty', 'state': '2.1 hours', 'last_changed': '2016-12-21T20:00:00.576797+00:00'}}
2016-12-21 14:14:00.597566 DEBUG Entity ID:sensor.ups_time_to_empty:
2016-12-21 14:14:00.601479 DEBUG Event type:state_changed:
2016-12-21 14:14:00.601572 DEBUG {'new_state': {'last_updated': '2016-12-21T20:14:00.573772+00:00', 'attributes': {'friendly_name': 'Office Room', 'unit_of_measurement': '°F'}, 'entity_id': 'sensor.office_room_temperature', 'state': '72.9', 'last_changed': '2016-12-21T20:14:00.573772+00:00'}, 'entity_id': 'sensor.office_room_temperature', 'old_state': {'last_updated': '2016-12-21T20:10:30.547125+00:00', 'attributes': {'friendly_name': 'Office Room', 'unit_of_measurement': '°F'}, 'entity_id': 'sensor.office_room_temperature', 'state': '72.7', 'last_changed': '2016-12-21T20:10:30.547125+00:00'}}
2016-12-21 14:14:00.601646 DEBUG Entity ID:sensor.office_room_temperature:
2016-12-21 14:14:00.605780 DEBUG Event type:state_changed:
2016-12-21 14:14:00.605831 DEBUG {'new_state': {'last_updated': '2016-12-21T20:14:00.576169+00:00', 'attributes': {'friendly_name': 'Downstairs Thermostat', 'unit_of_measurement': '°F', 'icon': 'mdi:gauge'}, 'entity_id': 'sensor.downstairs_temperature', 'state': '69.8', 'last_changed': '2016-12-21T20:14:00.576169+00:00'}, 'entity_id': 'sensor.downstairs_temperature', 'old_state': {'last_updated': '2016-12-21T20:10:30.549022+00:00', 'attributes': {'friendly_name': 'Downstairs Thermostat', 'unit_of_measurement': '°F', 'icon': 'mdi:gauge'}, 'entity_id': 'sensor.downstairs_temperature', 'state': '69.5', 'last_changed': '2016-12-21T20:10:30.549022+00:00'}}
2016-12-21 14:14:00.605907 DEBUG Entity ID:sensor.downstairs_temperature:
2016-12-21 14:14:00.609805 DEBUG Event type:state_changed:
2016-12-21 14:14:00.609875 DEBUG {'new_state': {'last_updated': '2016-12-21T20:14:00.578949+00:00', 'attributes': {'friendly_name': "Alan's Room", 'unit_of_measurement': '°F'}, 'entity_id': 'sensor.alans_room_temperature', 'state': '71.2', 'last_changed': '2016-12-21T20:14:00.578949+00:00'}, 'entity_id': 'sensor.alans_room_temperature', 'old_state': {'last_updated': '2016-12-21T20:10:30.553780+00:00', 'attributes': {'friendly_name': "Alan's Room", 'unit_of_measurement': '°F'}, 'entity_id': 'sensor.alans_room_temperature', 'state': '71.0', 'last_changed': '2016-12-21T20:10:30.553780+00:00'}}
2016-12-21 14:14:00.609923 DEBUG Entity ID:sensor.alans_room_temperature:
2016-12-21 14:14:16.579929 DEBUG Event type:state_changed:
2016-12-21 14:14:16.580020 DEBUG {'new_state': {'last_updated': '2016-12-21T20:14:16.572483+00:00', 'attributes': {'friendly_name': 'Entrance Doors', 'last_tripped_time': 475, 'sensor_class': 'opening'}, 'entity_id': 'binary_sensor.entrance_doors', 'state': 'off', 'last_changed': '2016-12-21T20:07:16.859107+00:00'}, 'entity_id': 'binary_sensor.entrance_doors', 'old_state': {'last_updated': '2016-12-21T20:13:46.877651+00:00', 'attributes': {'friendly_name': 'Entrance Doors', 'last_tripped_time': 445, 'sensor_class': 'opening'}, 'entity_id': 'binary_sensor.entrance_doors', 'state': 'off', 'last_changed': '2016-12-21T20:07:16.859107+00:00'}}
2016-12-21 14:14:16.580102 DEBUG Entity ID:binary_sensor.entrance_doors:
2016-12-21 14:14:16.589519 DEBUG Event type:state_changed:
2016-12-21 14:14:16.589656 DEBUG {'new_state': {'last_updated': '2016-12-21T20:14:16.575691+00:00', 'attributes': {'friendly_name': 'Motion Sensor', 'last_tripped_time': 30, 'sensor_class': 'motion'}, 'entity_id': 'binary_sensor.motion_sensor', 'state': 'off', 'last_changed': '2016-12-21T20:13:58.953992+00:00'}, 'entity_id': 'binary_sensor.motion_sensor', 'old_state': {'last_updated': '2016-12-21T20:13:58.953992+00:00', 'attributes': {'friendly_name': 'Motion Sensor', 'last_tripped_time': 215, 'sensor_class': 'motion'}, 'entity_id': 'binary_sensor.motion_sensor', 'state': 'off', 'last_changed': '2016-12-21T20:13:58.953992+00:00'}}
2016-12-21 14:14:16.589782 DEBUG Entity ID:binary_sensor.motion_sensor:
2016-12-21 14:14:21.000915 INFO HARestarted: notify_pb(): type=103, title=Home Assistant, msg=event_ha_started(): 14:14:21.000
2016-12-21 14:14:21.001108 DEBUG get_state: input_boolean.automation_notify.None
2016-12-21 14:14:22.273496 DEBUG get_state: sensor.ecobee_dn_counter.None
2016-12-21 14:14:22.273620 DEBUG set_state: sensor.ecobee_dn_counter, {'attributes': {'friendly_name': 'Ecobee Dn Counter', 'icon': 'mdi:counter'}, 'state': '0'}
2016-12-21 14:14:22.447087 DEBUG get_state: sensor.ecobee_up_counter.None
2016-12-21 14:14:22.447276 DEBUG set_state: sensor.ecobee_up_counter, {'attributes': {'friendly_name': 'Ecobee Up Counter', 'icon': 'mdi:counter'}, 'state': '0'}
2016-12-21 14:14:22.607063 DEBUG get_state: sensor.ecobee_dn_local_runtime.None
2016-12-21 14:14:22.607257 DEBUG set_state: sensor.ecobee_dn_local_runtime, {'attributes': {'friendly_name': 'Ecobee Dn Total Runtime', 'icon': 'mdi:counter'}, 'state': '0:00:00'}
2016-12-21 14:14:22.766994 DEBUG get_state: sensor.ecobee_up_local_runtime.None
2016-12-21 14:14:22.767143 DEBUG set_state: sensor.ecobee_up_local_runtime, {'attributes': {'friendly_name': 'Ecobee Up Total Runtime', 'icon': 'mdi:counter'}, 'state': '0:00:00'}

I cannot for the life of me figure out how to get AppDaemon to run on startup. I can run it manually and get my desired output no problem.

NAME=appdaemon
APPDAEMON_DIR=/home/homeassistant/.homeassistant/appdaemon/
DAEMON=/usr/local/bin/appdaemon
PIDFILE="$APPDAEMON_DIR/$NAME.pid"
CFGFILE="$APPDAEMON_DIR/conf/$NAME.cfg"
DAEMON_OPTS="-d -p $PIDFILE -c $CFGFILE"

The only line I changed is the APPDAEMON_DIR … but I know there is no pid file and I know the daemon location is wrong (there is nothing in that directory, currently). I did not do anything with ~/scripts/appdaemon.service. I’m at my wit’s end, because I know AppDaemon would be a great fit for me as I have a great handle on Python.

pi@raspberrypi:~ $ sudo su -s /bin/bash homeassistant
homeassistant@raspberrypi:/home/pi $ source /srv/homeassistant/bin/activate
(homeassistant) homeassistant@raspberrypi:/home/pi $ appdaemon -c /home/homeassistant/.homeassistant/appdaemon/conf/appdaemon.cfg
...
2016-12-23 23:59:17.100118 INFO App initialization complete

I am running Hassbian and once activating the virtual environment, under the homeassistant user, I am able to start appdaemon manually and see the desired output in my logs. However in following the steps, I am unable to get it to run on startup.

@SupahNoob i am sorry, i cant help you. i Always run appdaemon manually and dont want it any other way :wink:

but i have a christmaspresent for all appdaemonusers who write their own apps.
tired of running around up and down in the API seeking for that 1 command?
here is the command list:

http://appdaemon.reot.org/appdeamon_commands.html

ill probable need to make some tweeks, but did want to give you all a christmaspresent.

hope you all like it.

merry Christmas and many automated lightning from me.

5 Likes

Thanks it’s awesome…

1 Like
self.listen_event(self.startup_routine, 'homeassistant_start')
self.listen_event(self.shutdown_routine, 'homeassistant_stop')

Anyone have luck setting up event listeners for startup & shutdown? I can’t get them to trigger.

i only used ha_started

Can you share your automation? I’m unable to get this working for whatever reason.

mine is old and unused.

look at the example switch_reset which is included in appdaemon.

it has ha_started in it also.

I forgot to save my file, which is why it wasn’t working. If things look OK, it’s usually a UserError. :wink:

having HA in virtual environment, where (and how) do I install appdaemon?

Sorry newb here

lol, @SupahNoob :wink:

@anon35356645 i would install appdaemon inside the inviroment, but it isnt neccesary.
it also works when you install appdaemon on a completely different PC.

Hi, I’m trying to set up a callback to run a function when someone is at home but I don’t understand how to do it.

Which state should I use?

Best regards

AppDeamon allows you to react to State Changes, not states per-se. So do you mean you want to fire a function when someone arrives home? Someone specific? Anyone?