Author Topic: Pull house mode status?  (Read 2016 times)

Offline aidem

  • Newbie
  • *
  • Posts: 8
  • Karma: +0/-0
Pull house mode status?
« on: April 10, 2015, 02:47:57 pm »
I've been working on a relative big project. To control my house with stationary android tabs I've built scenes with tasker and autovera. Checking status of lamps, temperature & humidity and door-locks. I even got it to log temp and humidity into a textfile for later analyses. But I've been struggling with house modes. I installed House mode plugin to control which mode to switch to but i cant check witch mode my vera is in.
Is there any way to do this and use the status to change a scene?

Offline mastertobias

  • Newbie
  • *
  • Posts: 14
  • Karma: +0/-0
Re: Pull house mode status?
« Reply #1 on: April 23, 2015, 04:48:52 am »
Make a virtual switch for each Mode and use those combined in scenes with Housemode plugin to get your updates.
Example: Make a switch and call it Home_mode, In the modes make set it to off in all modes except in Home.Make a Scene where switch is turned on it triggers the House mode Plugin to change to Home.  Then you can get status update from that switch.
ask if you need better explanation.

maybe you can help me with how you get temperature in to a scene, cant figure that one out. im using autovera with Tasker.

Offline aidem

  • Newbie
  • *
  • Posts: 8
  • Karma: +0/-0
Re: Pull house mode status?
« Reply #2 on: May 05, 2015, 07:38:53 pm »
Thanks. That did help. There is one problem as I see it. The virtual switches is easy to change and in that way causing problem.
Anyway getting more familiar to PLEG I think I got a better solution now. With Pleg I can check the current status of the House Mode Plugin variable HMode (1,2,3 or 4 ) and set a variable in the plugin "Multistring". Autovera can read this variable and act to the value.
The multistring isn't as easy as a switch to change therefore I think it's more reliable + I don't need more than one variable-container

About the temperature in a scene. ( Mayby this should be in a own tread.)
In a scene you have to have a textbox.
Then create a task. For ex. Check temp
1. Autovera device info.
2. Element text. ( Choose scene and textbox. And in the field Text you type: %avtemperature()
I even added a degrees symbol after like this: %avtemperature()?

EDIT: The degree symbol won't appear correct in the forum. On a pc you get the symbol by pressing and hold Alt and type 0176 on the numpad
« Last Edit: May 06, 2015, 07:55:06 am by aidem »

Offline asdf1nit

  • Newbie
  • *
  • Posts: 14
  • Karma: +2/-0
Re: Pull house mode status?
« Reply #3 on: December 16, 2016, 11:49:38 pm »
I know it's a little late but there actually is a way(or 2) so I'll reference it here to help others.

First you can get the status of your device by posting this with your vera ip and house mode plugin device number:

http://ipaddr:3480/data_request?id=variableget&DeviceNum=119&serviceId=urn:micasaverde-com:serviceId:HouseModes1&Variable=HMode

It will return a number that directly corresponds to a mode. These are:

1=Home
2=Away
3=Night
4=Vacation

Now to get this information in auto vera, since we know the variable name we need( HMode) You'll need to edit your I_AutoVera.xml and add the following under the section "function startup(lul_device)":

Code: [Select]
--Category 22: House Modes
if luup.device_supports_service('urn:micasaverde-com:serviceId:HouseModes1',k) then
luup.variable_watch('w_switch','urn:micasaverde-com:serviceId:HouseModes1','HMode',k)
end

After you upload it reboot vera, then go to your auto vera app, refresh devices and toggle updates for house modes. Next create a profile that reacts to status updates of your house modes plugin, go under advanced, Variable name, and set it to HMode then back out and create your task. You'll have an %avvariable available to you in the variables section of an IF statement or and other action that lets you.

Now you can write your task using if %avvariable eq 1 elseif structure.

And I guess if your really crafty with tasker you could skip all of the auto vera stuff and just post to the URL above and save the output to a variable. Then write your task around that, it would just need to trigger often to stay updated and only work locally.
« Last Edit: December 16, 2016, 11:53:02 pm by asdf1nit »

Offline RHCPNG

  • Sr. Newbie
  • *
  • Posts: 20
  • Karma: +2/-0
Re: Pull house mode status?
« Reply #4 on: November 04, 2017, 11:21:24 am »
I know it's a little late but there actually is a way(or 2) so I'll reference it here to help others.

First you can get the status of your device by posting this with your vera ip and house mode plugin device number:

http://ipaddr:3480/data_request?id=variableget&DeviceNum=119&serviceId=urn:micasaverde-com:serviceId:HouseModes1&Variable=HMode

It will return a number that directly corresponds to a mode. These are:

1=Home
2=Away
3=Night
4=Vacation

Now to get this information in auto vera, since we know the variable name we need( HMode) You'll need to edit your I_AutoVera.xml and add the following under the section "function startup(lul_device)":

Code: [Select]
--Category 22: House Modes
if luup.device_supports_service('urn:micasaverde-com:serviceId:HouseModes1',k) then
luup.variable_watch('w_switch','urn:micasaverde-com:serviceId:HouseModes1','HMode',k)
end

After you upload it reboot vera, then go to your auto vera app, refresh devices and toggle updates for house modes. Next create a profile that reacts to status updates of your house modes plugin, go under advanced, Variable name, and set it to HMode then back out and create your task. You'll have an %avvariable available to you in the variables section of an IF statement or and other action that lets you.

Now you can write your task using if %avvariable eq 1 elseif structure.

And I guess if your really crafty with tasker you could skip all of the auto vera stuff and just post to the URL above and save the output to a variable. Then write your task around that, it would just need to trigger often to stay updated and only work locally.

Thanks for your solution. The only thing that doesn?t work for me in your first solution, is that my icon does not toggle with this setup. I tested the same solution with a virtual switch and a state change (in contrast to a variable change)

Did this work for you? Or can you maybe test it for me?

UPDATE
Ok, I managed to get it working! Only with a virtual switch though, not with the variable change of the Home Mode plugin. The icon toggling is really really buggy. At least on my Samsung Galaxy S7.

Ps. The ?Continue after error? checkmark is also important to get it working.

It would have been nice if the toggling wasn?t so buggy. Changing a task breaks the functionality sometimes and when you restore the changes, then it will not work anymore and you have to start over.

Someone got it working with the Home Mode plugin?
« Last Edit: November 05, 2017, 11:05:38 am by RHCPNG »