Coder Social home page Coder Social logo

Comments (4)

toggledbits avatar toggledbits commented on September 23, 2024

OK. I see that set_service_value() is actually an action call that accepts a single parameter, and can only execute actions the name of which begins with the string "Set". That's... interesting. It still doesn't address other actions, or multiple parameters.

from pyvera.

pavoni avatar pavoni commented on September 23, 2024

call_service gives access to the full api where needed set_service_value is largely there because most of the devices only needed this reduced functionality, so when the call_service call was added we retained this for DRY reasons.

Open to a PR if you feel something more functional than set_service_value but less rich than call_service is required.

Closing this for now.

from pyvera.

toggledbits avatar toggledbits commented on September 23, 2024

call_service gives access to the full api

OK. What am I missing? Let me give an example:

The RunLua action in urn:micasaverde-com:serviceId:HomeAutomationGateway1 accepts (requires) a single parameter, Code, which contains the Lua fragment to run.

It is not possible to use set_service_value() to run this action because the name of the action does not begin with "Set", which is hard-coded in that function (i.e. the function would make a Luup request for to run the SetRunLua action, which does not exist).

The call_service() function does not accept parameters, so you can try to invoke the RunLua request using it, but you cannot pass the required Code parameter that contains the Lua code to be run, because the function does not accept (and therefore does not append to the request) parameters for the action.

Not all actions are related to state variables. Not all actions that take parameters are named "Set" plus the parameter/state variable name. Not all actions take zero or 1 parameters. These are all assumptions and limitations of these two calls as currently written.

I'll open a PR.

from pyvera.

pavoni avatar pavoni commented on September 23, 2024

My note should have referred to vera_request rather than call_service, apologies.

Generally I think it's good practice to add parameters as they are needed, so no problem adding an extra parameter if you need it for something.

from pyvera.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.