I really haven't had any problems with the Home Assistant rainforest_eagle sensor calling uEagle.
Though today I was debugging an issue and found that I had to use tcpflow or wget to look into what is going on when the command is sent to the Eagle device during the hwtest() method in the Home Assistant rainforest_eagle sensor code.
When a command is sent to the Eagle and authentication fails it seems this line of code expects a JSON response but will fail as the Eagle will instead return HTML data instead
|
data = json.loads(response_text) |
I don't know in other reproducible cases where the Eagle will return HTML data rather than JSON but authentication failure is one.
For example when running get_network_info() with correct credentials this is the response I get:
{
"Response": {
"Text": "Command processed",
"MainTag": "Command",
"Command": "get_network_info"
}
}
But when the credentials are incorrect this is the response I get back.
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>401 - Unauthorized</title>
</head>
<body>
<h1>401 - Unauthorized</h1>
</body>
</html>
I captured the responses using tcpflow
When the authentication failure occurs the only message that is returned back to Home Assistant is:
Expecting value: line 1 column 1 (char 0)
I wouldn't want the complete raw response to be returned to Home Assistant but given I don't know of other scenarios where this kind of failure can occur probably need some generic error with the response from the Eagle to be returned to Home Assistant?
I really haven't had any problems with the Home Assistant rainforest_eagle sensor calling uEagle.
Though today I was debugging an issue and found that I had to use
tcpfloworwgetto look into what is going on when the command is sent to the Eagle device during thehwtest()method in the Home Assistant rainforest_eagle sensor code.When a command is sent to the Eagle and authentication fails it seems this line of code expects a JSON response but will fail as the Eagle will instead return HTML data instead
uEagle/uEagle/uEagle.py
Line 65 in 02bac5d
I don't know in other reproducible cases where the Eagle will return HTML data rather than JSON but authentication failure is one.
For example when running
get_network_info()with correct credentials this is the response I get:But when the credentials are incorrect this is the response I get back.
I captured the responses using
tcpflowWhen the authentication failure occurs the only message that is returned back to Home Assistant is:
Expecting value: line 1 column 1 (char 0)I wouldn't want the complete raw response to be returned to Home Assistant but given I don't know of other scenarios where this kind of failure can occur probably need some generic error with the response from the Eagle to be returned to Home Assistant?