i8beef / HomeAutio.Mqtt.GoogleHome

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Announce: 1.2.0 changes

i8beef opened this issue · comments

Note that 1.2.0 will be released imminently. There is a breaking change that will require changes to your googleDevices.json file for any existing valueMaps.

Originally, valueMap's that took a google value would take any type. This pattern no longer is universal, and we already had to do a final cast to the googleType anyway before sending to Google, so to allow for more powerful valueMap transforms like RegEx, we have to treat all values as strings up until the final cast.

As such, in any value maps with non-string google values, they must be changed over to strings. Example:

            "valueMap": [
              {
                "mqtt": "on",
                "type": "value",
                "google": true
              },
              {
                "mqtt": "off",
                "type": "value",
                "google": false
              },
              {
                "mqtt": "0",
                "type": "value",
                "google": false
              },
              {
                "mqttMin": 1.0,
                "mqttMax": 100.0,
                "type": "range",
                "google": true
              }
            ]

Should become

            "valueMap": [
              {
                "mqtt": "on",
                "type": "value",
                "google": "true"
              },
              {
                "mqtt": "off",
                "type": "value",
                "google": "false"
              },
              {
                "mqtt": "0",
                "type": "value",
                "google": "false"
              },
              {
                "mqttMin": 1.0,
                "mqttMax": 100.0,
                "type": "range",
                "google": "true"
              }
            ]

Upon upgrading, you'll want to make this change before starting up again, or its just going to crash until its corrected.

This also fixes a bug where the wrong type COULD have been emitted to Google if a valueMap wasn't type aware. This removes that necessity, as the cast is moved to the end, and the valueMap can expect a known type contract to do its work instead.