anthonywebb / homebridge-cbus

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

Legacy Temp Sensor #109

Open DaveGraham123456 opened 4 years ago

DaveGraham123456 commented 4 years ago

Hi there,

I have "Legacy" temp sensors. They are 5031ts devices.

Would I add them in the same way? What would the structure of the ID be? For the SHAC i needed to add them as Measurement devices.

p.s. Love that you did this. Really great functionality.

JasonY00 commented 4 years ago

Hi Dave,

these temp sensors work a treat in homebridge. Just add them in your homebridge config.json file like the example below

{ "type": "temperature", "id": 35, "application": 228, "channel": 1, "name": "Temperature Outside", "enabled": true },

Note that the ID may be different to the Temperature Sensor Unit Address in Toolkit. It is the Device ID that the sensor broadcasts on not the Unit Address. You can either see this in the c-gate/toolkit log or if you edit the temp sensor in toolkit look for the "Measurement Device ID" in the top right of the configuration window. This is the ID that you use. It doesn't need to be the same as the unit address. The "channel" is always 1 and the "application" is always 228. You must have the Sensor Mode set to "Measurement" in the config screen in Toolkit.

So the only things you need to change from the example are the "id" as above and the "name" that you want.

Cheers

Jason

DaveGraham123456 commented 4 years ago

Hi there Jason. Have attached a picture of my toolkit,

It does not update on my Homebridge GUI or my iPhone, it is at zero. I suspect it is the issue it is the really old ones.

thoughts?

temp_gui

temp_home

temp_senosr

JasonY00 commented 4 years ago

Hi Dave,

I have not seen and older sensor configuration dialog like this before. half way down on the right in the Toolkit config is the "application" option which is set to "Heating(Legacy)". What other options are there in the drop down box? If there is a "measurement" option you may be good to go. If there is only lighting, maybe we can do a workaround in the code...or perhaps it can be defined as a light dimmer in homebridge.

I'm looking at my 5031RDTSL configuration in 5031TS mode and I am not sure if it broadcasts like the 5031RDTSL does. I will have a look at the logs myself.

How does the message from the sensor look in the toolkit log (or even c-gate if you can see it?) i.e. does the sensor "broadcast" to the network like the newer model?

There may be a chance that it can't be done (at least easily). It's possible that you can "ask" the sensor" what its value is in homebridge, but it may not refresh by itself when the temperature changes. I really don't know until I can see a log.

Cheers

Jason

JasonY00 commented 4 years ago

Hi Dave,

I have had a play around with my 5031RDTSL set up as a 5031TS. Although the configuration screen is slightly different. It looks like the 5031TS does not "broadcast" the temperature on any application in C-Bus. i.e. Heating Application (136) or Lighting Application (56). It only allows the control of a group address (GA) in these applications and can set the GA to ON or OFF with preset values for hysteresis.

If I ask the sensor directly in c-gate what the temperature is, it tells me:

get 253/p/246 Temperature 300 //JYOUNG/253/p/246: Temperature=26.50

However, it doesn't broadcast this value on the network. What does this mean for integration of this sensor type into Homebridge? Well to "get" the temperature from the unit we need to address the physical unit and not a group address. This is where the "p" comes from above. "253/p/246 Temperature" means "ask the physical temperature sensor at address 246, network 253 (mine is bridged) what value the of Temperature is?" The response comes from the network with the "300" response. 300 is the response from a "get" command.

When attempting to get a temp sensor running in homebridge I originally had the idea of running the temperature sensor in the Temperature Broadcast application as the data waas nicely formatted and I had it running as a proof of concept in the Temperature Broadcast application. However, it didn't address the device with its physical address but an application address like this:

get 253/25/1 Temperature 300 //JYOUNG/253/25/1: Temperature=26.5

In this mode it also broadcasts the temperature and you can see it in the toolkit log.

The way the homebridge-cbus plugin works is to "get", "set" or listen for "events" of the state of cbus devices by their "application" address and not their "physical" address. That is, the value of the device is placed into a "level" or "data" variable by cbus, homebridge or the sensor itself.

The current way of doing cbus temperature sensor integration in homebridge is via the default "measurement Application" so messages look like this:

get 253/228/246/1 Data 300 //JYOUNG/253/228/246/1: Data=267,-1,0,37540

Where the Data means 267 x 10 to the power of -1 (= 26.7) the 0 means Degrees Celsius and the 37540 relates to the source address.

This is related to the homebridge config.json file in the following way:

 "type": "temperature",
 "network": 253, (as mine is bridged)
 "application": 228,
 "id": 246,
 "channel": 1,       (the order of these assignments in the config doesn't matter)

So generally, I can't see an easy way to integrate this type of legacy sensor within the standard framework of how the plugin works. It could be done, but it would be a "hack" and bypass lots of inbuilt error checking with respect to c-bus network address validation. It would also mean that the sensor would need to be "polled" to regularly report its value back to homebridge. Once again, do-able, but not ideal. I think the work involved in coding it may outweigh the number of users requiring it.

Someone else may be up to the task, but I don't think I am at this stage. Sorry to not be able to give you an answer you are wanting to hear.

Incidentally, how many sensors do you have? If you have 4 or less, then for a reasonable capital outlay and a bit of crawling around the ceiling space, one 5104DTSI 4-channel digital temperature sensor unit and 4x sensors is an option. The 2m leads from the sensors can be extended with figure 8 cable and they can be well hidden in ceilings/walls. The unit looks just like like a bus coupler and can be put anywhere...

Hope this helps.

Cheers

Jason