-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Current Measurement device support? #141
Comments
Hi Glenn, Homekit doesn't support Current Measurement, however, if you set your current measurement device up as temperature sensors in Homebridge, they will display just fine. I use this for my current measurement unit. Any C-Bus measurement device including the C-Bus General I/O unit will work. Just remember to add the channel number as well. The current measurement unit has four channels. Some multi channel C-Bus measurement devices start at Channel 0 and some at Channel 1 so just make sure you choose the correct channel number. Cheers Jason |
Hi Jason, Thanks heaps for the response. Since asking this question I did setup as you suggest. In who's hands would providing support be in? Also, as I have three phase and don't care about the individual phases, is there a point between three CT's and HomeKit that will let me merge the three values into one Temperature Accessory? Thanks again, |
Hi Glenn, WRT to rolling the three phases of current sensors into a “total current” usage device, this isn’t something that is supported within the plugin and configuration of sensors. May I suggest investigating Node Red, that can be also run on the same pi as Homebridge. This has a HomeKit plugin where you can take the three measurements and add them using node red logic with a simple “add inputs” block. From here you could just create a “summed” current (temperature) sensor that will appear as a new sensor in HomeKit with a single summed value. I am using node red to do things like this for garage door opener with open/closed reeds and obstruction sensors from cbus. I am travelling at the moment, but when back, I will have a look at it. In the meantime, have a look at node red. It is awesome! Cheers Jason |
Hi Glenn, I am back from travelling and had time to mock up a single current sensor from the three phases. I have used Node Red to input three phases of the C-Bus Current Sensor defined as Temp sensors in Homekit. In Node Red, I just used a function to add them and output a single phase Temp (Current) Sensor. It looks complicated, but I left the green "Debug" boxes to show the values at each step. Below is the output in homekit. Note that as I took the screen capture from the phone and node red at different times, the values had changed. If you are wondering why the current is so high, my 22kW ducted AirCon unit is on. Each phase is usually about 3-4 amps... So, it's doable, with a little bit of mucking around. Have a look at Node Red, it is very powerful. I can also help you in setting up something if you are interested. I also used it to define homekit thermostats to manage temperatures in each room of my house with my "dumb" ducted AirCon. Each room has a zone damper controlled by a low voltage c-bus relay and c-bus temp sensor. Logic in my colour C-Touch screens manages the dampers and the desired temperatures can be set there or on the phone in homekit. It's well worth a look and is easily set up on the same pi as homebridge. Cheers Jason |
Hi Glenn, can you close this issue if you think it’s resolved? cheers Jason |
Hi Jason, These may be purely electrical questions, but you may be able to answer them. As I have no need to keep the three phases separate, is it possible to merge via the wiring of the clamps? Will a single clamp fit all three wires? Or can three clamps be wired to one of the four circuits? This would allow me to monitor more circuits with the one device (E.g. Solar) and allow me to avoid going down the Rabbit Hole that Node-RED would be for me. :) Failing this you have been more than helpful and am happy to close this issue, I will just have to find the time to get Node-RED working and configured on the VM I have Homebridge running in. There was a time when this would have been fun, but I must be getting old. :) Thanks, |
Hi Glenn, Putting the three phases on one channel of the current measurement unit won’t work. The three power phases supplied to you are voltage sine waves that are 120 degrees out of phase with each other at 240V each relative to Neutral. The total 3 phase voltage is 415V between phases. In an ideal setup, the 3 phases are balanced w.r.t. their current loading and would cancel each other out. This is by design. This is never true in practice with each phase drawing different currents and with inductive or capacitive loads the current phases “move” a little bit from the phases of their corresponding voltages. This is what power factor is. You want the current and voltage of each phase the be as close as possible. Lots of theory on this so have a google of power factor correction. The supply authority does this correction at the substations with giant capacitor banks that they switch into and out of the supply at different times of the day when there is a large inductive load from electric motors. Back to your problem. With the above in mind, if you have a balanced system and put all three phases onto the one clamp on your c-bus current measurement device, when you add the 3 current “vectors” you should ideally get a total current less than your lowest phase current! Hopefully almost 0Amps! When you add each phase separately you are just adding their scalar values and ignoring their respective phases which is giving you a “true” total current draw. This is why you have 3 meters. If you had only one meter for your three phases, your bill would be pretty low. So you will have to do some sort of math somewhere to get the total current for the 3 phases. I suggested node-red for your problem for this reason and you can also make other complex devices in HomeKit using c-bus relays, sensors and dry-contact inputs. The only other alternative is if you have some sort of c-bus logic unit on your network like a c-touch with logic, a PAC or the newer SHAC. You could then set up three current variables and add them there. But you would still need to then get them back to HomeKit somehow… Not the answer you wanted, but now you know why…? Cheers Jason |
Hi Jason, I was after the facts and it sounds very much like you've provided them! Thanks heaps, Node-RED it is. Thanks, |
Thanks Glenn, if you set up node red, let me know and I will help you along with the plugins required and the flow for current measurement. cheers Jason |
Hi Jason, With Node-RED now installed and confronted with the editor, from your image it looks like you have re-coloured an "Inject" as the three "PhaseX Current"? As I believe this node should point at C-Gate somehow? Some further help here would be very much appreciated. :) Thanks, |
HI Glenn, you have had a busy afternoon. If you have node-red up and running, make sure you install the following plugins: node-red-contrib-homebridge-automation and One will enable you to read homekit (originating from c-bus) inputs and the other will enable you to define homekit devices. i.e. read the c-bus temp(current) sensors defined in homekit into node-red, (do the math) and create a new temp(current) sensor for the summed three phases to display in homekit. So they are not recoloured "inject nodes" but homekit input nodes. My flow for this is below. Install the plugins and then import the flow. It will break, because you need to input your homebridge pin and load the appropriate homekit device. the maths is done in the "combine Phases "function block" that uses global variables that are automatically read when c-bus broadcasts the temperatures over the network. Every 30 seconds, the function just adds the current values for the global variables and outputs it to the new "Total Current" homekit sensor So paste the flow below into your node-red and change the pin for your homebridge installation, and your devies will hopefully appear. Change my 3 temp(current) inputs to yours and hopefully youo will be good to go. You will have to add a new bridge in homekit with the pin that you choose for your new temp sensor. In the example its 111-11-112 and as a hangover from another thing I was playing with, the bridge name is villa-test. Cheers and let me know if you hit a wall... Jason Here is the flow to paste into node-red: Copy everything between the plus signs below! [ |
oh! by the way, if you are wondering what the little grey "???" inject node is, when you send the JSON payload of {"foo":"bar"} to the homekit output node it tells you what parameters the accessory supports. This is the output: Instead of 'foo' try one of these characteristics: 'Name', 'CurrentTemperature', 'StatusActive', 'StatusFault', 'StatusLowBattery', 'StatusTampered' So you know what the supported Characteristics are in homekit for the Temperature Sensor Service as you see above. Go here for all of the allowed values the corresponding characteristics: and here for the Homekit Services: They are from the HAP-NodeJS Github site that underpins Homebridge: https://github.com/homebridge/HAP-NodeJS Have fun. Jason |
Hi Jason, Thanks heaps for the help. If I've learnt anything so far, it is that I have HEAPS to learn in this context. I still don't have a clear picture of the roles of each of the pieces of the puzzle I've hit so far, but I'm happy for this to be a work in progress. Issues and Learnings...
So I have the plugins installed and your flow imported and I'm attempting to update things to point at my setup. Is the fact I have Node-RED running on a Pi but Homebridge running as an image in a Windows VM complicating things for me? Thanks, |
Hi Glenn, It sounds like you are getting there. I must say that my own experience with Node-Red is still at a lower level, but it is amazing what it can do and the plugin library is immense! Just a heads up regarding the homebridge plugins: node-red-contrib-homebridge-automation: This plugin is for "talking to" your existing homebridge installation. These are hb-event nodes dragged across from the Homebridge nodes in the left panel. You get your pin from your current homebridge installation (easy to read it from your homebridge-UI) and put into the EVENT nodes that you place into the flow. These are the "PhaseX Current" nodes. So in your case, you will need to change my old homebridge pin and put yours in. All of your homebridge defined devices should appear in a drop down list after node-red finds your homebridge. If you get this bit working, you are nearly done! This is the critical bit, so spend some time trying to get it going...If you get this up and running, you can then do anything in Node-Red with your homebridge data including changing it! node-red-contrib-homekit-bridged: This plugin creates a new homekit bridge accessory within Node Red that can be added to homekit in your iOS device. I just dragged a "Service Node" from the Apple Homekit nodes on the left panel. Clicked on it to configure it and chose TemperatureSensor as the service. It has it's own bridge name(villa-test) and pin(111-11-112). When configuring, click on the pencil icon next to the bridge name to open another window to add or change the pin. You can just leave what I had to get everything started or change it to something more useful. I didn't bother...). This part has nothing to do with your existing homebridge installation! It is added in homekit on your iphone/ipad and you just add a new accessory and choose to put the pin in just like you would if you purchased a homekit compatible device. Now, my flow above has done all of this for you except you will have to change the PIN for the three input phases, select the three sensors you have already defined in your homebridge-cbus config and add the "Total current" accessory to your phone using the separate PIN as above. Effectively you now have your "homebridge" accessory already in your homekit displaying the three seperate phase currents and now you also have a "node-red" total phase current accessory in your homekit. Node-red just reads the current values for the three phases from the homebridge accessory, does some mathemagic and writes the value to your node-red accessory. Hopefully this helps get you there...let me know if you hit another snag or if you get it going... Cheers Jason |
Hi Jason, I think I'm now as far as I can go, without getting my electrician to install the Sensor for me. I baulked at the wiring needing a "Shorting block" from even testing the thing. I'm not an electrician and have no idea what one is! :) But I have Node-RED now seeing Homebridge, by ditching my VM and installing it on the same Pi. And the flow seems relatively happy and delployed, but the "hb-event" nodes have a status of "Disconnected"... Any other way to check I have things right, without numbers coming from the sensor? Thanks, |
Try another device from homebridge. It doesn't matter if it errors further along the flow. You just want to see something coming in from your homebridge to Node-Red. Try a dimmer group address in your "Shed Phase 1" node just to test the link. Or drop another homebridge node in as a dimmer. If it still doesn't work, then we have more work to do... For example, if you set the Shed Phase1 input to a group address of a Dimmer, you should see something like this: A "node-red-stop" & "node-red-start" on the pi may be useful if you don't have any luck... You can also just connect the current sensor into your cbus network and have it running with the current sensors attached but not "clamped" across your active phases. You will just get a value of 0.00A on each channel. My Current Measurement Unit is just mounted in my main switchboard and the current clamps are clipped around the phases on my side of the main switch like the installation instructions: No shorting block... If you are worried, then just clip it around an appliance lead of something, i.e. laptop, lamp etc. Have you defined the Current Sensor configuration in the Toolkit database and Homebridge? In Toolkit: And in Homebridge: { Then you can play with it while you wait for your sparky... Cheers Jason |
Have a look here for the installation and configuration of the node-red-contrib-homebridge-automation nodes in case I missed anything: https://flows.nodered.org/node/node-red-contrib-homebridge-automation Cheers Jason |
Hi Jason, Thanks again for ALL the detailed help, very much appreciated. My last error was remnants of the "Import", where I had to replace some double quotes with single quotes to get it to import and I wasn't methodical about reversing these. Once I had these fixed and restarted, some action! Yay! Values for a light are returned and zero values found for all three current sensors configured. But zero current values is all I can achive. I've tried a couple of the clamps in slots 1 and 2 with them clamped around the power to my PC and using the "Status" in the Toolkit get nothing but zeros. Thinking I now definitely need my Sparky for this aspect. The other thing I see not working is the accessory isn't being created in Homebridge (or I can't find it). Nothing in node-red-log other than the debug... 31 Jan 21:33:21 - [info] [debug:Total Current] Hard for me to see anything in the Homebridge log other than the spaming the Airtouch4 plugin I have installed creates. Is there likely to be something in here? Thanks again, |
Hi Glenn, sounds good so far...remember in Toolkit that you have to set up the sensors to broadcast their values. I set them up to broadcast every minute: I also set them up to broadcast whenever a change of 2% occurs: Look carefully at the screens above and check your settings. Make sure you also have the "Measurement Device ID" set to the same value as the C-Bus Address of the unit as below: This may fix your zero amps problem. To see the new "total current" sensor in homekit, you then need to:
Hopefully it will then import into Homekit and you will be good to go. Cheers Jason |
Hi Jason, My created accessory is now visible. The issue here was I'd used the HB Pin, so once I'd changed this to 1111-1111, I was able to add it. While I did have a mismatch with "Measurement Device ID" and "Address", once they were the same, no change. While I have wound the broadcast interval down to 10 seconds, no change. But I am checking and expection values on the Status tab. Do you see values other than zero "Measured Values" here? And I've pressed "Update Status" a few times. :) So, possibly all working, except the basic principle of the whole deal, measured values. Yay. :) Thanks, |
Hi Glenn, I'm gonna call this a win so far. It may be that the current of the device that you are testing it with is just not enough to register on the sensor even at the lowest 40A range. You can coil the power cord up and loop it through the sensor a few of times for measuring smaller currents. It increases the magnetic field that the current clamp measures and it may register a reading if this is the problem. The clamps are designed for this and in toolkit, it divides the current by the number of turns. That is what the "Turn Count" value is for each channel in the toolkit config screen. These current sensors work on the "right hand rule" where a current carrying conductor sets up a circular magnetic field around the conductor directly proportional to the current flow. This is what's measured. Its how motors/generators work. Thanks to Michael Faraday! These things are basically mini transformers. You should see the broadcasted values in Toolkit as below: Are you also seeing it in the log? Anyway, check the above if you want to, but I think you may be there... Let me know how it all goes when you finally put them on the switchboard phases. Congratulations and welcome to Node-Red. Now you can get any value you want from any homebridge accessory and do anything with it! You can even publish the data to a webpage with the nodes below! Cheers Jason |
This is a silly question, but are the sensors screwed into the correct terminals on the current measurement unit? I have overlooked sillier things when trying to get something to work… Cheers Jason |
Hi Jasson, Stupid question time, where do I see the "Log" you show? I don't think it's something I know about. I've now looped three times a portable floodlight, put in the count of three, and still no values but zeros in the Status tab. Not such a silly question, as I still doubt I have the wiring correct, but I have tried several variations with no change. This is what I have though... Thanks, |
Hi Glenn, the log option is found in the left hand panel of your project tree in Toolkit: The log lists plenty of decimal places, so the zero values would indicate something definitely not right...possibly something simple that we have missed. You don't need to change the number of turns from 1 to 3 in the configuration. You are then effectively negating the multiple turns to increase the current measurement as you are then dividing the output again by 3 and going back to where you started. The picture below is only for illustration of what you should do with your sensor and cable that you are trying to measure the current flow in. Remember that this is just a suggestion for this testing to ensure you are getting a reasonable amount of current for the sensor to give a decent reading. The sensor range is 0-40A and you are probably running a few hundred milliamps so you are way down the bottom of its range: With the wiring of the sensors, it is measuring AC current, so polarity "may" not matter. However, the c-bus wiring diagrams show the black sensor wires in the A terminals and red to the B terminals like you have them. I can't remember if polarity matters...but lets follow the instructions. In your photo, I don't see any pink c-bus cable behind the unit and obviously no Unit/C-Bus orange lights. Silly question time again: "is it patched into the cbus network?" or is it disconnected just to take the photo? Your earlier toolkit screenshots seem to indicate a network connected unit with healthy enough c-bus voltage etc. Did you rescan the network in toolkit, make sure its also loaded to the database AND network and there are no device conflicts (i.e. duplicate addresses) and the serial number in toolkit matches the sticker on your Current Measurement Unit? Serial number is under the "Unit Identification" Tab in the device edit screen in Toolkit. Your screen captures above show that you have opened the unit for programming from the database (top) window. Can you open the device from the network (bottom) window, check the config and make sure you save the programming to both the network and database. I'm really trying to go back to basics here...so bear with me! That's all I can think of at the moment. Can we check the above...? Cheers Jason |
Hi Jason, I guess I'd forgotten about the Log and have just gone staight to Units for my use of Toolkit since building and attending the training as a "Home Owner" back in 2006. So thanks! :) Here are my logged values, and they are a neat 0... At this point I realise I've never connected all three clamps, but have always had the three Enabled, but with only one Enabled and the one clamp, no change. Have now enabled the all 4, just in case 1 was 4. All zero. Three loops through the one clamp and turn count of 1, still zero. Yes, I disconnected it from the network for the photo. Logistics of where the test cable resides and lighting. :) I've rescanned, always save to both, and have edited from the bottom section, all good. Toolkit would tell me if I had a conflict? Only one device with 92 is found. Serial numbers match. I'm good with going back to basics, I'm learning heaps! :) I hope I've checked everything you've asked. Let me know if I've missed anything. Thanks, |
Hi Jason, No apology necessary in the context of how much time and help you have given me! And this is excellent news! I do now remember you saying this earlier, so my miss as well. I had a thought, but haven't gone through with it, as it would be dangerous and illegal for me to dig up an old appliance power cable, remove the sheath to expose the active wire, and attach a socket to the end, creating myself a test cable I could put in-line with my light. But if I were to do this, I'm sure I'd find that you are correct, and I have everything working, after I update the address from 1 to 92 in the Homebridge configuration of course. :) Thanks heaps for the help, and the introduction to Node-RED. My job now is to learn what else I can use it for. I'm thinking I may be able to build a "Theartre On" group address and have Node-RED handle the detail, and be able to move completely away from TouchControl? Thanks again, |
I'm still shaking my head in shame! I suggest you have a look at the different devices in the node-red-contrib-homekit-bridged. I am currently looking at a garage door opener that takes Auxiliary Inputs from C-Bus for Door Open Reed, Door Close Reed and the obstruction sensor of my garage door opener. I also have a c-bus relay output that sends a 1 second pulse to the garage door opener to open/stop/close it. The way that the homebridge-cbus plugin is written, it takes one c-bus Group Address and maps it to one homekit accessory. So a garage door opener which is a "composite" device with three c-bus inputs for open/close reeds & obstruction and one c-bus relay output for open/close/stop would require some recoding and logic changes in the plugin that seems just too hard... It can be realised as a "flow" in node-red with previous and current "states" to facilitate the open, closing, closed, opening, stopped states. Heater/Coolers & Thermostats work in a similar way, where you need a setpoint, temp sensor input and some form of damper/temperature control output. I am also playing with this, because in Node Red it is easier... The garage door is a work in progress, but initial testing looks good so far... Have fun and let me know how it all goes... Cheers Jason |
Hi All,
I'm a newbie to HomeBridge, an SAP ABAP coder by trade, have had C-Bus installed since 2006 and have played with many C-Gate consuming control tools over the years, but iOS Home using this plugin is the best so far. I have a shiny new Current Measurement Unit 5504CMU and am wanting to get it displaying in Home and while the existing Temperature accessory looks close to me, will this work without changes?
Thanks,
Glenn.
The text was updated successfully, but these errors were encountered: