Code Monkey home page Code Monkey logo

Comments (5)

jens-maus avatar jens-maus commented on August 18, 2024

Now call SysVar.setEnum with {name: "Test", valueList: "Bar"}. The result will return some invalid JSON (#113), but will "Bar" is successfully selected.

Please show the actual payload you are sending and the concrete example response which you feel is invalid JSON. And please state if you have tested this also already with RaspberryMatic.

from occu.

pmdevelopment avatar pmdevelopment commented on August 18, 2024

Sure, payload for SysVar.createEnum:

"{"name":"Test","valList":"Foo;Bar;Other","internal":"0","chnID":"-1"}

Response is successful:

{"version": "1.1","result": {'name':'Test','id':'6968','value':'Foo;Bar;Other' },"error": null}

Payload for SysVar.setEnum:

{"name":"Test","valueList":"Bar"}

Response is successful but invalid syntax (#113 is discussing this issue and has a fix, i just mentioned it):

{"version": "1.1","result": Bar,"error": null} 

Next Payload for SysVar.getValueByName:

{"name":"Test"}

Response is successful but looks wrong to me:

{"version": "1.1","result": "0","error": null}

"0" is not the right value, as we just set it to "Bar".

SysVar.getAll will now list valueList: "Bar" for this variable.

It's not tested with RasperryMatic, i will try it tomorrow.

Am i using the whole ENUM type wrong? My expectation was to define a list (valueList) of allowed values and to select one of these as current value. The documentation for SysVar.setEnum describes the method to "set the value", but expects "valueList" as parameter, maybe it's not a bug but a missunderstanding.

Here some example for a boolean variable:

{
  "id": "950",
  "name": "${sysVarPresence}",
  "type": "LOGIC",
  "unit": "",
  "value": "true",
  "channelId": "65535",
  "valueName0": "${sysVarPresenceNotPresent}",
  "valueName1": "${sysVarPresencePresent}",
  "isLogged": false,
  "isVisible": true,
  "isInternal": false
}

The value is as expected and can be seen in the WebUI.

My new conclusion is: SysVar.setEnum is just doing the absolute wrong thing. It should expect the value parameter as zero-based index integer and update the variable. Instead it only will update the valueList, so there is no way to set a value using JSON API.

from occu.

jens-maus avatar jens-maus commented on August 18, 2024

Am i using the whole ENUM type wrong? My expectation was to define a list (valueList) of allowed values and to select one of these as current value. The documentation for SysVar.setEnum describes the method to "set the value", but expects "valueList" as parameter, maybe it's not a bug but a missunderstanding.

Yes, you are IMHO expecting SysVar.setEnum to do something different. setEnum ist doing the exact same thing like creating a new valuelist variable. That means you use this function to actually set/change the value list and not the value of the sysvar itself. That's exactly why you supply a valueList and not just a value.

from occu.

jens-maus avatar jens-maus commented on August 18, 2024

Next Payload for SysVar.getValueByName:

{"name":"Test"}

Response is successful but looks wrong to me:

{"version": "1.1","result": "0","error": null}

"0" is not the right value, as we just set it to "Bar".

"0" is a perfectly fine result here. You misunderstanding is, that you expect the actual value to be returned by SysVar.getValueByName for a valueList SysVar. But this is not the case. This method will return the actual index of the valueList as a value. Thus, the only "wrong" or incorrect thing in this issue ticket is the incorrect syntax of the SysVar.setEnum response json, which I will fix in the course of the RaspberryMatic development. This respository here is anyway the wrong one since no eq3 employee will take it and fix it. The right way is to post such things in the RaspberryMatic github and then a fix might flow back to the original CCU3 firmware one day...

from occu.

pmdevelopment avatar pmdevelopment commented on August 18, 2024

I got caught by the comment in the method, "Setzt den Wert einer Systemvariable", i was wondering why it asks for valueList but it was to logical for me, that this method should set the value 😄. At least setFloat and setBool are actual setting the value as expected, i will switch over to use some integer values to trigger my events.

from occu.

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.