Can 'Parse' command be implemented for Hub Var Connectors?

A hub variable connector is essentially a virtual device, so the information you found in the docs that refers to mostly Z-Wave and Zigbee devices is not applicable, but the note about virtual devices is. In these cases, it is up to the driver if or how it uses this command. It is generally not meant to be called directly. The fact that it happens to set your variable false is likely just an unintended side effect of calling it with invalid data (likely no data, as you'd get when trying it from the UI, as you appear to be).

I'm not sure I understand your use case:

  • You have a switch connector created, so the underlying variable is probably a boolean
  • The only valid values for a boolean are true or false (seems like you want to do something with "cat"?)
  • The on() and off() commands provided by the connector are the ways you set the underlying variable true or false, so, given the above, there should not be a need for parse() for (and similar with other connectors -- the entire point of making one is to get "standard" commands so apps can use those if they don't support variables directly)

If you need an HTTP endpoint to change a variable, Maker API can't do that directly (by which I mean using the variable directly without a connector; using a connector is still an option, but you'll need to use the regular device commands as above). Maybe that is something that could be added. However, Rule Machine can. You just need to create a rule with a local or cloud endpoint trigger (whatever you need, or both), then see the "Set Hub Variable" section here for the path and format to use to set variables via an endpoint:

(Note that you actually don't need to do anything in that rule; you just need to create a trigger so you get the endpoint, exposing the API over HTTP. But I suppose that creating a rule triggered by an endpoint where you actually do things in the actions in response is also an option, and one of those things could be setting a variable, perhaps different things depending on some conditional actions.)

1 Like