Author Topic: UI7 - Thermostat device not updating current temp  (Read 1614 times)

Offline alekseyzp

  • Newbie
  • *
  • Posts: 10
  • Karma: +0/-0
Re: UI7 - Thermostat device not updating current temp
« Reply #15 on: March 27, 2017, 10:59:31 am »
Thanks for quickly reply/
I did not fully understand.
Sorry, please, but you can tell by the steps.
I must:
1. Create a scene: select a temperature sensor. etc..?
2. Or just add the above code? But i am need to specify the scene ID in it. I am dont have a scene.

Code: [Select]
luup.variable_watch("callSceneCopyTemp","urn:upnp-org:serviceId:TemperatureSensor1","CurrentTemperature", 13)
function callSceneCopyTemp()
   luup.call_action("urn:micasaverde-com:serviceId:HomeAutomationGateway1", "RunScene", {SceneNum = <Your scene ID/Number goes here>}, 0)
end

13 - child temp sensor

How to do everything correctly?
Once again I'm sorry.
« Last Edit: March 27, 2017, 11:03:29 am by alekseyzp »

Offline Thorden

  • Jr. Member
  • **
  • Posts: 70
  • Karma: +5/-5
Re: UI7 - Thermostat device not updating current temp
« Reply #16 on: March 27, 2017, 11:10:51 am »
Yes, you must create a scene. This scene does not contain anything else than what you wrote in your file PollingTS10temp.lua
You simply put the code in the scene section Also, execute the following Luup code:

Then you get a Scene ID, all scenes have it, just like devices have their ID's. You see it right next to the scene name when you list your scenes in the GUI.
You use this Scene ID in the startup Lua section.

Offline alekseyzp

  • Newbie
  • *
  • Posts: 10
  • Karma: +0/-0
Re: UI7 - Thermostat device not updating current temp
« Reply #17 on: March 27, 2017, 11:26:34 am »
I'm even more confused.

I have not added anything to Vera (no files, I created the file PollingTS10temp.lua for an example).

I also do not have any scenes.
Code: [Select]
<sections>
<section name="My Home" id="1"/>
</sections>
<rooms/>
<scenes/>
<devices>
<device name="Air cond Power" altid="e2" id="12" category="4" subcategory="0" room="0" parent="10" watts="4"/>
<device name="Air cond Temp" altid="e3" id="13" category="4" subcategory="0" room="0" parent="10" temperature="17.18"/>
<device name="Air Conditioner" altid="5" id="10" category="5" subcategory="1" room="0" parent="1" fanmode="Auto" hvacstate="Idle" mode="Off" setpoint="15" heat="15" cool="15" temperature="17.12" watts="4" state="-1" comment=""/>
<device name="Appliance Module" altid="e1" id="5" category="3" subcategory="0" room="0" parent="4" status="0"/>
<device name="Dimmer" altid="2" id="3" category="2" subcategory="0" room="0" parent="1" status="0" level="0" state="-1" comment=""/>
<device name="Switch 1" altid="3" id="4" category="3" subcategory="0" room="0" parent="1" status="0" state="-1" comment=""/>
<device name="Switch 2" altid="e2" id="6" category="3" subcategory="0" room="0" parent="4" status="0"/>
<device name="Thermostat" altid="e1" id="11" category="5" subcategory="1" room="0" parent="10" fanmode="Auto" mode="Off"/>
<device name="Thermostat 1" altid="e1" id="8" category="5" subcategory="1" room="0" parent="7" hvacstate="Idle" mode="Off" setpoint="18.00" heat="18.00" cool="18.00" temperature="15.87"/>
<device name="Warm Floor" altid="4" id="7" category="5" subcategory="1" room="0" parent="1" hvacstate="Idle" mode="Off" setpoint="18.00" heat="18.00" cool="18.00" temperature="15.87" state="-1" comment=""/>
<device name="Warm floor Temp" altid="e2" id="9" category="4" subcategory="0" room="0" parent="7" temperature="15.87"/>
</devices>
<categories>
<categorie name="Dimmable Switch" id="2"/>
<categorie name="On/Off Switch" id="3"/>
<categorie name="Sensor" id="4"/>
<categorie name="Thermostat" id="5"/>
</categories>
</root>
1. How should the contents of the file PollingTS10temp.lua be correct? Or it does not need to create and add to Vera?

2. If the file PollingTS10temp.lua does not need to be added.
I have to create a scene, but what device to choose when creating a scene?

Thanks.

