Skip to content

scripting

DaveL17 edited this page Dec 28, 2023 · 9 revisions

Refresh Announcement

You can invoke the Indigo Action item Refresh Announcement through a simple Python script:

plugin = indigo.server.getPlugin("com.fogbert.indigoplugin.announcements")
plugin.executeAction("refreshAnnouncementData", 1262061735, {'announcementToRefresh':'Hello_Dave',
'announcementDeviceToRefresh': 1262061735}) 

refreshAnnouncementData 1262061735 (Device ID - int - required)
{'announcementToRefresh':'Hello_Dave', 'announcementDeviceToRefresh': 1262061735} (props - dict - required)

NOTE: Pay special attention to the underscore in the announcement name. Because of the way the plugin stores announcement names, spaces are replaced with underscores. The above announcement in the UI appears as "Hello Dave". The device does not require any other parameters. If you include any other parameters in the props dictionary, they will be ignored. If you receive a ValueError, it is likely that you have not included a valid Indigo device ID. If you receive an ArgumentError it is likely that you did not include a device ID or that the value is not in the proper format (i.e., providing the device ID as a string instead of a required integer.) You must use the device ID--Indigo does not accept a device name in this situation.


Speak Announcement

You can invoke the Indigo Action item Speak Announcement through a simple Python script:

plugin = indigo.server.getPlugin("com.fogbert.indigoplugin.announcements")
plugin.executeAction("announcement_speak", 1262061735, {'announcementToSpeak':'Hello_Dave',
'announcementDeviceToRefresh': 1262061735}) 

announcement_speak 1262061735 (Device ID - int - required)
{'announcementToSpeak':'Hello_Dave', 'announcementDeviceToRefresh': 1262061735} (props - dict - required)

NOTE: Pay special attention to the underscore in the announcement name. Because of the way the plugin stores announcement names, spaces are replaced with underscores. So the above announcement in the UI appears as "Hello Dave". The device does not require any other parameters. If you include any other parameters in the props dictionary, they will be ignored. If you receive a ValueError, it is likely that you have not included a valid Indigo device ID. If you receive an ArgumentError it is likely that you did not include a device ID or that the value is not in the proper format (i.e., providing the device ID as a string instead of a required integer.) You must use the device ID--Indigo does not accept a device name in this situation.

Export Announcements

You can invoke the Indigo Action item Export Announcements through a simple Python script:

import json

plugin = indigo.server.getPlugin("com.fogbert.indigoplugin.announcements") result =
plugin.executeAction("exportAnnouncements") my_announcements = json.loads(result) 

Note

The call to announcements_export is a request to receive a copy of the announcements database in JSON format. The database will be provided agnostically; the complete database will be provided. Using the above script will result in my_announcements containing a <dict> object.

exportAnnouncements No device object No props