It looks like a simple copy/paste error. If you want to listen for changes in the User Presence state, try to replace TX_STATEPATH_EYETRACKINGSTATE with TX_STATEPATH_USERPRESENCE in the txGetStateValueAsInteger function call (row 9 in the last code snippet).
Then you need to check if the result is TX_USERPRESENCE_PRESENT or TX_USERPRESENCE_NOTPRESENT.
Moreover, I don’t think the txCreateStateBag row is necessary.
Please let me know how it goes.