Offline Thorden

  • Jr. Member
  • **
  • Posts: 70
  • Karma: +5/-5
Re: UI7 - Thermostat device not updating current temp
« Reply #18 on: March 27, 2017, 11:57:24 am »
The code you wrote in the file is fine, just use it. You use code in a scene, just like I told you. Not in the file, you use it in the scene. I told you where. Just create the scene like I said, and place the code where I told you to, ok?

Here is what it does:
1) local CurrentTemp = luup.variable_get("urn:upnp-org:serviceId:TemperatureSensor1", "CurrentTemperature", 13)
This picks up the current temperature reading from the device with device ID 13 and stores it in a local variable

2) luup.variable_set("urn:upnp-org:serviceId:TemperatureSensor1", "CurrentTemperature", CurrentTemp, 10)
This takes the content of the local variable above, and updates it to the device with device ID 10.

In other words: It copies the temperature reading from the child temp sensor to the father thermostat device. Given they have ID 13 and 10 respectively of course.

This is the only thing your scenes does. Nothing else needed. No devices to be selected, no triggers, nothing, just code. The code runs when the scene does.

If you do the Startup Lua correctly, the scene will run whenever the temperature from device with ID 13 changes. Very easy.
 

Offline alekseyzp

  • Newbie
  • *
  • Posts: 10
  • Karma: +0/-0
Re: UI7 - Thermostat device not updating current temp
« Reply #19 on: March 27, 2017, 03:00:32 pm »
All the same, I did not understand anything about the procedure for creating the Scene. (Newbie)

1. I managed to create a Scene "SceneCopyTemp", but only with a 30 second interval. I put the code in the scene section: Also, execute the following Luup code:
Code: [Select]
local CurrentTemp = luup.variable_get("urn:upnp-org:serviceId:TemperatureSensor1", "CurrentTemperature", 13)
luup.variable_set("urn:upnp-org:serviceId:TemperatureSensor1", "CurrentTemperature", CurrentTemp, 10)
2. This Scene works every 30 sec.
3. How now to remove the 30 sec schedule, and make do it to, that the scene will run whenever the temperature from device with ID 13 changes.

Thanks.
« Last Edit: March 27, 2017, 03:05:46 pm by alekseyzp »

Offline Thorden

  • Jr. Member
  • **
  • Posts: 70
  • Karma: +5/-5
Re: UI7 - Thermostat device not updating current temp
« Reply #20 on: March 27, 2017, 03:19:35 pm »
Just remove the schedule from the scene completely and save the scene. Se picture. You need to go through all the steps of the scene to save it ("Next step" button).

Then perform the exact changes to Lua startup as I explained very detailed above. Your Scene ID is 1.
As I already explained, this will watch the temp sensor value continuously and execute the scene #1 every time it changes.

Offline alekseyzp

  • Newbie
  • *
  • Posts: 10
  • Karma: +0/-0
Re: UI7 - Thermostat device not updating current temp
« Reply #21 on: March 27, 2017, 03:42:13 pm »
After I delete the schedule, the button "Next step" becomes inactive. What to do in this case?
« Last Edit: March 27, 2017, 03:43:55 pm by alekseyzp »

Offline Thorden

  • Jr. Member
  • **
  • Posts: 70
  • Karma: +5/-5
Re: UI7 - Thermostat device not updating current temp
« Reply #22 on: March 27, 2017, 03:43:54 pm »
Select that the scene is manual

Offline alekseyzp

  • Newbie
  • *
  • Posts: 10
  • Karma: +0/-0
Re: UI7 - Thermostat device not updating current temp
« Reply #23 on: March 27, 2017, 03:53:40 pm »
Select that the scene is manual and save the scene.

Here's how:
1) Go to Apps/Develop Apps/Edit Startup Lua
2) Add this code:

Code: [Select]
luup.variable_watch("callSceneCopyTemp","urn:upnp-org:serviceId:TemperatureSensor1","CurrentTemperature",13)
function callSceneCopyTemp()
   luup.call_action("urn:micasaverde-com:serviceId:HomeAutomationGateway1", "RunScene", {SceneNum = 1}, 0)
end

Reboot.

Now:

Offline alekseyzp

  • Newbie
  • *
  • Posts: 10
  • Karma: +0/-0
Re: UI7 - Thermostat device not updating current temp
« Reply #24 on: March 28, 2017, 04:59:06 am »
Hi @Thorden

Yes, this solution works well.
Thank you very much for your help.

I will follow the news in the subject.