Fixed timer. Added response status to all calls.
This commit is contained in:
parent
ce687d1adb
commit
e06d486cdc
@ -326,7 +326,7 @@ sub Define {
|
|||||||
WriteToCloudAPI($hash, 'getChargers', 'GET');
|
WriteToCloudAPI($hash, 'getChargers', 'GET');
|
||||||
|
|
||||||
Log3 $name, 1, sprintf("EaseeWallbox_Define %s: Starting timer with interval %s", $name, InternalVal($name,'INTERVAL', undef));
|
Log3 $name, 1, sprintf("EaseeWallbox_Define %s: Starting timer with interval %s", $name, InternalVal($name,'INTERVAL', undef));
|
||||||
InternalTimer(gettimeofday()+ InternalVal($name,'INTERVAL', undef), "UpdateDueToTimer", $hash) if (defined $hash);
|
InternalTimer(gettimeofday()+ InternalVal($name,'INTERVAL', undef), "FHEM::EaseeWallbox::UpdateDueToTimer", $hash) if (defined $hash);
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -381,7 +381,7 @@ sub Set {
|
|||||||
$hash->{LOCAL} = 1;
|
$hash->{LOCAL} = 1;
|
||||||
RefreshData($hash);
|
RefreshData($hash);
|
||||||
delete $hash->{LOCAL};
|
delete $hash->{LOCAL};
|
||||||
InternalTimer(gettimeofday()+ InternalVal($name,'INTERVAL', undef), "UpdateDueToTimer", $hash);
|
InternalTimer(gettimeofday()+ InternalVal($name,'INTERVAL', undef), "FHEM::EaseeWallbox::UpdateDueToTimer", $hash);
|
||||||
readingsSingleUpdate($hash,'state','Started',0);
|
readingsSingleUpdate($hash,'state','Started',0);
|
||||||
Log3 $name, 1, sprintf("EaseeWallbox_Set %s: Updated readings and started timer to automatically update readings with interval %s", $name, InternalVal($name,'INTERVAL', undef));
|
Log3 $name, 1, sprintf("EaseeWallbox_Set %s: Updated readings and started timer to automatically update readings with interval %s", $name, InternalVal($name,'INTERVAL', undef));
|
||||||
}
|
}
|
||||||
@ -449,7 +449,7 @@ sub UpdateDueToTimer($) {
|
|||||||
RemoveInternalTimer($hash);
|
RemoveInternalTimer($hash);
|
||||||
#Log3 "Test", 1, Dumper($hash);
|
#Log3 "Test", 1, Dumper($hash);
|
||||||
InternalTimer(
|
InternalTimer(
|
||||||
gettimeofday() + InternalVal( $name, 'INTERVAL', undef ), "UpdateDueToTimer", $hash );
|
gettimeofday() + InternalVal( $name, 'INTERVAL', undef ), "FHEM::EaseeWallbox::UpdateDueToTimer", $hash );
|
||||||
}
|
}
|
||||||
RefreshData($hash);
|
RefreshData($hash);
|
||||||
}
|
}
|
||||||
@ -653,6 +653,7 @@ sub ResponseHandling {
|
|||||||
readingsBulkUpdate( $hash, "session_pricePerKWH", $d->{pricePrKwhIncludingVat} );
|
readingsBulkUpdate( $hash, "session_pricePerKWH", $d->{pricePrKwhIncludingVat} );
|
||||||
readingsBulkUpdate( $hash, "session_chargingCost", $d->{costIncludingVat} );
|
readingsBulkUpdate( $hash, "session_chargingCost", $d->{costIncludingVat} );
|
||||||
readingsBulkUpdate( $hash, "session_id", $d->{sessionId} );
|
readingsBulkUpdate( $hash, "session_id", $d->{sessionId} );
|
||||||
|
readingsBulkUpdate( $hash, "lastResponse", 'OK - getCurrentSession', 1);
|
||||||
readingsEndUpdate( $hash, 1 );
|
readingsEndUpdate( $hash, 1 );
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
@ -668,6 +669,7 @@ sub ResponseHandling {
|
|||||||
#readingsBulkUpdate( $hash, "site_ratedCurrent", $d->{ratedCurrent} );
|
#readingsBulkUpdate( $hash, "site_ratedCurrent", $d->{ratedCurrent} );
|
||||||
#readingsBulkUpdate( $hash, "site_createdOn", $d->{createdOn} );
|
#readingsBulkUpdate( $hash, "site_createdOn", $d->{createdOn} );
|
||||||
#readingsBulkUpdate( $hash, "site_updatedOn", $d->{updatedOn} );
|
#readingsBulkUpdate( $hash, "site_updatedOn", $d->{updatedOn} );
|
||||||
|
readingsBulkUpdate( $hash, "lastResponse", 'OK - getChargerSite', 1);
|
||||||
readingsEndUpdate( $hash, 1 );
|
readingsEndUpdate( $hash, 1 );
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
@ -693,6 +695,7 @@ sub ResponseHandling {
|
|||||||
readingsBulkUpdate( $hash, "wifi_rssi", $d->{wiFiRSSI} );
|
readingsBulkUpdate( $hash, "wifi_rssi", $d->{wiFiRSSI} );
|
||||||
readingsBulkUpdate( $hash, "wifi_apEnabled", $d->{wiFiAPEnabled} );
|
readingsBulkUpdate( $hash, "wifi_apEnabled", $d->{wiFiAPEnabled} );
|
||||||
readingsBulkUpdate( $hash, "cell_rssi", $d->{cellRSSI} );
|
readingsBulkUpdate( $hash, "cell_rssi", $d->{cellRSSI} );
|
||||||
|
readingsBulkUpdate( $hash, "lastResponse", 'OK - getChargerState', 1);
|
||||||
readingsEndUpdate( $hash, 1 );
|
readingsEndUpdate( $hash, 1 );
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user