Number Ranges non-intenger (Homematic thermostat 21.5°C)

Background: I want to control my Homematic thermostat via rhasspy. It has a range of 4.5-30 °C (so e.g 21.5 °C is possible).

Is there a way to cover that in a range?
Something like:

heater_temperature = (4.5..30,0.5) {state}

According to the docs (https://rhasspy.readthedocs.io/en/latest/training/#number-ranges) it seems the range can only cover integers.

Another idea was to separate it like:

heater_temperature = ((5..30)[komma:.(5)]) {state}

but the result has spaces included: 21 . 5
Any idea about that?

Worst case is I split it in two vars:

heater_temperature = (4..30) {state}
heater_temperature_komma = (5) {state_comma}
stelle die heizung (in (der | dem) | bei) <heater_name> auf <heater_temperature> [komma <heater_temperature_komma>] grad

But that doesnt look good :smiley:

Would be very nice to know how you guys solved that.

What is the exacr question?
Is it because you want to set the point temperature?
Well, isnt it enough to use the integer values?
If it is because the .5 step between the integers?
Like, set the temperature in the living room to 21 and a half degree celcius?
That should be feasable.
Here is an example about a timer, I think it could fit your needs:
[timer]
minutes = (1){min} minute | (2…59){min} minute
seconds = (1){sec} sekunde | (2…59){sec} sekunden
hours = (1){hours} stunde | (2…24){hours} stunden
setze{state} die (zeituhr | eieruhr | wecker){objectName} auf minutes
setze{state} die (zeituhr | eieruhr | wecker){objectName} auf seconds
setze{state} die (zeituhr | eieruhr | wecker){objectName} auf hours
setze{state} die (zeituhr | eieruhr | wecker){objectName} auf minutes und seconds
setze{state} die (zeituhr | eieruhr | wecker){objectName} auf hours und minutes und seconds
setze{state} die (zeituhr | eieruhr | wecker){objectName} auf minutes (einhalb){sec:30!int} minuten

Do not forget to putt the slots (minutes seconds hours into brackets ) I dont know how to enter these characters

The point is: I would like to use only one variable to cover 4.5-30 (including 0.5 steps). The question is, is the syntax in the .ini file able to do that?

Your suggestions is my “worst case” from my initial post… so splitting it into two variables.

I put the vars together via JScript. I use Iobroker for that.

Okay thanks. In Openhab I also solved as a kind of workaround with DSL Rules.

But if someone has a better syntax in the .ini file directly. Feel free to post it =)

Okay, here is the answer:

all in all:
create a custom converter:
sudo mkdir ~/.config/rhasspy/profiles/de/converters
sudo vi ~/.config/rhasspy/profiles/de/converters/kommafuenf

#!/usr/bin/env python3
import sys
import json

# [22, ".", 5]
args = json.load(sys.stdin)

# 22.5
num = "".join(str(s).strip() for s in args)

print(num)

sudo chmod +x ~/.config/rhasspy/profiles/de/converters/kommafuenf

use converter in setences.ini (4.5-30 including 0.5 steps):

heater_temperature = (4..30 [komma:. 5]) {state!kommafuenf}

Don’t forget to:

  • “Restart” Rhasspy
  • “Save Sentences”
1 Like