Scheduled tasks - system modes?

andrew's Avatar Topic Author
User User
  • Posts: 341
  • Thanks: 28

Scheduled tasks - system modes?

1 year 11 months ago
#3539
I've just created my first scheduled task having successfully hooked up a zigbee dimmer switch through zigbee2mqtt. I see in the scheduled task edit screens that you can set the task to only run in certain system modes - home, away, vacation, night etc. Where can I see what mode the system is in and how does one set it? I couldn't see anything in the scheduler screens or the server command tester.

Andrew

Please Log in or Create an account to join the conversation.

davep's Avatar
Admin Admin
  • Posts: 371
  • Thanks: 98

Re: Scheduled tasks - system modes?

1 year 10 months ago
#3540
House mode is nothing more than a server variable {{housemode}}. To set a house mode just do SetVariable|housemode~<<your mode>>
Scheduler specifically looks for house mode values of Home, Away, Vacation, Daytime, Nighttime.
You are free to define your own house modes but if you are using them with Scheduler then stick to the ones mentioned here.
The following user(s) said Thank You: andrew

Please Log in or Create an account to join the conversation.

andrew's Avatar Topic Author
User User
  • Posts: 341
  • Thanks: 28

Re: Scheduled tasks - system modes?

1 year 10 months ago
#3541
Excellent. Thanks for that.

Andrew
The following user(s) said Thank You: CurlyOscar

Please Log in or Create an account to join the conversation.

andrew's Avatar Topic Author
User User
  • Posts: 341
  • Thanks: 28

Re: Scheduled tasks - system modes?

1 year 8 months ago
#3770
 
Well I finally tried this and it doesn't seem to work...

I have a scheduled task that turns on the bedroom light at 7am on weekdays and it's only supposed to happen if the system mode is Home, Daytime or Nighttime.

I put the system into 'Vacation' mode (so I thought) by setting the server variable 'housemode' to 'Vacation'. But the scheduled task still fires at 7am.

Scheduled task modes screen:
 

Macro that gets run:

Macro|
WebCmd|all~Toast|info~Server mode~The server mode is {{housemode}}~5000!
MqttPublish|zigbee2mqtt/Bedroom light/set~{"state": "ON"}

Log output:

26/12/2024 06:59:58.59 · DEBUG · AndroidTV.RX - FireTV <<  mScreenState=ON>>                                                                  
26/12/2024 06:59:58.59 · DEBUG · AndroidTV.TX: FireTV - dumpsys activity activities | grep "mResumedActivity"                                 
26/12/2024 06:59:58.59 · DEBUG · AndroidTV.RX - FireTV <<    mResumedActivity: ActivityRecord{b152fe7 u0 com.amazon.tv.launcher/.deeplink.acti
vity.DirectiveSearchResultsActivityDI t779}>>                                                                                                 
26/12/2024 07:00:00.00 · DEBUG · Server.doCommand - bedroom-light-turn-on from Server                                                         
26/12/2024 07:00:00.00 · DEBUG · Server.doCommand - WebCmd|all~Toast|info~Server mode~The server mode is {{housemode}}~5000 from Server       
26/12/2024 07:00:00.00 · DEBUG · Server.doCommand - WebCmd|all~Toast|info~Server mode~The server mode is Vacation~5000                        
26/12/2024 07:00:00.00 · DEBUG · Server.WebCmd - all~Toast|info~Server mode~The server mode is Vacation~5000                                  
26/12/2024 07:00:00.00 · DEBUG · Server.doCommand - MqttPublish|zigbee2mqtt/Bedroom light/set~{"state": "ON"} from Server                     
26/12/2024 07:00:01.00 · DEBUG · Server.doCommand - AV|23~Test~@SYS:MODELNAME=? from                                                          
26/12/2024 07:00:01.00 · DEBUG · YamahaAVR.doCommand - Cmd=[23~Test~@SYS:MODELNAME=?] Client=[Internal]                                       
26/12/2024 07:00:08.00 · DEBUG · AndroidTV.CheckAdb - Checking for ADB running 

 

Please Log in or Create an account to join the conversation.

andrew's Avatar Topic Author
User User
  • Posts: 341
  • Thanks: 28

Re: Scheduled tasks - system modes?

1 year 8 months ago
#3771
I think the variable you set is supposed to be 'server_housemode' not 'housemode'. And there appears to be a special command to set it too:

SetHouseMode|Vacation

We'll see tomorrow at 7am if this is it.

Please Log in or Create an account to join the conversation.

andrew's Avatar Topic Author
User User
  • Posts: 341
  • Thanks: 28

Re: Scheduled tasks - system modes?

1 year 8 months ago
#3772
Yes that's got it this time:

27/12/2024 06:59:56.59 · DEBUG · AndroidTV.TX: FireTV - dumpsys activity activities | grep "mResumedActivity"
27/12/2024 06:59:56.59 · DEBUG · AndroidTV.RX - FireTV << mResumedActivity: ActivityRecord{b152fe7 u0 com.amazon.tv.launcher/.deeplink.acti
vity.DirectiveSearchResultsActivityDI t779}>>
27/12/2024 07:00:00.00 · DEBUG · Scheduler.Tasks - Skipping Task Bedroom light - on at 7am weekdays. Not in correct house mode.
27/12/2024 07:00:01.00 · DEBUG · Server.doCommand - AV|23~Test~@SYS:MODELNAME=? from
27/12/2024 07:00:01.00 · DEBUG · YamahaAVR.doCommand - Cmd=[23~Test~@SYS:MODELNAME=?] Client=[Internal]
27/12/2024 07:00:06.00 · DEBUG · AndroidTV.CheckAdb - Checking for ADB running


So if you want to use modes on scheduled tasks set the variable 'server_housemode'.

Please Log in or Create an account to join the conversation.

Time to create page: 0.336 seconds