private void SetFlushCountInIoBroker() { var tempCountId = "javascript.0.toilet.flushes.count"; var tempCount = _ioBroker.GetStateAsync <int>(tempCountId, TimeSpan.FromSeconds(5)).Result; _ioBroker.SetStateAsync <int>(tempCountId, ++tempCount); var totalCountId = "javascript.0.toilet.flushes.totalcount"; var totalCount = _ioBroker.GetStateAsync <int>(totalCountId, TimeSpan.FromSeconds(5)).Result; _ioBroker.SetStateAsync <int>(totalCountId, ++totalCount); }
private async Task AddOneShotAsync(string ioBrokerId) { var result = await _ioBroker.GetStateAsync <int>(ioBrokerId, TimeSpan.FromSeconds(5)); if (result.Success) { var newCurrentShotsCount = result.Value + 1; await _ioBroker.SetStateAsync(ioBrokerId, newCurrentShotsCount); } }