true, 'Typ' => 'DI', 'Kanal' => 1, 'Anzeigename' => 'Test Eingang', 'Abfrageintervall' => 1000, ], [ 'Aktiv' => true, 'Typ' => 'DO', 'Kanal' => 1, 'Anzeigename' => 'Test Ausgang', 'Abfrageintervall' => 1000, ], [ 'Aktiv' => true, 'Typ' => 'AI', 'Kanal' => 1, 'Anzeigename' => 'Test Spannung Eingang', 'Abfrageintervall' => 1000, ], [ 'Aktiv' => true, 'Typ' => 'AO', 'Kanal' => 1, 'Anzeigename' => 'Test Spannung Ausgang', 'Abfrageintervall' => 1000, ], [ 'Aktiv' => true, 'Typ' => 'PT', 'Kanal' => 1, 'Anzeigename' => 'Test Temperatur', 'Abfrageintervall' => 1000, ], ], JSON_THROW_ON_ERROR); $moduleId = $test->createInstance( '{D62EA550-68A5-48E2-BF31-1C721AA1BD4E}', 'CC100 Hardware', [ 'Kanalauswahl' => $channels, 'DigitalInputPath' => $digitalInput, 'DigitalOutputPath' => $digitalOutput, 'CalibrationPath' => $calibration, 'AI1Path' => $ai1, 'AO1ValuePath' => $ao1, 'AO1PowerPath' => $ao1Power, 'PT1Path' => $pt1, ] ); $test->runCase('Nur ausgewaehlte Kanaele werden angelegt und gelesen', static function ( TestContext $test ) use ($moduleId): void { $test->assertInstanceStatus($moduleId); $test->assertSame(true, GetValue($test->objectByIdent('DI1', $moduleId))); $test->assertSame(false, @IPS_GetObjectIDByIdent('DI2', $moduleId)); $test->assertEquals(5.0, (float) GetValue($test->objectByIdent('AI1', $moduleId)), 0.001); $test->assertEquals(0.0, (float) GetValue($test->objectByIdent('PT1', $moduleId)), 0.1); }); $test->runCase('Digitaler Ausgang erhaelt die anderen Bits', static function ( TestContext $test ) use ($moduleId, $digitalOutput): void { file_put_contents($digitalOutput, '4'); IPS_RequestAction($moduleId, 'DO1', true); $test->assertSame('5', trim((string) file_get_contents($digitalOutput))); $test->assertSame(true, GetValue($test->objectByIdent('DO1', $moduleId))); }); $test->runCase('Analoger Ausgang wird invers kalibriert geschrieben', static function ( TestContext $test ) use ($moduleId, $ao1, $ao1Power): void { IPS_RequestAction($moduleId, 'AO1', 2.5); $test->assertSame('0', trim((string) file_get_contents($ao1Power))); $test->assertSame('450', trim((string) file_get_contents($ao1))); $test->assertEquals(2.5, (float) GetValue($test->objectByIdent('AO1', $moduleId)), 0.001); }); foreach ($temporaryFiles as $path) { @unlink($path); } };