Google Assistant sensor state not being mapped

I’ve connected my OpenHAB instance to Google Assistant. For starting out adding my different items, I’ve started with my smoke detectors and water leak detectors. The item shows up in Google Assistant, but the state mapping is not working – it simply shows the numeric value.

The water leak sensor already reports numeric values, such as “16” meaning “Warning/Leak detected”, so I figured I could simply utilize this. On the “Number” item I’ve added the following Google Assistant configuration:

value: Sensor
config:
  name: Fjernvarme Vandalarm
  sensorName: WaterLeak
  states: unknown=0,no leak=4,leak=16
  roomHint: Bryggers

According to the GA documentation it should support the 3 states configured above. According to the OpenHAB documentation that is how I should map the states. I would have expected Google Home to show the sensor as “No leak” when the value of the item is 4 and “Leak” when the item value is 16. Instead the sensor in the Google Home app simply shows the numeric value instead of the state.

What am I missing here?

I am not sure you can add states using the GUI

Check the states are supported by google Cloud-to-cloud  |  Google Home

Maybe try and set an item up using a txt file

Hi James

The GUI certainly makes it look as if you can (marked with yellow):

Interestingly enough, if I use the states of a smoke detector, the Google app shows “not registered” instead of the numeric value, even though the sensor name is configured as “WaterLeak”.

I can live with this, but I will leave my post here for further comments from developers of the integration or for anyone else having the same issue.