Homematic Variables not working (2)

Hi there.

I am trying to access my homematic variables. I already checked this thread

but it seems my CCU2 does not reproduce the bug. The logs were confirmed by a contributor to state a functioning setup (Homematic: cannot see/modify variables · Issue #18984 · home-assistant/core · GitHub).

So I am wondering what else could be an issue. As I ‘lost’ my devices when resolvenames actually started working and according to the docs it is not necessary for variable access I deactivated it again. So here is my current configuration:

homematic:
  interfaces:
    wireless:
      host: 192.168.178.39
      resolvenames: false
      username: homeassistant
      password: nLGWekp3
  hosts:
    ccu2:
      host: 192.168.178.39
      username: homeassistant
      password: nLGWekp3
  local_port: 8124

I added the homematic.ccu2 entity to one of my groups so it is displayed in the overview section. When I click it there are no environment variables visible, although I do have numerous booleans and a numeric one defined.

What may be missing here?

I investigated a bit with my log settings tuned to debug and looking at the source code

So this is what I saw from the logs:
2018-12-09 21:12:35 DEBUG (SyncWorker_0) [pyhomematic._hm] ServerThread.getAllSystemVariables: Getting all System variables via JSON-RPC
2018-12-09 21:12:35 DEBUG (SyncWorker_0) [pyhomematic._hm] RPCFunctions.jsonRpcPost: Method: Session.login
2018-12-09 21:12:35 DEBUG (SyncWorker_0) [pyhomematic._hm] RPCFunctions.jsonRpcPost: API-Endpoint: http://192.168.178.39:80/api/homematic.cgi
2018-12-09 21:12:35 DEBUG (SyncWorker_0) [pyhomematic._hm] RPCFunctions.jsonRpcPost: Method: SysVar.getAll
2018-12-09 21:12:35 DEBUG (SyncWorker_0) [pyhomematic._hm] RPCFunctions.jsonRpcPost: API-Endpoint: http://192.168.178.39:80/api/homematic.cgi
2018-12-09 21:12:35 DEBUG (SyncWorker_0) [pyhomematic._hm] RPCFunctions.jsonRpcPost: Method: Session.logout
2018-12-09 21:12:35 DEBUG (SyncWorker_0) [pyhomematic._hm] RPCFunctions.jsonRpcPost: API-Endpoint: http://192.168.178.39:80/api/homematic.cgi

What caught my attention was line 684 where the condition is checked that a valid result was received from Homematic. But since I never saw any variables popping up I got courious as what may happen at that stage. So I modified the code in my running docker container by inserting these lines:

    else:
        LOG.warn("Could not get variables: CCU2 sent error: %s" % response['error'])

After a restart my log also included this line:

2018-12-09 21:12:35 WARNING (SyncWorker_0) [pyhomematic._hm] Could not get variables: CCU2 sent error: {'name': 'JSONRPCError', 'code': 400, 'message': 'access denied ("USER" needed 1)'}

Right now my conclusion is that although https://www.home-assistant.io/components/homematic/ mentions guest access is sufficient for reading names via JSON RPC, variable access requires more. I will check that as next step.

Finally it seems I was able to resolve the issue:
After I confirmed Homeassistant is using the expected credentials to logon to Homematic I elevated the user from ‘Guest’ to ‘User’. Now the CCU2’s system variables are indeed visible in the homematic.ccu2 entity.

Next I shall want to modify the values through scripting. But that will be another task. :slight_smile: