Merge branch 'master' of https://git.steelants.cz/JonatanRek/PHP_SMART_HOME_V3
This commit is contained in:
@@ -30,6 +30,7 @@ class Ajax extends Template
|
||||
$subDeviceData = SubDeviceManager::getSubDevice($subDeviceId);
|
||||
$deviceId = SubDeviceManager::getSubDeviceMaster($subDeviceId)['device_id'];
|
||||
if ($subDeviceData['type'] == 'on/off'){
|
||||
//TODO: Pridelat kontrolu změnit stav pouze pokud se poslední [executed] stav != novému
|
||||
if (RecordManager::getLastRecord($subDeviceData['subdevice_id'])['value'] == 0){
|
||||
RecordManager::create($deviceId, 'on/off', 1);
|
||||
echo 'ON';
|
||||
|
@@ -20,9 +20,9 @@ class Automation extends Template
|
||||
$automationsData = AutomationManager::getAll();
|
||||
foreach ($automationsData as $automationKey => $automationData) {
|
||||
$doSomething = [];
|
||||
foreach (json_decode($automationData['do_something']) as $subdeviceId => $subDeviceState) {
|
||||
$subDeviceMasterDeviceData = SubDeviceManager::getSubDeviceMaster($subdeviceId);
|
||||
$doSomething[$subdeviceId] = [
|
||||
foreach (json_decode($automationData['do_something']) as $deviceId => $subDeviceState) {
|
||||
$subDeviceMasterDeviceData = DeviceManager::getDeviceById($deviceId);
|
||||
$doSomething[$deviceId] = [
|
||||
'name' => $subDeviceMasterDeviceData['name'],
|
||||
'state' => $subDeviceState,
|
||||
];
|
||||
@@ -43,7 +43,7 @@ class Automation extends Template
|
||||
$allSubDevicesData = SubDeviceManager::getAllSubDevices($deviceValue['device_id']);
|
||||
foreach ($allSubDevicesData as $subDeviceKey => $subDeviceValue) {
|
||||
$approvedSubDevices[$subDeviceValue['subdevice_id']] = [
|
||||
'name' => $allDevicesData[$deviceKey]['name'],
|
||||
'name' => $allDevicesData[$deviceKey]['name'] . $allDevicesData[$deviceKey]['device_id'],
|
||||
'type' => $subDeviceValue['type'],
|
||||
'masterDevice' => $subDeviceValue['device_id'],
|
||||
];
|
||||
|
Reference in New Issue
Block a user