Closed moznion closed 6 years ago
Thanks for working on this! I'm not sure if it is worth all the effort when the actual implementation error is at the side of the gateway vendor (empty string instead of null). If you do a:
func (t *CompactTime) UnmarshalJSON(data []byte) error {
if string(data) == `""` {
return nil
}
...
It would at least solve the error (resulting probably in a 0001-01-01 ... timestamp), without the need to add extra complexity :-) Note that such timestamp does not break any functionality.
It might also be worth to contact Gemtek about this, hopefully they can fix this at their side too :-)
Thank you for your response and suggestions!
This commit (fa83519fdb249e22c83f50909e37ab67185fc7e4) fixes simpler, is this correct? Are following changes not necessary?
Some vendor's (e.g. gemtek) gateway sends an empty string value as
time
property of Rx packet (an empty string means "ignore me", this is terrible...) In the current implementation, the gateway-bridge raises errors at here when an emptytime
has come so it cannot receive any packets iftime
is an empty string.This pull-request cares this problem.