Commit 332ff98c authored by Antoine Blanquet's avatar Antoine Blanquet
Browse files

Passive Active Bug Fixed if file doesn't exisst at start (with Keving Y)

parent af917337
...@@ -46,26 +46,27 @@ do ...@@ -46,26 +46,27 @@ do
done done
#On stock les ids des devices d'hier if [ -f "${DATA_DEV_FOLDER}.last_devices_states.json" ]; then
ids_2=$(jq --raw-output ".result[] | .id" ${DATA_DEV_FOLDER}.last_devices_states.json) #On stock les ids des devices d'hier
id_2=() ids_2=$(jq --raw-output ".result[] | .id" ${DATA_DEV_FOLDER}.last_devices_states.json)
i=0 id_2=()
for ID in $ids_2 i=0
do for ID in $ids_2
id_2[$i]=$ID do
i=$((i+1)) id_2[$i]=$ID
done i=$((i+1))
done
#On stock les states des devices d'hier
full_state=$(jq --raw-output ".result[] | .lastState" ${DATA_DEV_FOLDER}.last_devices_states.json)
states_2=()
j=0
for s in $full_state
do
state_2[$j]=$s
j=$((j+1))
done
#On stock les states des devices d'hier
full_state=$(jq --raw-output ".result[] | .lastState" ${DATA_DEV_FOLDER}.last_devices_states.json)
states_2=()
j=0
for s in $full_state
do
state_2[$j]=$s
j=$((j+1))
done
fi
#On compare les states des devices d'aujourd'hui et hier #On compare les states des devices d'aujourd'hui et hier
for (( i=0; i<${#id[@]}; i++ )) for (( i=0; i<${#id[@]}; i++ ))
......
...@@ -45,26 +45,27 @@ do ...@@ -45,26 +45,27 @@ do
fi fi
done done
#We store yesterday gateways ids if [ -f "${DATA_GAT_FOLDER}.last_gateways_states.json" ]; then
ids_2=$(jq --raw-output ".result[] | .id" ${DATA_GAT_FOLDER}.last_gateways_states.json) #We store yesterday gateways ids
id_2=() ids_2=$(jq --raw-output ".result[] | .id" ${DATA_GAT_FOLDER}.last_gateways_states.json)
i=0 id_2=()
for ID in $ids_2 i=0
do for ID in $ids_2
id_2[$i]=$ID do
i=$((i+1)) id_2[$i]=$ID
done i=$((i+1))
done
#We store yesterday gateways states
full_state=$(jq --raw-output ".result[] | .lastState" ${DATA_GAT_FOLDER}.last_gateways_states.json)
states_2=()
j=0
for s in $full_state
do
state_2[$j]=$s
j=$((j+1))
done
#We store yesterday gateways states
full_state=$(jq --raw-output ".result[] | .lastState" ${DATA_GAT_FOLDER}.last_gateways_states.json)
states_2=()
j=0
for s in $full_state
do
state_2[$j]=$s
j=$((j+1))
done
fi
#We compare today and yesterday gateways states #We compare today and yesterday gateways states
for (( i=0; i<${#id[@]}; i++ )) for (( i=0; i<${#id[@]}; i++ ))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment