coldfire84 / node-red-alexa-home-skill-v3-web

Web Service/ API for Alexa and Google Home Node-RED Smart Home Control
https://red.cb-net.co.uk/
Apache License 2.0
51 stars 7 forks source link

Fahrenheit scale option not retained in temperature sensor device #121

Closed madpsintst closed 4 years ago

madpsintst commented 4 years ago

The Fahrenheit scale option value is not retained in temperature sensor devices. Attempts to have Alexa interact with temperature sensor devices that use the Fahrenheit scale produce "Doesn't support that" response from Alexa.

To reproduce:

  1. Add a device by clicking the 'Add Device' button at https://red.cb-net.co.uk/devices
  2. Give the new device a name and description; select the 'Temperature Sensor' checkbox and choose Scale Option '°Farenheit' [note: spelling should be corrected to '°Fahrenheit']; click Save
  3. Click the 'Edit' button next to the newly-created device. The Fahrenheit setting is missing.

Temporary workaround: use Celsius

coldfire84 commented 4 years ago

Have made initial minor changes to save correct value to device attributes/ update user interface - let me know if that sorts it.

madpsintst commented 4 years ago

The temperature scale setting is now being saved at https://red.cb-net.co.uk/devices; however, Alexa is converting the temperature back to Celsius before reading it back. For example, my pool is currently 85 degree Fahrenheit. When I ask Alexa to read the temperature, she says "The pool water is 29.4 degrees".

coldfire84 commented 4 years ago

Can you confirm that the Amazon Echo device itself is set to use Fahrenheit: https://alexafaq.com/guide-how-to-change-temperature-units-to-fahrenheit-or-celsius/

Have reviewed the code and confirmed that ( with the correct spelling :/ ) the state will be sent back with the stored scale value, so this should now work. If you still have issues it may be worth deleting the existing device and creating a new one (with the same name, if so desired).

"namespace": "Alexa.TemperatureSensor",
"name": "temperature",
"value": {
    "value": deviceJSON.state.temperature,
    "scale": deviceJSON.attributes.temperatureScale.toUpperCase()
    },
"timeOfSample": deviceJSON.state.time,
"uncertaintyInMilliseconds": 1000
madpsintst commented 4 years ago

Ah yes...the echo device was set to Celsius, hence the conversion. All is working well now. Many thanks!