HomeSeer Script wanted

Squintz

Senior Member
I'm not gonna lie i could probably do this myself but i'm being lazy. So i figured i'd let you all know what i want and see if someone is nice enough to do it for me.

In the morning at 8am i have HomeSeer send an Off command to all my devices. This works for turning everything of but now im curious to know what was left on? So i want a script that will First poll all the devices and then log their status to the HS Log but only if the device status is ON. After it logs all the On devices i would like to have it turn all those devices Off.

Why do i want to know such information?
Because i like prove to my wife that if it were not for homeseer and all my little toys then she would be costing us $50 more in electricty bills each month. She loves to leave all the lights on in the house for the 9 hours shes away.
 
I think you need to go to drphil.com, not cocoontech lol, this is not a battle you want to start or win ;) I seriously doubt it would be 50 bucks too, and leaving the system up and running 24/7 for homeseer would probably undo any savings. Good luck!
 
Electron i have already proven the $50 savings part. I ran my PC all day long for one month without HS controlling my Z-wave Devices. The very next month I activated the Devices and watched the prices drop.

I thought to myself that maybe i got lucky and the AC wasnt comming on as much. So i tried it again and sure enough the bill was $50 higher. Not exactly $50 but very close.

Last month my electricty bill was $79. I dont think i have ever heard of a bill that low. The AC wasnt running last month all that much so this accouns for alot of the drop but on a month that the AC does run my bills can be as high as $170.

There are a few other things that could play a part in the bill such as the amount laundry we dried that month. I havent monitored the laundry very close but i think we do about the same amount each month. Its usually 3 or 4 loads a week sometimes more. Laundry is a never ending story at my house.

But just think about the numbers.

The lights that usually get left on are

Basement ( 6 X 60watt bulbs)
Basement Bath ( 6 X 60watt bulbs)
Master Bath ( 6 X 60 watt bulbs)
Laundry room ( 1 X 60 watt bulb)
Kitchen (1 florecent not sure of wattage)

Just the incadecents alone are 19 X 60 = 1140watts

If those lights are on for 9 hours a day for 30 days when they dont need to be then thats 307800watts. 307.8kwh.

At about 5 cents /kwh that comes out to be roughly $16 a month. Now i only listed the rooms with multiple lights. When you add the porch light and foyer. Dining room light. The third Bathroom which also has 6 lights in it which i forgot to mention. Plus the bathroom fans. The master bedroom halogen and probably some more that i forgot it can see where it easily adds up to $50 a month.

I also have those lights on timmers during the hours we are in the house so that the bathroom light turns off 20mins after its been turned on and same for the laundry room. It all adds up fast. I just cant wait until i can get a Z-wave thermostat because that might reduce it a few more bucks.

My PC can only draw 300watts max per hour and i doubt its using that much because i shut down the monitor (i know not related to the power supply but it does use more power rom the pc when the pc is sending a signal). I also sut down some of my external drives after a few minutes of now activity. I'm guessing my PC uses 250watts max while its active.

So are you gonna help me with the script or should i go see Dr. Phil?

Better yet i am probably better off seeing his son maybe ill get my whole house automated by smarthome. ;)
 
The problem with what you want tpo do is that whether the device can be polled or not is not exposed by HS to a scripting object. In other words, you can't just go down through all the devices and poll them, because if the device isn't a two-way device, it'll never answer the poll, and HS will change it's status to "Unknown" or 17.

The fact that a device IS or IS NOT pollable is not brought out to the scripting objects, so we cna't tell from a script whether we can poll the device or not. Yes, even in version 1.7.7, HS definitely has room for improvement.

So, we have two choices. Either go with the current status that HS has for each device, or create a list of the pollable devices and poll them, while using the current status for non-pollable devices not on that list.

I have a basic script that does go down through all X10 device codes and polls/pulls status of each device. It takes quite a while to run, since there are 256 devices and you must wait up to 8 seconds for the polled device to respond. I set it up to poll all existing devices first, wait 10 seconds, then go through the device list again and check the status. If you want that code, I can send it or upload it here.

You might even go so far as to figure out how long something's been on and how much that costs, based on the kwh rate and the last status change...

If someone knows how to get at the device polling setting, I can clean this up some.
 
I take that back, there is a way to get the info out through the getdevice call that returns a reference to the class, which can then be used to access the boolean value for the polling capability. I'll see if I can work that into my script.
 
Ok, here's the basic code. You can get more fancy if you want.

Code:
sub main()

'For all pollable devices, start a poll.  For high numbers of pollable devices, we may need
'to slow this down to avoid X10 signal collisions.

  devcnt = hs.devicecount
  for i=1 to devcnt
    set device=hs.getdevice(i)
    if device.status_support then hs.polldevice(device.hc & device.dc)
  next
  set device = nothing

'Pause for a few seconds to wait for all the polls to return.

  hs.waitsecs 10

'Now check to see if all devices are ON or in DIM state, and write log.

  devcnt = hs.devicecount
  for i=1 to devcnt
    set device=hs.getdevice(i)
    dev = device.hc & device.dc
    devstat = hs.devicestatus(dev)
    if hs.ison(dev) then hs.writelog "$$$$$$","Device " & dev & " is ON." & " Status is " & devstat & "."
  next
  set device = nothing

end sub
 
Thanks a ton huggy59. I'll try it as soon as i get home. I dont think we will need to slow it down because i am using Z-wave devices not X10. Signal collision isnt a problem.
 
Back
Top