Ambient Weather - Incorrect assignment of temperature data from extra modules to outdoor temperature #22
Labels
[Feature] Extensibility and APIs
All things related to new APIS, devices ...
first time contributor
Issue or PR opened by a first-time contributor to the repository
[Needs] Dev
[Type] Bug
Something isn't working
Milestone
Hello there,
Congratulations on taking over the project. I really appreciate the ability to display my weather station's data on my website. I was pleased to discover that you are on GitHub, providing a platform for users to contribute and report bugs. I'm in Information Security as one of my Jobs so I hope this is complete and helps identify the issues.
Description:
I've noticed an issue in the file includes/traits/AmbientPluginBaseClient.php. The temperature data from extra modules ('temp' . $i . 'f') is being assigned to the 'temperature' key in the $device array. This seems to be overwriting the outdoor temperature data, resulting in the temperature from extra modules being displayed as the outdoor temperature.
I am using the Ambient Weather Station model WS-5000. However, based on a brief review of the API documentation from Ambient Weather, it appears that the API output might not be dependent on the model. Ambient Weather seems to have standardized the outputs and simply omits data if it doesn't exist for a particular model. I've only had this weather station for a few weeks.
Steps to reproduce:
Expected behavior:
The outdoor temperature and the temperatures from extra modules should be stored and displayed separately.
Actual behavior:
The temperature from extra modules is being displayed as the outdoor temperature.
Debug logs:
Here are the debug logs showing the API output with the correct values:
In the above output,
[tempf] => 68
is the correct outdoor temperature. However,[temp8f] => 100.9
is actually an additional module which is a Pool/Hot Tub Sensor with temperature only. The issue is that the temperature from this additional module is being displayed as the outdoor temperature.Suggested fix:
Consider storing the temperature and humidity data from extra modules in separate keys in the
$device
array to avoid overwriting the outdoor temperature and humidity data. For example:This would need to be done in the following section of code:
Please note that other parts of the codebase that interact with the
$device
array might need to be updated to handle these new keys.Full w/o commentary Debug logs:
Here are the debug logs showing the API output with the correct values:
The text was updated successfully, but these errors were encountered: