Creating slider for heating control (values send to shell script)

slider
heating
bash
Tags: #<Tag:0x00007f182f396c20> #<Tag:0x00007f182f396ab8> #<Tag:0x00007f182f396900>

(Ben Sen) #1

Hi,

facing another problem, want to control me heating, but the only way ist to execute a bash script with temperature value, but how i get it controlled in HABPanel which sends the selected value to the script ?

The script for setting the temperature looks like:
python3 homematicip_cli.py --group d0be45b0-a5f9-4112-b799-de78270c535a --set-point-temperature 22

i guess the value should stand in a variable, but don’t know how should i begin.

many thanks in advance


(Kevin) #2

Catch the Slider State/Value via REST Api to a Variable… and set this Var in your python command.

A Rule with the Slider as trigger execute the BashScript


(Ben Sen) #3

Thanxs for the hint, but as newbie i thinks that doesnt help me alot :slight_smile: , a example would be great than i can adapt.


(Ben Sen) #4

Can somebody create a working example with my named script ?


(Kevin) #6

Here is my Example …

Rule:

rule"Lautstärke Airplay Wohnzimmer einstellen"
when
  Item AP_Volume_Wohnzimmer changed
then
  if (AP_Status_Wohnzimmer.state == ON) {
    executeCommandLine("/etc/openhab2/scripts/oh_itunes-api.sh " + "volume "+ AP_Volume_Wohnzimmer.state + " 18-ee-69-20-a6-2a")
  }
  else {
    AP_Volume_Wohnzimmer.postUpdate(0)
  }
end

Perhaps this works for you:

rule"temperature_control"
when
  Item temperature_item changed
then
  executeCommandLine("python3 homematicip_cli.py --group d0be45b0-a5f9-4112-b799-de78270c535a --set-point-temperature " + temperature_item.state)
end

(Ben Sen) #7

Thx, tried it, but the rule didnt worked.

If i save the rule file:
21:38:39.188 [WARN ] [del.core.internal.ModelRepositoryImpl] - Configuration model ‘temperature_slider.rules’ is either empty or cannot be parsed correctly!
21:38:39.318 [WARN ] [del.core.internal.ModelRepositoryImpl] - Configuration model ‘temperature_slider.rules’ has errors, therefore ignoring it: [3,3]: no viable alternative at input ‘item’

Rulefile like you said:
rule"hmip_temperature_control_az"
when
item hmip_az_temperature changed
then
executeCommandLine(“python3 /home/pi/homematicip-rest-api/homematicip_cli.py --group d0be45b0-a5f9-4112-b799-de78270c535a --set-point-temperature + hmip_az_temperature.state”)
end

i created a item for the temperature
Number hmip_az_temperature “Arbeitszimmer Temperatur Control [%.1f °C]” (gHMIPTemps) { channel=“homematicip:sensors:temps:aztempcontrol”}

Slider itself is working, but value is from 1 - 100 which makes not much sense, can i set a range ?


(Kevin) #8

No … Slider is 0-100…

Use setPoint…

https://openhabdoc.readthedocs.io/de/latest/setpoint/


(Kevin) #9

Perhaps hmip_az_temperature.state.toString or toInteger ?

I can‘t test it… because i use the Offiziell Binding and no undokument API …


(Kevin) #10

Wrong!

item hmip_az_temperature changed

Right!

Item  hmip_az_temperature changed

(Ben Sen) #11

Yes used the setPoint, but didnt realy satisfy me, you didnt see a number, only if you are done with pressing… some more guessing … in HABPanel it looks better with the slider, but dont work that good on a smartphone


(Ben Sen) #12

Yes i know not that fancy, but the only working way without buying a ccu2 and using the HomematicIP Gateway.

Tried both still didnt worked:
rule"hmip_temperature_control_az"
when
Item hmip_az_temperature changed
then
executeCommandLine(“python3 /home/pi/homematicip-rest-api/homematicip_cli.py --group d0be45b0-a5f9-4112-b799-de78270c535a --set-point-temperature + hmip_az_temperature.state.toInteger”)
end

23:15:32.068 [WARN ] [del.core.internal.ModelRepositoryImpl] - Configuration model ‘temperature.rules’ is either empty or cannot be parsed correctly!