Differences
This shows you the differences between two versions of the page.
Next revision | Previous revisionLast revisionBoth sides next revision | ||
livebox:google_calendar [2011/12/17 19:24] – created brett | livebox:google_calendar [2013/12/27 21:40] – minerva9 | ||
---|---|---|---|
Line 2: | Line 2: | ||
{{ : | {{ : | ||
+ | |||
+ | <note warning> | ||
+ | |||
+ | </ | ||
This program will monitor a calendar and produce an xAP payload every minute for as long as the activity is running. | This program will monitor a calendar and produce an xAP payload every minute for as long as the activity is running. | ||
Line 21: | Line 25: | ||
</ | </ | ||
- | {{: | + | {{: |
+ | ===== Scheduling events ===== | ||
+ | |||
+ | An entry is setup in the calendar using the following fields. | ||
+ | |||
+ | {{: | ||
+ | |||
+ | * What: <Some text defining your event> | ||
+ | * Where: XAP < | ||
+ | * When: Start-time to Stop-time | ||
+ | * Description: | ||
+ | < | ||
+ | | ||
+ | { | ||
+ | | ||
+ | | ||
+ | } | ||
+ | | ||
+ | { | ||
+ | | ||
+ | | ||
+ | | ||
+ | } | ||
+ | </ | ||
+ | In the header you only have to specify the xAP message type (class) and the target.\\ | ||
+ | The other fields will be automatically populated for you. | ||
+ | |||
+ | The event will fire every minute for the duration of the start/stop time.\\ | ||
+ | If you require a single message then make the start/stop time the same value. | ||
+ | |||
+ | Another example, this text in the calendar event description will turn on RF module number 2. | ||
+ | |||
+ | < | ||
+ | xAP-header | ||
+ | { | ||
+ | class=xAPBSC.cmd | ||
+ | target=dbzoo.livebox.Controller: | ||
+ | } | ||
+ | output.state.1 | ||
+ | { | ||
+ | id=* | ||
+ | state=on | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | Notice that there is no automatic generation of an ' | ||
+ | ===== Calendar aliases ===== | ||
+ | |||
+ | Leaving out the description of the calendar entry the Google calendar component will interpret the title as an alias. | ||
+ | |||
+ | So now a calendar definition can be as simple as | ||
+ | |||
+ | {{: | ||
+ | |||
+ | This will result in a the following xAP message being transmitted. | ||
+ | < | ||
+ | xap-header | ||
+ | { | ||
+ | v=12 | ||
+ | hop=1 | ||
+ | uid=FF00D900 | ||
+ | class=alias | ||
+ | source=dbzoo.livebox.Twitter | ||
+ | } | ||
+ | command | ||
+ | { | ||
+ | text=relay 1 on | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | It is up to the alias scripts running with [[hah_plugboard_v2]] to determine what action to take. See twitter for an example of an [[twitter# | ||
+ | |||
+ | ===== Recording events ===== | ||
+ | |||
+ | The Google calender daemon can also act as a service. | ||
+ | |||
+ | Header information | ||
+ | * the target will be: target=dbzoo.livebox.GoogleApp | ||
+ | * and the schema is: class=google.calendar | ||
+ | |||
+ | The body has the following elements | ||
+ | < | ||
+ | event | ||
+ | { | ||
+ | title= | ||
+ | start= | ||
+ | end= | ||
+ | description= | ||
+ | where= | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | * Title is mandatory and contains a brief description of the logged event. | ||
+ | * Start is mandatory and can use a natural language format for its specification. | ||
+ | * End is optional and if not supplied the event is assumed to be 1 min long. | ||
+ | * Description is optional. | ||
+ | * Where is optional default xap-event. | ||
+ | |||
+ | **Start / End format**\\ | ||
+ | - We always try to parse as ISO8601 first. We don't support week/ | ||
+ | - We then try some fancy natural language processing. No ambiguous formats are represented. 4/3/5 is *not* a valid input, regardless of your locale. But most of the phrases accepted by the current getdate *are*. We can also read in RFC822-conformant dates. ("Wed, 22 Aug 2001 19:35:16 -0400" | ||
+ | |||
+ | **Full payload example**\\ | ||
+ | < | ||
+ | xap-header | ||
+ | { | ||
+ | v=12 | ||
+ | hop=1 | ||
+ | uid=FF123400 | ||
+ | class=google.calendar | ||
+ | source=acme.booker.ping | ||
+ | target=dbzoo.livebox.GoogleCal | ||
+ | } | ||
+ | event | ||
+ | { | ||
+ | title=Lunch | ||
+ | start=tomorrow at 12pm | ||
+ | end=tomorrow at 1pm | ||
+ | description=at Benji | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== Troubleshooting ===== | ||
+ | |||
+ | I start up Google Calendar in debug mode and it won't connect! | ||
+ | < | ||
+ | # xap-googlecal -i br0 -d 7 | ||
+ | </ | ||
+ | This is what I see. | ||
+ | < | ||
+ | [alr][googlecal.c: | ||
+ | [inf][tx.c: | ||
+ | xap-header | ||
+ | { | ||
+ | v=12 | ||
+ | hop=1 | ||
+ | uid=FF00DA00 | ||
+ | class=google.calendar | ||
+ | source=dbzoo.livebox.GoogleCal | ||
+ | } | ||
+ | error | ||
+ | { | ||
+ | text=Failed to authenticate | ||
+ | } | ||
+ | |||
+ | [alr][googlecal.c: | ||
+ | </ | ||
+ | |||
+ | Make sure the CLOCK on your Livebox has correctly been set by NTP. |