1
0
mirror of https://github.com/beestat/app.git synced 2025-06-04 14:17:37 -04:00

Fixing sensors failing to sync if identifiers are in a different format

This commit is contained in:
Jon Ziebell 2020-01-15 08:17:04 -05:00
parent 2e982faba1
commit 1250f63875

View File

@ -590,6 +590,21 @@ class runtime extends cora\api {
$sensor_identifier = substr($key, 0, strrpos($key, ':'));
$capability_identifier = substr($key, strrpos($key, ':') + 1);
/**
* Most of the time the pattern is that a sensor will have an
* identifier in the format XX:YY. Then the runtime report will
* return data keyed by XX:YY:ZZ, where ZZ is the capability_id as
* defined in sensor.capabilities.
*
* Some sensors have an identifier in the format XX:YY:ZZ, with a
* single entry in the capabilities array with no id. This makes
* little sense, but whatever. In these cases ecobee keys data by
* XX:YY:ZZ in the runtime report. This is a different pattern which
* has to be accounted for.
*
* For now I am simply ignoring this situation.
*/
if (isset($sensors_by_identifier[$sensor_identifier]) === true) {
$sensor = $sensors_by_identifier[$sensor_identifier];
$sensor_id = $sensors_by_identifier[$sensor_identifier]['sensor_id'];
@ -626,6 +641,7 @@ class runtime extends cora\api {
}
}
}
}
/**
* Get the ecobee "interval" value from a timestamp.