mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-31 15:12:06 +00:00 
			
		
		
		
	ccs811: Skip reading data if it is not available (#2404)
On bootup the ccs811 reports that no data is available. No error flag is set in that case. The current implementation ignores this, reads and publishes the invalid data, which is 0xFDFD for both tvoc and co2 in my case. This commit fixes this and does not read and publish invalid data.
This commit is contained in:
		
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							45940b0514
						
					
				
				
					commit
					b2d516c70a
				
			| @@ -86,8 +86,11 @@ void CCS811Component::setup() { | |||||||
|   } |   } | ||||||
| } | } | ||||||
| void CCS811Component::update() { | void CCS811Component::update() { | ||||||
|   if (!this->status_has_data_()) |   if (!this->status_has_data_()) { | ||||||
|  |     ESP_LOGD(TAG, "Status indicates no data ready!"); | ||||||
|     this->status_set_warning(); |     this->status_set_warning(); | ||||||
|  |     return; | ||||||
|  |   } | ||||||
|  |  | ||||||
|   // page 12 - alg result data |   // page 12 - alg result data | ||||||
|   auto alg_data = this->read_bytes<4>(0x02); |   auto alg_data = this->read_bytes<4>(0x02); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user