Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
safetcut-app
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
atichat
safetcut-app
Commits
e9ada991
Commit
e9ada991
authored
Sep 26, 2019
by
HaOuiha
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
7f354269
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
10 deletions
+9
-10
screens/Private/SmartMeterScreen/SmartMeterDetailScreen.js
+9
-10
No files found.
screens/Private/SmartMeterScreen/SmartMeterDetailScreen.js
View file @
e9ada991
...
...
@@ -68,7 +68,8 @@ class SmartMeterDetailScreen extends Component {
componentDidUpdate
=
(
prevProps
,
prevState
)
=>
{
if
(
prevProps
.
currentSelectedData
!==
this
.
props
.
currentSelectedData
||
prevProps
.
breakerStatus
!==
this
.
props
.
breakerStatus
prevProps
.
breakerStatus
!==
this
.
props
.
breakerStatus
||
prevState
.
isPowerOn
!==
this
.
state
.
isPowerOn
)
{
this
.
setMainCardData
();
}
...
...
@@ -89,10 +90,12 @@ class SmartMeterDetailScreen extends Component {
await
this
.
props
.
getCurrentSelectedShadow
();
await
this
.
props
.
setMainStatus
(
value
);
this
.
setState
({
isPowerOn
:
this
.
props
.
desiredBreakerStatus
.
SM1
.
BK_S
});
const
getShadowInterval
=
setInterval
(
async
()
=>
{
this
.
setState
(()
=>
{
const
{
currentSelectedData
,
breakerStatus
}
=
this
.
props
;
if
(
this
.
props
.
desiredBreakerStatus
===
this
.
props
.
breakerStatus
)
{
const
{
currentSelectedData
,
breakerStatus
,
desiredBreakerStatus
}
=
this
.
props
;
if
(
desiredBreakerStatus
.
SM1
.
BK_S
===
breakerStatus
.
SM1
.
BK_S
)
{
clearInterval
(
getShadowInterval
);
return
{
...
...
@@ -101,14 +104,11 @@ class SmartMeterDetailScreen extends Component {
name
:
currentSelectedData
.
name
,
rcbo
:
currentSelectedData
.
rcbo
,
isOnline
:
currentSelectedData
.
isOnline
,
isPowerOn
:
breakerStatus
?
b
reakerStatus
.
SM1
.
BK_S
:
false
,
isPowerOn
:
desiredBreakerStatus
?
desiredB
reakerStatus
.
SM1
.
BK_S
:
false
,
};
}
else
{
if
(
checkedTimes
>=
2
)
{
clearInterval
(
getShadowInterval
);
// if (this.props.desiredBreakerStatus !== this.props.breakerStatus) {
// alert('Something went wrong, Please check your smart device.');
// }
checkedTimes
=
0
;
}
...
...
@@ -123,6 +123,7 @@ class SmartMeterDetailScreen extends Component {
}
});
++
checkedTimes
;
await
this
.
props
.
getCurrentSelectedShadow
();
this
.
setSubBreakersState
();
},
3000
);
...
...
@@ -298,9 +299,7 @@ class SmartMeterDetailScreen extends Component {
}
else
{
if
(
checkedTimes
>=
2
)
{
clearInterval
(
getShadowInterval
);
// if (this.props.desiredBreakerStatus !== this.props.breakerStatus) {
// alert('Something went wrong, Please check your smart device.');
// }
checkedTimes
=
0
;
}
return
{
isWaiting
:
false
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment