@eohjsc/react-native-smart-city 0.3.19 → 0.3.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@eohjsc/react-native-smart-city",
3
3
  "title": "React Native Smart Home",
4
- "version": "0.3.19",
4
+ "version": "0.3.20",
5
5
  "description": "TODO",
6
6
  "main": "index.js",
7
7
  "files": [
@@ -55,7 +55,6 @@ const OnOffTemplate = memo(({ actionGroup, doAction, sensor }) => {
55
55
  );
56
56
 
57
57
  const triggerAction = useCallback(async () => {
58
- setTempIsOn((prev) => !prev);
59
58
  switch (sensor?.device_type) {
60
59
  case DEVICE_TYPE.ZIGBEE:
61
60
  if (action_on_data && action_off_data) {
@@ -75,11 +74,10 @@ const OnOffTemplate = memo(({ actionGroup, doAction, sensor }) => {
75
74
  }
76
75
  break;
77
76
  case DEVICE_TYPE.LG_THINQ:
77
+ setTempIsOn((prev) => !prev);
78
78
  if (action_data) {
79
79
  await doAction(action_data, JSON.stringify({ value: !isOn }));
80
80
  }
81
-
82
- updateStatusFromPusher();
83
81
  break;
84
82
  default:
85
83
  if (action_data) {
@@ -98,6 +96,7 @@ const OnOffTemplate = memo(({ actionGroup, doAction, sensor }) => {
98
96
  }
99
97
  break;
100
98
  }
99
+ updateStatusFromPusher();
101
100
  if (sensor?.is_managed_by_backend) {
102
101
  configuration?.config &&
103
102
  sensor?.device_type !== 'GOOGLE_HOME' &&
@@ -130,7 +129,13 @@ const OnOffTemplate = memo(({ actionGroup, doAction, sensor }) => {
130
129
  if (sensor?.is_managed_by_backend && sensor.device_type !== 'GOOGLE_HOME') {
131
130
  watchMultiConfigs([configuration.config]);
132
131
  }
133
- }, [sensor, configuration.config]);
132
+ }, [sensor, configuration.config, getIsOnValue]);
133
+
134
+ useEffect(() => {
135
+ if (sensor?.device_type !== DEVICE_TYPE.LG_THINQ) {
136
+ setTempIsOn(getIsOnValue());
137
+ }
138
+ }, [getIsOnValue, sensor?.device_type]);
134
139
 
135
140
  const Component = useMemo(() => {
136
141
  return getComponent(actionGroup.template);