|
@ -396,6 +396,12 @@ void _sensorInit() { |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void _sensorCallback(unsigned char i, unsigned char type, const char * payload) { |
|
|
|
|
|
|
|
|
|
|
|
DEBUG_MSG_P(PSTR("[SENSOR] Sensor #%u callback, type %u, payload: '%s'\n"), i, type, payload); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
void _sensorConfigure() { |
|
|
void _sensorConfigure() { |
|
|
|
|
|
|
|
|
for (unsigned char i=0; i<_sensors.size(); i++) { |
|
|
for (unsigned char i=0; i<_sensors.size(); i++) { |
|
@ -430,6 +436,11 @@ void _sensorConfigure() { |
|
|
// Force sensor to reload config
|
|
|
// Force sensor to reload config
|
|
|
_sensors[i]->begin(); |
|
|
_sensors[i]->begin(); |
|
|
|
|
|
|
|
|
|
|
|
// Hook callback
|
|
|
|
|
|
_sensors[i]->onEvent([i](unsigned char type, const char * payload) { |
|
|
|
|
|
_sensorCallback(i, type, payload); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
#if HLW8012_SUPPORT
|
|
|
#if HLW8012_SUPPORT
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|