Skip to content

Commit

Permalink
bug: reorder
Browse files Browse the repository at this point in the history
  • Loading branch information
mhzawadi committed Jul 13, 2024
1 parent c87ae1e commit 8ebe904
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/model/data.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,6 @@ public function process_data($mqtt_topic, $foxess_data, $collected_data, $total_
$this->log('Post '.$value.' of '.$name.' to MQTT', 1);

}
}elseif(array_key_exists('unit', $collected_data[$device]['result'][0]['datas'][$i]) === false){ // Text values
$data = $collected_data[$device]['result'][0]['datas'][$i];
$this->mqtt->post_mqtt(''.$mqtt_topic.'/'.$deviceSN.'/'.$name, $data['value']);
$this->log('Post '.$data['value'].' of '.$name.' to MQTT', 1);
}elseif(strstr($option, 'currentFault') !== false ||
strstr($option, 'currentFaultCount') !== false){ // only Faults
$data = $collected_data[$device]['result'][0]['datas'][$i];
$this->mqtt->post_mqtt(''.$mqtt_topic.'/'.$deviceSN.'/'.$name, $data['value']);
$this->log('Post '.$data['value'].' of '.$name.' to MQTT', 1);
}elseif(strstr($option, 'runningState') !== false){ // only runningState
$data = $collected_data[$device]['result'][0]['datas'][$i];
switch($data['value']){
Expand Down Expand Up @@ -139,6 +130,10 @@ public function process_data($mqtt_topic, $foxess_data, $collected_data, $total_
}
$this->mqtt->post_mqtt(''.$mqtt_topic.'/'.$deviceSN.'/'.$name, $data['value']);
$this->log('Post '.$data['value'].' of '.$name.' to MQTT', 1);
}elseif(array_key_exists('unit', $collected_data[$device]['result'][0]['datas'][$i]) === false){ // Text values
$data = $collected_data[$device]['result'][0]['datas'][$i];
$this->mqtt->post_mqtt(''.$mqtt_topic.'/'.$deviceSN.'/'.$name, $data['value']);
$this->log('Post '.$data['value'].' of '.$name.' to MQTT', 1);
}else{ // KW/KWh
if($collected_data[$device]['result'] == 'null'){
$value_kw = 0;
Expand Down

0 comments on commit 8ebe904

Please sign in to comment.