i8beef / HomeAutio.Mqtt.GoogleHome

MIT License
215 stars 29 forks source link

How to map range [0,99] to [0,254] #112

Closed balthus closed 3 years ago

balthus commented 3 years ago

Hello, First of all, many thanks for sharing your code and also the useful doc. I could make some working POC in few hours (knowing nothing about google home/actions... I have few system running here (zigbee/zwave 2 mqtt) and with the zigbee, some lamps needs a brightness range from 0 to 254.

I don't know how/where to specify that the final value should be remapped to a different range. I'm currently using this: { "trait": "action.devices.traits.Brightness", "commands": { "action.devices.commands.BrightnessAbsolute": { "brightness": "zigbee2mqtt/living_room_ceiling_lights/brightness" } }, "state": { "brightness": { "topic": "zigbee2mqtt/living_room_ceiling_lights/brightness", "googleType": "numeric", "valueMap": [ { "mqtt": "254", "type": "value", "google": "99" }, { "mqtt": "0", "type": "value", "google": "0" } ] } } } I know that it's not correct and also I can set the absolute brightness from 0->98 and at 99 it's mapped to 254. Is this mapping currently supported? What/how to make it work? Sorry if it's not a bug, but I tried to look in the wiki/issue but didn't find so far any answer. Could be also helpful to add such example in the devices.json

Many Thanks,

Laurent

balthus commented 3 years ago

Sorry, duplicate of #113. Had some browser refresh issue ;(