anthonywebb / homebridge-cbus

CBus plugin for homebridge
MIT License
35 stars 20 forks source link

DEBUG environment variable producing 'cbus:level undefined' log output #104

Open arrikhan opened 3 years ago

arrikhan commented 3 years ago

I have recently turned off client_debug: true in the homebridge config in preference to see only level state changes in the homebridge console shown in the README using the environment variable (eg: DEBUG=cbus:level homebridge)

image

However, all I am seeing is the following ...

2020-08-01T15:16:12.784Z cbus:level undefined 2020-08-01T15:16:37.643Z cbus:level undefined, by External Temperature Sensor (SENTEMPB) 2020-08-01T15:16:57.737Z cbus:level undefined, by Lounge Temperature Sensor (SENTEMPB) 2020-08-01T15:17:37.642Z cbus:level undefined, by External Temperature Sensor (SENTEMPB) 2020-08-01T15:17:57.735Z cbus:level undefined, by Lounge Temperature Sensor (SENTEMPB) 2020-08-01T15:18:30.169Z cbus:level undefined, by NEWUNIT (SYS_SHAC) 2020-08-01T15:18:30.173Z cbus:level undefined, by NEWUNIT (SYS_SHAC) 2020-08-01T15:18:37.647Z cbus:level undefined, by External Temperature Sensor (SENTEMPB) 2020-08-01T15:18:57.752Z cbus:level undefined, by Lounge Temperature Sensor (SENTEMPB)

The first line is me turning a light on, the rest is pretty obvious.

CGATE is logging more informative data;

20200802-013648 730 ///254/56/3 34ded720-a7e7-1038-a9f4-e8798d1af2f4 new level=255 sourceunit=18 ramptime=0 20200802-011830 702 ///254/223 - [clock] date 2020-08-02 6 sourceUnit=51 20200802-011830 702 ///254/223 - [clock] time 01:22:08 0 sourceUnit=51 20200802-013037 702 //BCOLEMAN/254/228/35/1 - [measurement] data 117 -1 0 sourceUnit=35 20200802-013057 702 ///254/228/34/1 - [measurement] data 207 -1 0 sourceUnit=34

Are others seeing "cbus:level undefined" in homebridge console or something like the example?

JasonY00 commented 3 years ago

A silly question, but are the C-Bus group addresses defined in homebridge. i.e. does your config.json file include entries for "Entry PIR", "Verandah Step Lights", "Verandah" & "Entry PendantLG". Also, do they have a type? i.e. dimmer, light, motion, etc?

If a cbus accessory is undefined in homebridge-cbus and sends an event message over the network, it will be logged as "output = ${chalk.red.bold.italic(tag)} (not-registered) set to level ${message.level}%;" from the code, which seems to describe your logs above.

Your "Study Pendant" & "Study Wall" are both defined as type "dimmer" and seem happy in the log.

How have you configured your two c-bus single channel temperature sensors above in the config.json file?

Cheers

Jason

arrikhan commented 3 years ago

The coloured image is the example, not my logs.

Config in homebridge looks a little like this for the switch show in example ..

{ "platform": "homebridge-cbus.CBus", "name": "CBus", "client_ip_address": "127.0.0.1", "client_controlport": *, "client_cbusname": "****", "client_network": 254, "client_application": 56, "platform_export": "/homebridge/my-platform.json", "accessories": [ { "type": "dimmer", "id": 3, "name": "Bedroom 3 Lights", "enabled": true }, { "type": "temperature", "id": 35, "application": 228, "channel": 1, "name": "Temperature Outside", "enabled": true },

JasonY00 commented 3 years ago

Sorry about my confusion re the logs.

Not sure why you edited out the BCOLEMAN in your config file above and replaced it with ***. It should also appear in your cgate logs for each entry. Did you edit it out here as well?

Can you control your c-bus via your apple device and the homebridge UI now?

What happens if you turn debug logging back on again? Do the messages disappear?

Cheers

Jason

arrikhan commented 3 years ago

Not sure why you edited out the BCOLEMAN in your config file above and replaced it with ***. It should also appear in your cgate logs for each entry. Did you edit it out here as well?

Yeah it stuffed up the copy/paste. Assume it and the port number are there.

Interestingly, no. I did not edit it out of the CGATE logs I pasted. Just realised the temp updates coming from the network don't show the project name, nor do the sync statements.

I can control/see units on Apple Home just fine.

As far as debug mode being turned on, I see the raw info coming from CGATE pretty much. The usual human undecipherable blart of data.

JasonY00 commented 3 years ago

I can only to suggest looking at the logs without debug mode turned on and without your level change filter and see what you get. I can't reproduce what you are seeing on my config.

Let us know how you go, I am a little stumped with this one...

Cheers

Jason

JasonY00 commented 3 years ago

Good news and bad news!

I have managed to reproduce what you are observing with the cbus:level debug. Because I am using the homebridge-UI, I had to make the appropriate change in the homebridge environment setting with a slight change and observed your problem of undefined cbus:level responses.

It all goes back to a bug in the coding to support temperature sensors in the index.js file. With this corrected and another if statement added to exclude measurement "levels" being sent through, the cbus:level DEBUG option works again as originally designed.

That's the good news...

The bad news. It will take a pull request to amend the code, trigger an update in the plugin and you will have to run an update on the plugin to give you what you want. If you know some node.js and really want this now, I can post up the code snippet for you to splice into the index.js file in your own system. Otherwise, you may have to wait for one of us to submit the pull request and have Anthony integrate it.

If I have time in the next few days, I will try to submit a pull request myself.

Cheers

Jason

arrikhan commented 3 years ago

Jason, thank you so much for spending the time to recreate the problem with the code. Sorry I hadn't had notifications turned on so didn't see your message until now. I don't know node.js and am happy to wait for the brains to resolve this. Thanks again!

BenC

manningoz commented 1 year ago

Any progress on this as I am now getting the same issue? Many thanks

manningoz commented 1 year ago

Good news and bad news!

I have managed to reproduce what you are observing with the cbus:level debug. Because I am using the homebridge-UI, I had to make the appropriate change in the homebridge environment setting with a slight change and observed your problem of undefined cbus:level responses.

It all goes back to a bug in the coding to support temperature sensors in the index.js file. With this corrected and another if statement added to exclude measurement "levels" being sent through, the cbus:level DEBUG option works again as originally designed.

That's the good news...

The bad news. It will take a pull request to amend the code, trigger an update in the plugin and you will have to run an update on the plugin to give you what you want. If you know some node.js and really want this now, I can post up the code snippet for you to splice into the index.js file in your own system. Otherwise, you may have to wait for one of us to submit the pull request and have Anthony integrate it.

If I have time in the next few days, I will try to submit a pull request myself.

Cheers

Jason

Thanks Jason for working out the issue. Would you able to provide the code and instructions so I can fix this issue?

many thanks