Can't change digital input state



  • Trying to change digital input couter mode either to enabled or disabled returns success, but counter mode is not changed.

    Invoke-RestMethod -Method POST -Uri http://10.3.2.65:8080/json/di/1_01 -ContentType application/json -Body '{"counter_mode":"disabled"}'
    

    Success response:

    {"status": "success", "data": {"counter_modes": ["Enabled", "Disabled"], "glob_dev_id": 1, "modes": ["Simple", "DirectSwitch"], "value": 0, "circuit": "1_01", "debounce": 754, "counter": 48, "counter_mode": "Enabled", "dev": "input", "mode": "Simple"}}
    

    Checked if counter mode changed using UniPi Control Panel web and API call to get state.
    Changing 'Debounce' or 'Counter' works OK.

    API call is case-sensitive in strange way. Calling with 'Disabled' fails:
    (despite it should be correct by doc: https://evok-6.api-docs.io/1.05/json/change-digital-input-state-json)

    Invoke-RestMethod -Method POST -Uri http://10.3.2.65:8080/json/di/1_01 -ContentType application/json -Body '{"counter_mode":"Disabled"}'
    

    returns BadRequest:

    {"status": "fail", "data": "u'Disabled' is not one of ['disabled']\n\nFailed validating 'enum' in schema['properties']['counter_mode']:\n    {'enum': ['disabled'], 'type': 'string'}\n\nOn instance['counter_mode']:\n    u'Disabled'"}
    

  • administrators

    Could you please mention which version of EVOK you are using? I think this was changed recently.




  • administrators

    That's really odd! The filter in the error message is from before 2.0.5. It was removed precisely to fix the issue with case sensitivity, in https://github.com/UniPiTechnology/evok/commit/266d78766ae6cd6bf1970e50ce55f040415a6770

    I'll investigate it some more, please wait a few hours.



  • Is there a way to check installed EVOK version? Didn't find any in evok.log (with DEBUG level). If you saying it was fixed recently, I might just have a problem with updating Evok or so. Will investigate with another UniPi device.


  • administrators

    It might be best to try again with the latest version. The EVOK version cannot be easily found since it's done via GitHub versioning, the easiest via is by checking which installation file/image has been used.

    Apologies I did not get back to you earlier, but do try it with the latest version.