Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

question for temperatur, decimal separator problem in german #41

Closed
mgeramb opened this issue Aug 5, 2017 · 10 comments
Closed

question for temperatur, decimal separator problem in german #41

mgeramb opened this issue Aug 5, 2017 · 10 comments

Comments

@mgeramb
Copy link
Member

mgeramb commented Aug 5, 2017

Hi,
If I ask alexa for a temperatur, I got the answer "23.5 Grad" (Which sounds '25er 5 Grad'), but it should be in German "23,5 Grad". So I think there is a problem with the decimal separator which should in german ',' instead of '.'

Is this a bug in the alexa software or is there a possibility in the skill to handle this?

Anyway, your skill is very useful! Thanks!
Kind regards,
Michael

@3DJupp
Copy link

3DJupp commented Aug 6, 2017

I also hear Twentythird degree four instead of twentythree dot four degrees (in German dreiundzwanzigster vier Grad)
This might be an issue caused by Alexa itself.
But maybe it is a thing caused by the decimal point. In software it's often a dot, but in German language it's a comma. Maybe Alexa / Amazon could not parse the dot correctly.
Even temperatures work great.

@mgeramb
Copy link
Member Author

mgeramb commented Aug 6, 2017

I looked now in the source and I see that the number transferred to the alexa api, not a string, so it must be a bug in Alexa software itself.
And I found this hint in the development documentation:

GetTemperatureReadingRequest

Example Utterances: “Alexa, what is the temperature of device name?”
Purpose: Requests the temperature reading of the specified device. Sent from the Smart Home Skill API to the skill adapter. Currently supported in the US and UK.

Maybe because amazon know, that is not correct...

But maybe it is possible to round the number, so that there are no decimal places, at least if the language setting is german. In my opinion the decimal places are not so important for the temperature.

Kind regards,
Michael

@digitaldan
Copy link
Collaborator

digitaldan commented Aug 6, 2017

Hi, so I think I'm hearing the issue is that alexa is not pronouncing the temperature request correctly in German with regards to the decimal?

For Celsius values we simply pass whatever value comes from OH to Alexa. Do you know if your OH instance is reporting something that might be giving it issues? Like maybe more than one decimal place ( eg 23.55 ) ? It sounds like an issue on Amazon's side, but I wonder if there is a way to avoid it without rounding the number up or down to a whole.

The expected return value is a Float type, so amazon does expect a number with at least one decimal place.

According to the smarthome docs this should be supported in German
https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/smart-home-skill-api-reference#temperature-control-and-query-messages

GetTemperatureReadingRequest *US and UK
GetTemperatureReadingResponse *US and UK
GetTargetTemperatureRequest *US and UK
GetTargetTemperatureResponse *US and UK
SetTargetTemperatureRequest
SetTargetTemperatureConfirmation
IncrementTargetTemperatureRequest
IncrementTargetTemperatureConfirmation
DecrementTargetTemperatureRequest
DecrementTargetTemperatureConfirmation

*** EDIT ***
I should learn to read my own post better, it says UK and US, not German!!! Hmm, odd that it's even working in German, we may need to wait until it's officially supported.

@mgeramb
Copy link
Member Author

mgeramb commented Aug 7, 2017

Hi, so I think I'm hearing the issue is that alexa is not pronouncing the temperature request correctly in German with regards to the decimal?
Yes, exactly

but I wonder if there is a way to avoid it without rounding the number up or down to a whole.
I aggree with you, I had take a look in your code, the only way seems to be to round the value for german usage - I hope you have the Information in the skill available that german is selected. I have tested the rounding approach already by using a OH rule which rounds the value to a virtual item which receives a rounded value with no decimal places, for this the pronouncing is correct.

@digitaldan
Copy link
Collaborator

We do support specifically German in the app meta information , but this is not something in code, but rather how its deployed and distributed. There is not language specifics in the smart home skill api. I don't think rounding C values is the right answer here, that would affect our UK and other Celsius users. Since German is not suppose to work in this case (not sure how it is), we may need to wait for them to support it properly.

@patristein
Copy link

Hi,
same problem for me.

I think this is based on wrong format of given value.
Have you tried to transform "23.53" to "23,53"?
Should be possible in rules file but sadly I am not familiar with the syntax.

Could you please give me a hint on how to transform the value?
In my case a value of "23.40000000002" is given so I need to round/cut for two digits after delimiter and set delimiter from dot to comma.

Regards
Patrick

@mgeramb
Copy link
Member Author

mgeramb commented Sep 24, 2017

Hi Patrick,
Transformation will not work, I took a look in the alexa skill API and it takes the number itself, not the formatted value. So the wrong transformation to the string is done in the alexa software itself and can only be changed by amazon.
For myself, I have created a additional number item with no channel binding which will be written by a rule which rounds the number to zero decimal places.

Items (The first one is the sensor itself, the second the rounded which is provided to alexa):

Number Garten_Temperatur
        "Garten[%.1f°C]"
        <temperature>
         { channel="zwave:device:cf867d08:node29:sensor_temperature" }
       
Number Garten_Temperatur_Round
        "Garten[%.0f°C]"
        <temperature>
        [ "CurrentTemperature" ]

Rule:

rule "Calculate Garten_Temperatur_Round"
	when 
		System started or
		Item Garten_Temperatur changed
	then
		postUpdate(Garten_Temperatur_Round, Math::round((Garten_Temperatur.state as DecimalType).floatValue()))	
	end

Regards,
Michael

@patristein
Copy link

Hi Michael,

thanks for clarification and code snippets.
I'll try to get your solution running ;)

Regards

@3DJupp
Copy link

3DJupp commented Nov 11, 2017

Seems to be solved now.
Amazon updated the speech engine and german grammar is now correct.
"Es ist neunzehn komma drei Grad"

@mgeramb
Copy link
Member Author

mgeramb commented Nov 12, 2017

Yes! I can confirm it, it works now! Thank you Dom1n1c for your hint!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants