Skip to content

Commit

Permalink
Update documentation and add better debug logging
Browse files Browse the repository at this point in the history
  • Loading branch information
ptorsten committed Jan 21, 2024
1 parent 5d3242f commit 53468dc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@ The system supports sensor config per gateway by configurating a sensor json per

#### Sensor Configuration

Easist way to configure sensors is to check the logs for:

```[2024-01-18 07:11:04.210136 +00:00] DEBUG [src/main.rs:289] Failed to find sensor config for 098cce4ea80c3f:light - value <value>```

Easist way to understand more about the sensors is to use the web interface for the gateway or read the specification at https://osswww.ecowitt.net/uploads/20210716/WN1900%20GW1000,1100%20WH2680,2650%20telenet%20v1.6.0%20.pdf

My current config:

```{
"outdoor_temp": {"class": "temperature", "unit": "°C", "value_template": "{{ value_json.outdoor_temp }}" },
"indoor_temp": {"class": "temperature", "unit": "°C", "value_template": "{{ value_json.indoor_temp }}" },
Expand Down
3 changes: 1 addition & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ struct Gateways {
_mqtt: Arc<Mutex<Client>>,
}


impl Gateway {
fn new(ip : String, sensor_config: HashMap<String, SensorConfig>, mqtt: Arc<Mutex<Client>>) -> Self {
let gateway = SensorGateway::new(ip, 45000);
Expand Down Expand Up @@ -284,7 +283,7 @@ impl Gateway {

let config_opt = config_lock.get_mut(sensor.name());
if config_opt.is_none() {
log::debug!("Failed to find sensor config for {}:{}", self.gateway().name(), sensor.name());
log::debug!("Failed to find sensor config for {}:{} - value {:?}", self.gateway().name(), sensor.name(), sensor.value());
// only send data for sensors in the sensor config
continue;
}
Expand Down

0 comments on commit 53468dc

Please sign in to comment.