This is the forum archive of Homey. For more information about Homey, visit the Official Homey website.

The Homey Community has been moved to https://community.athom.com.

This forum is now read-only for archive purposes.

Switch z-wave socket on based on it's own power measurement

Would in the possible to switch on a z-wave socket based on it's own power measurement? I know the Homey software currently does not support it but I first like to know if the hardware would support this use case.

I have two laptops which power supplies are connect to a power outlet using a simple outlet splitter. Even when the laptops are not powered on the laptop power supplies still draw some energy from the outlet. Because I'm a sucker for energy saving I would like to automatically switch off the power to the power supplies once the power measurement is lower then a certain level (which tells me if both laptops are switched off) and switch it back on again if the power measurement is higher (which tells me that one or both laptops have been powered on).

I believe it should be possible once the Homey software supports this but I have little experience with z-wave and I'm sure someone here can confirm this.

Comments

  • I don't get it. How can you switch it back on if the power measurement is higher? You switched it off, so how can it draw power? That is the use off switching it off? Unless you want to switch another socket based upon the powerdraw of another socket cq device. I use that for switching my Subwoofer on after it detects that my main amp is using power bejond a certain level.
  • Right, silly me (I'll blame a bad night sleep if someone asks ... :wink: ).
     
    I guess it would require something running on the laptops itself or a network ping to it's IP addresses to determine if either one is powered on and the z-wave socket needs to be switched on.
  • Phuturist said:
    Right, silly me (I'll blame a bad night sleep if someone asks ... wink ).
     
    I guess it would require something running on the laptops itself or a network ping to it's IP addresses to determine if either one is powered on and the z-wave socket needs to be switched on.
    to much green light flashing .... p
    Greenwave keeping you from sleeping?
  • Phuturist said:
    Right, silly me (I'll blame a bad night sleep if someone asks ... wink ).
     
    I guess it would require something running on the laptops itself or a network ping to it's IP addresses to determine if either one is powered on and the z-wave socket needs to be switched on.
    to much green light flashing .... p
    Greenwave keeping you from sleeping?
    :lol: 

    Strangely enough not all of them started blinking after tonight. Have to look into that.
  • Perhaps set the polling again now that they are properly reachable in the network.
  • I could see a use case that is a bit different, but needs the same functionality.

    When power usage on a socket is high (TV is on)
    Turn down the lights
  • JaxcJaxc Member

    No i dont think that what you want is possible.

    The power socket only registrates power usage when its turned ON, if you turn it of, it's functionality of logging power usage is not working also. The logging function is only active when the socet is ON !

  • JacobJacob Member
    edited March 2016
    It is definitely possible. I stop the pump of my underfloor heating based on the energy consumption of the boiler (Ketel) I did change a setting in the socket it will not switch so is is only a energy measurement.
    (Power < 25W and time delay of 10 min)
    To avoid warnings, yes it also switches on daily at 03:00 for 10 min to prevent sticking
  • When, in case of a "combiketel" , u take a shower the pump also goes on?
  • JacobJacob Member
    Yes it is a combi ketel but I switch only the underfloor heating pump there is no shower pump
  • Well, i mean:
    When boiler uses more then 25W then pump for floorheating is on, right?
    When <25W for 10 min then pump goes offline, right?
    When daugther taking a shower for like 45 min, boiler using >25W, pump for floorheating is on. Right?
    Does not sound like the best solution to me.
    Pump for floorheating should be on when heating is on.
    When heating goes off, pump should go off short after that to keep the heat in the floor.

    Back to topicstarter:
    1 solution could be:
    With motionsensor put socket on when entering the room.
    When socket not using >25W within like 2 min (laptops still off),shut socket down again.
    When socket is using >25W within 2 min (laptops on), stay on.
    When socket is not using >25W for like 10 min after that (laptops off again), shut the socket.
    Works if laptops are in a computer room.
    Just a thought.

    With <3

  • Back to topicstarter:
    1 solution could be:
    With motionsensor put socket on when entering the room.
    When socket not using >25W within like 2 min (laptops still off),shut socket down again.
    When socket is using >25W within 2 min (laptops on), stay on.
    When socket is not using >25W for like 10 min after that (laptops off again), shut the socket.
    Works if laptops are in a computer room.
    Just a thought.

    With <3
    Nice one @Rocodamelshe , I can work with this. Wanted to buy a Fibaro multi sensor anyway and now I have a reason ... :+1: 
  • JacobJacob Member
    Well, i mean:
    When boiler uses more then 25W then pump for floorheating is on, right?
    When <25W for 10 min then pump goes offline, right?
    When daugther taking a shower for like 45 min, boiler using >25W, pump for floorheating is on. Right?
    Does not sound like the best solution to me.
    Pump for floorheating should be on when heating is on.
    When heating goes off, pump should go off short after that to keep the heat in the floor

    @Rocodamelshe ;
    Boiler power < 25w AND delay 10 min = stop pump
    Water temp on manifold outlet > water temp on manifold inlet = start pump (heat demand)
    This is a saving, pump only runs when hot water is circulating

    Possible extention for you.
    Water temp of shower water > 30 deg C AND delay 15 min = close hot water Supply with solenoïde. Daugther learns a lesson. That is also a saving
  • Ok, now I get it  :)
  • For this purpose I'm looking for a way to send a HTTP PUT request upon Windows boot, so I can trigger a flow and switch the power on for the laptop that has just booted. Anyone know of a good way to do this?

    I know I can use the Windows Task Scheduler to start a task but I'm not quite sure how I can create a task for a HTTP PUT request.
  • casedacaseda Member
    edited May 2016
    @Phuturist ;
    Why don't you just put a shortcut in your startup folder to the get URL?
    I.E.:
    http://[IPHOMEY]/api/app/com.internet/[GETNAME]/[GETVALUE]
    value is of course optional

    your laptop will always start with a browser window open, but yeah, it is the most simple way.

    or if you want to be really fancy, start a local webpage (on the laptop itself) on startup with an iframe to the url and close the page automatically again with JavaScript. 

    EDIT: Just tried this code and works perfectly:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

    <html>

    <body onLoad="setTimeout(function() { window.close(); }, 10);">

    <iframe src="http://[IPHOMEY]/api/app/com.internet/[GETNAME]/[GETVALUE]"></iframe>

    </body>

    </html>

  • caseda said:
    @Phuturist ;
    Why don't you just put a shortcut in your startup folder to the get URL?
    I.E.:
    http://[IPHOMEY]/api/app/com.internet/[GETNAME]/[GETVALUE]
    value is of course optional

    your laptop will always start with a browser window open, but yeah, it is the most simple way.

    or if you want to be really fancy, start a local webpage (on the laptop itself) on startup with an iframe to the url and close the page automatically again with JavaScript.
    Because I want to use the added security autorization with the bearer token. Without it people who only know the URL can control your home. So just a simple HTTP request isnt going to cut it.
  • PhuturistPhuturist Member
    edited May 2016
    I decided to go with Powershell, it's just two line of code (and could even be one). I scheduled this script with the Windows Task Scheduler that calls the powershell script upon every boot.
    $headers = @{Authorization='Bearer <<your token here>>';}
    Invoke-RestMethod -Uri http://<<your ip here>>/api/app/net.i-dev.betterlogic/VARIABLE/VALUE -Method PUT -Headers $headers
    Now my laptop power automatically switches on when the laptop itself is started ... :-)
  • Phuturist said:
    I decided to go with Powershell, it's just two line of code (and could even be one). I scheduled this script with the Windows Task Scheduler that does calls the powershell script upon every boot.
    $headers = @{Authorization='Bearer <<your token here>>';}
    Invoke-RestMethod -Uri http://<<your ip here>>/api/app/net.i-dev.betterlogic/VARIABLE/VALUE -Method PUT -Headers $headers
    Now my laptop power automatically switches on when the laptop itself is started ... :-)
    Nice find!
    As a Microsoft consultant for an IT company there must be more nice things I can do with it  B)
  • Although I have this working pretty good there is still a little hickup that I'd like to solve. Perhaps the community has a good idea on how to solve this. The case is as following:

    I have a powershell script that is run through the Windows Task Scheduler when a user signs on. This powershell script does a request to Homey triggering a flow to switch on the Fibaro Wall Plug that powers my laptop. This all works well. I have another flow which checks the energy usage of the Fibaro Wall Plug with the condition that if the energy usage is below a certain output it will switch itself off. This output is set to the output where the laptop is switched off but where the laptop battery still consumes power (yes, laptop batteries do this). This also works well. So all in all I can switch on the power for my laptop at boot time and switch of this power after powering down my laptop to avoid standby power consumption.

    So where is the issue? Well, the laptop energy usage is not constant and spikes and drops constantly. It sometimes even drops below the standy power usage (could also be related to the power readings of the wall plug by Homey). When this happens the power to the laptop is switched while I'm actually working on it.

    So what I want is to have some extra condition that checks if the power usage is below a certain usage for a longer period of time. Something like "If wall plug power is below 1 watt for longer then 1 minute then switch of wall plug".

    I looked into the countdown app but I'm not sure if this can be used for this specific usecase. If so, perhaps someone can shed some light on how to configure the flows for this.
  • i think the countdown app is indeed the best option:
    1. when dropping below one watt, set timer 60 seconds.
    2. when getting higher then 5 watt (or whatever the minimal wattage is in use) then stop timer.
    3. if timer runs to 0 turn off wall plug
  • caseda said:
    i think the countdown app is indeed the best option:
    1. when dropping below one watt, set timer 60 seconds.
    2. when getting higher then 5 watt (or whatever the minimal wattage is in use) then stop timer.
    3. if timer runs to 0 turn off wall plug
    Thanx, did just that.
Sign In or Register to comment.