Skip to content

Commit 57fa1b4

Browse files
authored
bugfix state for tow way switch
1 parent 2ff735c commit 57fa1b4

2 files changed

Lines changed: 60 additions & 6 deletions

File tree

core/config/devices/LightSwitchTwoWay.json

Lines changed: 40 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,20 @@
22
"name" : "Va et vient",
33
"commands" : [
44
{
5-
"name": "Etat",
5+
"name": "Etat 1",
66
"type": "info",
77
"subtype": "binary",
88
"isVisible": 0,
99
"isHistorized": 0,
10-
"logicalId": "channelStatus"
10+
"logicalId": "channelStatus_1"
11+
},
12+
{
13+
"name": "Etat 2",
14+
"type": "info",
15+
"subtype": "binary",
16+
"isVisible": 0,
17+
"isHistorized": 0,
18+
"logicalId": "channelStatus_2"
1119
},
1220
{
1321
"name": "Source evenement",
@@ -34,26 +42,52 @@
3442
"logicalId": "eventCode"
3543
},
3644
{
37-
"name": "On",
45+
"name": "On 1",
46+
"type": "action",
47+
"subtype": "other",
48+
"isVisible": 1,
49+
"isHistorized": 0,
50+
"logicalId": "SWITCH_ON",
51+
"value" :"Etat 1",
52+
"template":{
53+
"dashboard" : "prise",
54+
"mobile" : "prise"
55+
}
56+
},
57+
{
58+
"name": "Off 1",
59+
"type": "action",
60+
"subtype": "other",
61+
"isVisible": 1,
62+
"isHistorized": 0,
63+
"logicalId": "SWITCH_OFF",
64+
"value" :"Etat 1",
65+
"template":{
66+
"dashboard" : "prise",
67+
"mobile" : "prise"
68+
}
69+
},
70+
{
71+
"name": "On 2",
3872
"type": "action",
3973
"subtype": "other",
4074
"isVisible": 1,
4175
"isHistorized": 0,
4276
"logicalId": "SWITCH_ON",
43-
"value" :"Etat",
77+
"value" :"Etat 2",
4478
"template":{
4579
"dashboard" : "prise",
4680
"mobile" : "prise"
4781
}
4882
},
4983
{
50-
"name": "Off",
84+
"name": "Off 2",
5185
"type": "action",
5286
"subtype": "other",
5387
"isVisible": 1,
5488
"isHistorized": 0,
5589
"logicalId": "SWITCH_OFF",
56-
"value" :"Etat",
90+
"value" :"Etat 2",
5791
"template":{
5892
"dashboard" : "prise",
5993
"mobile" : "prise"

core/php/jeeAjaxSystem.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,26 @@
7070
if ($convert_key == 'realState') {
7171
$value = ($value == 0) ? 1 : 0;
7272
}
73+
if($ajaxSystem->getConfiguration('device') == 'LightSwitchTwoWay' && $key == 'channelStatus'){
74+
switch ($value) {
75+
case 0:
76+
$ajaxSystem->checkAndUpdateCmd('channelStatus_1', 0);
77+
$ajaxSystem->checkAndUpdateCmd('channelStatus_2', 0);
78+
break;
79+
case 1:
80+
$ajaxSystem->checkAndUpdateCmd('channelStatus_1', 1);
81+
$ajaxSystem->checkAndUpdateCmd('channelStatus_2', 0);
82+
break;
83+
case 2:
84+
$ajaxSystem->checkAndUpdateCmd('channelStatus_1', 0);
85+
$ajaxSystem->checkAndUpdateCmd('channelStatus_2', 1);
86+
break;
87+
case 3:
88+
$ajaxSystem->checkAndUpdateCmd('channelStatus_1', 1);
89+
$ajaxSystem->checkAndUpdateCmd('channelStatus_2', 1);
90+
break;
91+
}
92+
}
7393
$ajaxSystem->checkAndUpdateCmd($convert_key, $value);
7494
if ($ajaxSystem->getConfiguration('device') == 'Socket') {
7595
$current = $ajaxSystem->getCmd('info', 'currentMA');

0 commit comments

Comments
 (0)