kopia lustrzana https://github.com/weetmuts/wmbusmeters
Adjust alarm type.
rodzic
5038753906
commit
0843b19379
|
@ -3439,7 +3439,7 @@ void WMBusCommonImplementation::checkStatus()
|
|||
}
|
||||
|
||||
strprintf(msg, "Failed to reset wmbus device %s %s! Emergency exit!", toString(type()), device().c_str());
|
||||
logAlarm("PROTOCOL_ERROR", msg);
|
||||
logAlarm("WMBUS_DEVICE_ERROR", msg);
|
||||
manager_->stop();
|
||||
return;
|
||||
}
|
||||
|
@ -3454,7 +3454,8 @@ void WMBusCommonImplementation::checkStatus()
|
|||
}
|
||||
|
||||
// The timeout has expired! But is the timeout expected because there should be no activity now?
|
||||
// Also, do not alarm unless we actually have a possible timeout within the expected activity.
|
||||
// Also, do not sound the alarm unless we actually have a possible timeout within the expected activity,
|
||||
// otherwise we will always get an alarm when we enter the expected activity period.
|
||||
if (isInsideTimePeriod(now, expected_activity_) &&
|
||||
isInsideTimePeriod(then, expected_activity_))
|
||||
{
|
||||
|
@ -3471,7 +3472,7 @@ void WMBusCommonImplementation::checkStatus()
|
|||
timeout_, now.c_str(), expected_activity_.c_str(),
|
||||
since, toString(type()), device().c_str());
|
||||
|
||||
logAlarm("PROTOCOL_ERROR", msg);
|
||||
logAlarm("TIMEOUT_ERROR", msg);
|
||||
|
||||
bool ok = reset();
|
||||
if (ok)
|
||||
|
@ -3481,7 +3482,7 @@ void WMBusCommonImplementation::checkStatus()
|
|||
else
|
||||
{
|
||||
strprintf(msg, "Failed to reset wmbus device %s %s! Emergency exit!", toString(type()), device().c_str());
|
||||
logAlarm("TIMEOUT_ERROR", msg);
|
||||
logAlarm("WMBUS_DEVICE_ERROR", msg);
|
||||
manager_->stop();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ format=json
|
|||
shell=echo METER =="$METER_JSON"== >> /tmp/wmbusmeters_telegram_test
|
||||
# Add alarm for the wmbus dongle, it might need re-initilization.
|
||||
# The alarm will always be logged in the log file.
|
||||
alarmshell=echo "ALARM_SHELL $ALARM_TYPE $ALARM_MESSAGE" >> /tmp/wmbusmeters_alarm_test
|
||||
alarmshell=echo ALARM_SHELL "$ALARM_TYPE" "$ALARM_MESSAGE" >> /tmp/wmbusmeters_alarm_test
|
||||
# Expect a received telegram no longer than 1 second since the last telegram!
|
||||
alarmtimeout=1s
|
||||
# Only sound the alarm if the timeout is reached when the radio is actually
|
||||
|
|
|
@ -15,7 +15,7 @@ echo "RUNNING $TESTNAME ..."
|
|||
$PROG --useconfig=tests/config7 --device=simulations/simulation_alarm.txt | sed 's/....-..-.. ..:../1111-11-11 11:11/' > $TEST/test_output.txt
|
||||
|
||||
cat > $TEST/test_expected.txt <<EOF
|
||||
(alarm) PROTOCOL_ERROR Hit timeout(1 s) and 1111-11-11 11:11 is within expected activity (mon-sun(00-23))! Now 2 seconds since last telegram was received! Resetting device DEVICE_SIMULATOR simulations/simulation_alarm.txt!
|
||||
(alarm) TIMEOUT_ERROR Hit timeout(1 s) and 1111-11-11 11:11 is within expected activity (mon-sun(00-23))! Now 2 seconds since last telegram was received! Resetting device DEVICE_SIMULATOR simulations/simulation_alarm.txt!
|
||||
(wmbus) successfully reset wmbus device
|
||||
EOF
|
||||
|
||||
|
@ -25,7 +25,7 @@ METER =={"media":"cold water","meter":"multical21","name":"Water","id":"76348799
|
|||
EOF
|
||||
|
||||
cat > /tmp/wmbusmeters_alarm_expected <<EOF
|
||||
ALARM_SHELL PROTOCOL_ERROR Hit timeout(1 s) and 1111-11-11 11:11 is within expected activity (mon-sun(00-23))! Now 2 seconds since last telegram was received! Resetting device DEVICE_SIMULATOR simulations/simulation_alarm.txt!
|
||||
ALARM_SHELL TIMEOUT_ERROR Hit timeout(1 s) and 1111-11-11 11:11 is within expected activity (mon-sun(00-23))! Now 2 seconds since last telegram was received! Resetting device DEVICE_SIMULATOR simulations/simulation_alarm.txt!
|
||||
EOF
|
||||
|
||||
REST=$(diff $TEST/test_output.txt $TEST/test_expected.txt)
|
||||
|
|
Ładowanie…
Reference in New Issue