Skip to content

Complete documented return values, keys and constants - #79

Merged
paresy merged 1 commit into
masterfrom
fix/p2-doc-alignment
Oct 17, 2026
Merged

paresy merged 1 commit into
masterfrom
fix/p2-doc-alignment

Conversation

@paresy

@paresy paresy commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #78. This covers the P2 items from the comparison with the official docs (https://www.symcon.de/de/llms.txt) and the kernel source.

Return values

  • IPS_Set*, IPS_Delete*, the profile functions and IPS_RequestAction return true, as documented. Before they returned null.
  • RegisterScript now really creates a script, like the kernel:
    • it is read-only
    • its default content is <?php\n\n//Autogenerated script
    • the content is updated when it changes
    • IPSModule returns the script ID; IPSModuleStrict returns whether the script was created

Keys

  • IPS_GetCategory now contains CategoryID.
  • IPS_GetInstance now contains InstanceSupportsSearching, InstanceIsSearching and InstanceVisualizationType. InstanceChanged follows the simulated time.
  • IPS_GetScript now contains ScriptCRC, ScriptSize and ScriptUpdated, updated whenever the content changes.
  • IPS_GetModule now contains URL, Limit and Translation. The stub's internal Class key is no longer returned.
  • The media functions now use the MediaManager, which already stored the records:
    • IPS_GetMedia, IPS_GetMediaList, IPS_GetMediaListByType, IPS_GetMediaIDByFile and IPS_GetMediaIDByName return real data
    • IPS_GetMediaContent, IPS_SetMediaContent, IPS_SetMediaFile and IPS_SetMediaCached work
    • content is kept in memory as Base64

Module API

  • SetVisualizationType is protected, as in the kernel. It returns true and is reflected in IPS_GetInstance.
  • ConnectParent, RequireParent and ForceParent are removed from IPSModuleStrict. The docs say they are only available for IPSModule.
  • The timer methods are back to their documented signatures, without the extra $start/$currentTime parameters. Before, a module overriding them with the documented signature hit a PHP fatal error.
  • Registering a timer no longer calls getTime, so legacy modules no longer need a getTime just to register a timer.
  • Removed the duplicate time source in IPSModuleStrict.
  • UpdateVisualizationValue returns true and is typed bool in strict.

Constants and messages

I compared ConstantStubs.php and MessageStubs.php against the constants the kernel registers (IPSScriptEngine.cpp). These are added:

  • Types: MODULETYPE_VISUALIZATION, SCRIPTTYPE_FLOW, SCRIPTTYPE_IPSWORKFLOW, MEDIATYPE_IPSVIEW, MEDIATYPE_FORM
  • Instances and debug: INSTANCE_VISUALIZATION_TYPE_*, DEBUG_FORMAT_*
  • Events: EVENT_CONDITION_OPERATION_*, EVENT_DAY_*
  • Other: COLOR_TRANSPARENT, COLOR_ENCODING_*, USER_TYPE_*, REPLICATION_MODE_*, VARIABLE_ACTION_*
  • Messages:
    • IS_STANDBY, OM_CHANGELOCKED, OM_CHANGEHIDDENTITLE, OM_CHANGEHIDDENMAXIMIZE
    • IM_REMOVEATTRIBUTE, VM_CHANGELOCKED, EM_CHANGEACTION, EM_*DAYOFTHEWEEKRULE
    • SM_UPDATE = 10705. The docs print 10704, which is a typo; the kernel uses IPS_SCRIPTMESSAGE + 5.
    • SE_FLOWSCRIPT, plus the AM_*, LP_* and TP_* families with their base values

All existing values already matched. The legacy names MEDIATYPE_DASHBOARD and EM_CHANGESCRIPT are kept.

Validator

  • Empty URLs are accepted; the docs allow them.
  • GUIDs must have braces, using the same regex as the kernel (IsGUID).
  • Fixed a typo in an error message ("not a valid").

⚠️ Can break downstream module tests

  • Modules or tests that call $this->ConnectParent/RequireParent/ForceParent from IPSModuleStrict. These calls would fail on a real system too.
  • Tests that call SetVisualizationType from outside the module. It is protected now.
  • module.json files with GUIDs without braces now fail the validator.

Tests

  • Added tests/DocumentationAlignmentTest.php with 14 tests.
  • The full suite passes (105 tests), including the IPS 7.4 emulation.
  • php-cs-fixer with .style and the JSON check are clean.
  • The validation tests report 8 fewer assertions. That's expected: SetVisualizationType is no longer public, so the validator no longer type-checks it.

🤖 Generated with Claude Code

- Return TRUE from IPS_Set*/Delete*/profile functions and IPS_RequestAction like documented
- RegisterScript creates a read-only script with the default content of the kernel and returns its ID (IPSModuleStrict: whether it was created)
- Add CategoryID, InstanceSupportsSearching/InstanceIsSearching/InstanceVisualizationType, ScriptCRC/ScriptSize/ScriptUpdated and URL/Limit/Translation to the IPS_Get* results; hide the internal Class key of IPS_GetModule
- Wire up IPS_GetMedia and the other media functions to the MediaManager
- SetVisualizationType is protected like in the kernel and is reflected in IPS_GetInstance
- Remove ConnectParent/RequireParent/ForceParent from IPSModuleStrict, which are only available for IPSModule
- Restore the documented timer signatures without the additional time parameters
- Add missing constants and messages registered by the kernel (e.g. MODULETYPE_VISUALIZATION, SCRIPTTYPE_FLOW, DEBUG_FORMAT_*, INSTANCE_VISUALIZATION_TYPE_*, EVENT_DAY_*, IS_STANDBY, IM_REMOVEATTRIBUTE, SM_UPDATE, AM_*, LP_*, TP_*)
- Validator: allow empty URLs, require braces for GUIDs like the kernel, fix typo

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@paresy
paresy merged commit 31f2e04 into master Oct 17, 2026
4 checks passed
@paresy
paresy deleted the fix/p2-doc-alignment branch October 17, 2026 07:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant