anthonywebb / homebridge-cbus

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

Temperature sensors support #78

Open msuMax opened 6 years ago

msuMax commented 6 years ago

Hi!

First of all, I would like to say huge thanks to Anthony and everyone who commited to this project. It works amazing, I love it.

My question is - are there any plans on implemeting Clipsal temperature sensors support? I've got several 5031RDTSL installed and that's basically one last thing that keeps me from moving from wiser to homebridge completely.

In my system all these sensors are being polled every minute and based on their readings wiser switches off/on relay channels with radiator valves.

BR, Max.

DarylMc commented 6 years ago

@anthonywebb @simonhac I too really love the work you have done on Homebridge CBus.

The programming seems a bit beyond me but if you could try to explain what is involved to make an accessory would be great. Maybe just the concepts. I'd like to learn.

DarylMc commented 6 years ago

@anthonywebb I'd like some feedback on the raspberry pi image. How is it going for you? I haven't changed anything for a while now. I think I got it going pretty well but it would be good to hear if you found any problems. For my pi I have samba set up. I reckon every Windows user who wants to be able to view or edit a few of the text files on that platform would like that.

mattangelofdeth commented 6 years ago

I too would LOVE temp support It would allow me to start the air conditioning when particular temps are hit

DarylMc commented 6 years ago

@mattangelofdeth Your AC is already an accessory? Can you set a the sensor or something on the CBus network to turn on a CBus group address at the required temp range? Then you could set it up in the Home app automation. Probably 2 automation's. One to turn on and one to turn off.

PhilPearson commented 6 years ago

Writing a new accessory is not too difficult. I dont have a 5031RDTSL but looking at toolkit it seems that you can configure it to broadcast the temperature setting on a regular basis. I'm guessing your accessory would then read this value and show this within homebridge. Not sure if homebridge can then do automated tasks based on temp values?

msuMax commented 6 years ago

@PhilPearson That is actually how it works in my system: image

msuMax commented 6 years ago

@PhilPearson actually you can trigger automations based on temp, but you need to set them up in alternative apps like Elgato Eve. I’ve tested it with Xiaomi temp sensor and exhaust fan on a Clipsal relay. It works.

JasonY00 commented 4 years ago

Hi Max,

I managed to write a temp sensor accessory for the 5031RDTSL but it was set up for the temperature application in C-Gate. This did require "breaking" some of the integer checking in the homebridge-cbus plugin when receiving data for the cbus group address as temperature is parsed as a real number. It works fine in the Home app but undermines the data error checking already done by Antony.

I hope to port it to the measurement application in C-Bus so it can be more universally applied but the measurement application adds another level of complexity in addressing in C-Bus as it adds a Channel level in the data and a few other data parameters. This is challenging my rudimentary programming skills but I will give it a go!

Hope to have something for you soon if you are still interested.

Cheers

Jason

msuMax commented 4 years ago

Hi Max,

I managed to write a temp sensor accessory for the 5031RDTSL but it was set up for the temperature application in C-Gate. This did require "breaking" some of the integer checking in the homebridge-cbus plugin when receiving data for the cbus group address as temperature is parsed as a real number. It works fine in the Home app but undermines the data error checking already done by Antony.

I hope to port it to the measurement application in C-Bus so it can be more universally applied but the measurement application adds another level of complexity in addressing in C-Bus as it adds a Channel level in the data and a few other data parameters. This is challenging my rudimentary programming skills but I will give it a go!

Hope to have something for you soon if you are still interested.

Cheers

Jason

Jason, that is awesome news. I am still very interested in this.

Please feel free to let me know if I can be of any help.

Max.

JasonY00 commented 4 years ago

Hi Max,

screen shots below of the c-bus temp sensor in the home app: Status Page Temp Sensor Icon

Sorry about the waffle below, but as a lapsed programmer, this is what i'm thinking...

Although the temp sensor works, it requires the temperature sensor to be set up for the C-Gate temperature application 25 and not measurement application 228 as described in an earlier post. This adds anther level of complexity in the homebridge-cbus plugin to parse the command and get and interpret the data.

If you just want to initially use it for a "proof of concept" I can tidy up some of the debugging mess and load the current temperature application version of homebridge-cbus into my github repository for you to play with. I do want it to be on the measurement application but that requires a further rewrite of the homebridge-cbus plug in to facilitate the extra channel level query in this application. That is, the command has to go from a "get 254/25/5 Temperature" command to a "get 254/228/5/1 Data" command where 254 is my network, 25 or 228 is the appropriate application, 5 is my temp sensor device number and 1 is the channel number. The data output is also different eg. response is "300 //PROJECT/254/25/5: Temperature=26.5" to something like "300 //PROJECT/254/228/5/1: Data=26500,-3,0,1402"

This requires some data massaging and I am learning to program in Node.js as I go along...I haven't programmed for 20 years and its moved on a little since then!

In the config.json file the accessory would need to have the channel number. In homebridge-cbus I have to decide whether to have a lookup table for the measurement unit type reported by cbus (ie 0 = Celsius, 1 = Amps, etc as per the c-gate manual) or hard code it in the accessory definition and ignore what c-gate tells me it thinks it is. So something possibly like:

{ "type": "temperature", "application": 228, "id": 5, "channel": 1, "units": 0, (Degrees Celsius in C-Gate) "name": "Test Temp" }

Let me know if you want to try what I have and I can let you know what files to upload to your homebridge-cbus folder from my github and you can add the sensor into your config.json file. Bear in mind though that Homekit does not yet support automation based on temperature sensors! For this you can download the free Elgato Eve app from the App Store and create temperature based automation there. I haven't done this yet, but I understand this is how it has to be done.

Will have a play when the kids are asleep...

Cheers

Jason

JasonY00 commented 4 years ago

Hi Max,

I have a temperature sensor going within the c-bus measurement application that also supports temperature, humidity and light level. I am testing the latter two with a c-bus current sensor, but it looks ok so far. C-BusSensors

The screen cap above is rendering three current phases 2.5, 3 and 1.5amps as temp, humidity and light level from my c-bus current sensor :-). it is also working with a standard c-bus temp sensor but this is easier to play around with for debugging.

If you are still interested, then I will keep going with it and hopefully get it nice and clean and maybe Anthony will include it in his c-bus repository.

Let me know...

Cheers

Jason

mattangelofdeth commented 4 years ago

AmazIng work! I would love to see this natively supported in the plugin!

Thanks so much Jason


From: JasonY00 - notifications@github.com github.mrees.4f637e54b9.notifications#reply@reply.github.com Sent: Tuesday, November 12, 2019 4:23:26 PM To: anthonywebb/homebridge-cbus homebridge-cbus@noreply.github.com Cc: AngelOfDeth github.mrees@a-bc.net; Mention mention@noreply.github.com Subject: Re: [anthonywebb/homebridge-cbus] Temperature sensors support )

Hi Max,

I have a temperature sensor going within the c-bus measurement application that also supports temperature, humidity and light level. I am testing the latter two with a c-bus current sensor, but it looks ok so far. [C-BusSensors]https://user-images.githubusercontent.com/56619655/68644009-c1d5b500-0567-11ea-8546-962c9c270b88.png

The screen cap above is rendering three current phases 2.5, 3 and 1.5amps as temp, humidity and light level from my c-bus current sensor :-). it is also working with a standard c-bus temp sensor but this is easier to play around with for debugging.

If you are still interested, then I will keep going with it and hopefully get it nice and clean and maybe Anthony will include it in his c-bus repository.

Let me know...

Cheers

Jason

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/anthonywebb/homebridge-cbus/issues/78?email_source=notifications&email_token=AGRATSL72RH3TR5BY4PPXYDQTI4U5A5CNFSM4EHTPTW2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEDZCEAY#issuecomment-552739331, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AGRATSJXAQUJAQFWNAF6KXTQTI4U5ANCNFSM4EHTPTWQ.

JamesPickup commented 4 years ago

I've created a PR for Temperature sensors support. I've only tested with the C-Bus Digital Temperature Sensor Input Unit, 4 Channel cat no: 5104DTSI https://github.com/anthonywebb/homebridge-cbus/pull/97

DaveGraham123456 commented 4 years ago

I've created a PR for Temperature sensors support. I've only tested with the C-Bus Digital Temperature Sensor Input Unit, 4 Channel cat no: 5104DTSI

97

Amazing thread and I hope to beneift :-). I have some c-bus temperature sensors and am keen to have them be read.

How do I do it?

JasonY00 commented 4 years ago

Hi Dave,

to enable the support for the c-bus temperature sensors, you will need to copy the homebridge-cbus repository from JamesPickup and not here at AnthonyWebb. This is because the pull request has not been merged into the repository by Anthony as yet.

So go to the following link to get it: https://github.com/JamesPickup/homebridge-cbus

You can copy the whole thing to your homebridge-cbus directory. There are only a few files changed for temp sensor support so you can also just copy the:

homebridge-cbus/index.js file, the homebridge-cbus/accessories/ directory, and the homebridge-cbus/lib/ directory

to your own homebridge-cbus/ directory

After that, just add the following configuration into your config.json file like this:

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

If you have a single channel 5031RDTSL the Sensor Mode must be set for the "Measurement" Application (228). The "id" is not the UNIT ID in Toolkit, but the "Measurement Device ID" in the unit. (Generally, I have these set to be the same number but they don't have to be). The "Channel" must be "1".

If you have a 4-Channel 5104DTSI the same applies as above except the channel can be 1,2,3 or 4. The name you choose for each temperature channel in Toolkit is irrelevant, so leave it as is or set it the same as you set it in homebridge to make it easy to compare logs in homebridge/toolkit.

Remember that the Apple Home App will not allow you to create automation rules based on temperature. You will need to set these up using the Elgato Eve app or in a C-bus based logic engine on your c-bus network if you have one.

James did a great job of this temperature accessory and it can easily be adapted to be used with a C-Bus General Input Unit with other sensor types, e.g. Humidity, Light Level, etc. If you use a C-Bus General Input Unit with another temperature sensor that is not C-Bus, the channels are numbered 0,1,2,3 and not 1,2,3,4. This c-bus temperature accessory has been written to support channel numbers from 0-8 just in case :-)

I use this temperature accessory very successfully with both temperature sensor types above, my C-Bus General Input Unit for (non-C-Bus humidity and light level sensors (where I rewrote some of the code to support humidity and light level) and for my C-Bus 4 Channel Current (Amps) Sensing Unit.

Hope this helps.

Cheers

Jason