motorvärmare startar aldrig

Moderators: hekj, Telldus

Post Reply
matsb70
Posts: 17
Joined: Thu Jan 18, 2018 11:08 am

motorvärmare startar aldrig

Post by matsb70 » Fri Oct 04, 2019 5:54 am

hej, jag måste missat någon liten detalj, men jag försöker få igång motorvärmarfunktionen. jag kör med en 433 termometer som temperaturkälla
Allt ser så bra ut men det kommer aldrig nån startevent...
har fyllt i så här: ( det som är fetat avviker från normala device)
Device
  • Level= blank
  • Watts= blank
  • Sensor value= fylls i av programmet "-0.4 (7:25)"
  • Timestamp= fylls i av programmet "2019-10-04 07:25 *"
  • Name= Motorvärmare
  • Max HH= 03
  • Max MM= 00
  • Id= 10
  • Zwave= blank
  • Grp/Neighbour= blank
  • Members / Type= blank
  • Function= sensor-
  • All= yes
  • Dimmable= no
  • Synchronize= no
  • Repeat= 3
  • Extender= no
  • Server URL= blank
  • Parameters= model:temperature;id:136;value:temp
  • On sensor result= 0:45
  • Off sensor result= blank
  • sensor default= -5
  • ON Sensor formula= < -20 # 02:00, < -15 # 1:45, < -10 # 1:30, < -5 # 1:15, < 0 # 0:45, < 12 # 0:30, >= 12 # 00:00
  • OFF Sensor formula= blank
  • Sensor path= blank
Events
  • *ON*
  • event=14
  • active= yes
  • Device= Motorvärmare
  • Cmd= On
  • Level= blank
  • HH=07
  • MM=00
  • default= yes
  • Function= blank
  • -MM= blank
  • +MM= blank
  • CMD group=defa
  • monday-friday=yes
  • +mode/attr=blank
  • -mode/attr=blank
  • start date=blank
  • stop date=blank
  • *OFF*
  • event=15
  • active= yes
  • Device= Motorvärmare
  • Cmd= Off
  • Level= blank
  • HH=07
  • MM=25
  • default= no
  • Function= blank
  • -MM= blank
  • +MM= blank
  • CMD group=defa
  • monday-friday=yes
  • +mode/attr=blank
  • -mode/attr=blank
  • start date=blank
  • stop date=blank
vad kan jag ha glömt?

(edit stavfel)

hekj
Posts: 992
Joined: Thu Jan 18, 2018 11:08 am
Location: Stockholm
Contact:

Re: motorvärmare startar aldrig

Post by hekj » Tue Oct 22, 2019 6:43 pm

Nu är det ett tag sedan jag höll på med motorvärmaren men vad jag kan se så borde det fungera, du får både 'Sensor value' och 'On sensor result' ifyllt av programmet.

Hittar du något i console.<datum>.log filen när du söker efter texten "Motorvärmare"?

matsb70
Posts: 17
Joined: Thu Jan 18, 2018 11:08 am

Re: motorvärmare startar aldrig

Post by matsb70 » Tue Nov 05, 2019 5:43 am

Nej, inget särskilt syns runt den här tiden, bara att 'OFF' eventet körs.
går det att höja loggnivån på något sätt ?

Code: Select all

2019-11-04 05:45:02 :ON: Turning on device: 14 Kontor - ok
2019-11-04 05:45:03 :ON: Turning on device: 4 Kitchen - ok
2019-11-04 07:05:02 :OFF: Turning off device: 14 Kontor - ok
2019-11-04 07:20:02 :OFF: Turning off device: 4 Kitchen - ok
2019-11-04 07:25:02 :OFF 1(4): Turning off device: 10 Motorvärmare - ok
2019-11-04 07:25:03 :OFF 2(4): Turning off device: 10 Motorvärmare - ok
2019-11-04 07:25:03 :OFF 3(4): Turning off device: 10 Motorvärmare - ok
2019-11-04 07:25:04 :OFF 4(4): Turning off device: 10 Motorvärmare - ok
2019-11-04 14:57:02 :ON: Turning on device: 14 Kontor - ok

marieper
Posts: 21
Joined: Thu Jan 18, 2018 11:08 am

Re: motorvärmare startar aldrig

Post by marieper » Thu Nov 28, 2019 11:28 pm

Behövs inte Timern (dummy) och bsh-scripten?

Det har iaf jag på mina två motorvärmare... MV2 har snarlika värden som du har, MV2 (timer) har allt blankt förutom Parameter enligt nedan

MV2
Id=9
MV2 (timer)
Id=10
All:true
Parameter: dummy:yes

9.bsh

Code: Select all

    device = "9";
    import java.text.SimpleDateFormat;
    error = false;
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
    timestamp = sdf.format(Calendar.getInstance().getTime());
    this_status = (deviceIsOn(device) ? ":ON:" : ":OFF:");
    this_event = "<tr><td>" + timestamp + " " + this_status + "</tr></td>";
    previous_event = getData("car_heater_event");
    if (previous_event == null) {
       previous_event = "";
    }
    if (!this_event.equals(previous_event) && previous_event.indexOf(this_status) == -1) {
       car_heater_events = getData("car_heater_events");
       if (car_heater_events == null) {
          car_heater_events = "";
       }
       String[] events = car_heater_events.split("\t");
       if (events.length >= 6) {
          pos = car_heater_events.lastIndexOf("\t");
         car_heater_events = car_heater_events.substring(0, pos);
       }
       if (car_heater_events.length() != 0) {
          car_heater_events = "\t" + car_heater_events;
       }
       car_heater_events = this_event + car_heater_events;
       setData("car_heater_events", car_heater_events);
    //echo(car_heater_events);   
       try {
          file = "/home/pi/nexahome/car2_heater.log";
          FileWriter fw = new FileWriter(file, false);
          BufferedWriter out = new BufferedWriter(fw);
          out.write(car_heater_events.replace('\t', ' '));
          out.close();
       } catch (Exception e) {
          error = true;
          echo("Error: " + e.getMessage());
       }
       setData("car_heater_event", this_event);
    }
    if (!error) {
       hideOutput();
    }
10.bsh

Code: Select all

    car_check_device = "10";
    car_heater_device = "9";
    timer = "car2";
    import java.text.SimpleDateFormat;
    import java.text.ParsePosition;
    if (deviceIsOn(car_check_device)) {
       car_on = getData("car2_on");
       car_minutes = getData("car2_minutes");
       if (car_on != null) {
          boolean add = car_on.startsWith("+");
          if (add) {
             car_on = car_on.substring(1);
          }
          Calendar cal = Calendar.getInstance();
          SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
          Date date = sdf.parse(car_on, new ParsePosition(0));
          if (date != null) {
             if (add) {
                cal.add(Calendar.HOUR_OF_DAY, date.getHours());
                cal.add(Calendar.MINUTE, date.getMinutes());
             } else {
                if (date.getHours() < cal.get(Calendar.HOUR_OF_DAY)
                   || (date.getHours() == cal.get(Calendar.HOUR_OF_DAY)
                      && date.getMinutes() < cal.get(Calendar.MINUTE))) {
                   cal.add(Calendar.DAY_OF_YEAR, 1);
                }
                cal.set(Calendar.HOUR_OF_DAY, date.getHours());
                cal.set(Calendar.MINUTE, date.getMinutes());
             }
             long power_on = cal.getTime().getTime();
             if (car_minutes == null || car_minutes.length() == 0) {
                car_minutes = "60";
             }
             long power_off = power_on + (Integer.parseInt(car_minutes) * 60 * 1000);
             setData("car2_power_on", "" + power_on);
             setData("car2_power_off", "" + power_off);
             setData("#DATA#car2_text#", sdf.format(cal.getTime()) + " (" + car_minutes + ")");
          }
       }
       if (!timerIsRunning(timer)) {
          startTimer(timer, 60);
       }
    } else {
       setData("car2_power_on", "");
       setData("car2_power_off", "");
       setData("#DATA#car2_text#", "");
       if (timerIsRunning(timer)) {
          stopTimer(timer);
       }
       if (deviceIsOn(car_heater_device)) {
          deviceOff(car_heater_device);
       }
    }
car2.bsh

Code: Select all

    car2_check_device = "10";
    car2_heater_device = "9";
    timer = "car2";
    if (deviceIsOn(car2_check_device)) {
       car_power_on = getData("car2_power_on");
       car_power_off = getData("car2_power_off");
       if (car_power_on != null && car_power_on.length() != 0
             && car_power_off != null && car_power_off.length() != 0) {
          long power_on = Long.parseLong(car_power_on);
          long power_off = Long.parseLong(car_power_off);
          Calendar cal = Calendar.getInstance();
          long now = cal.getTime().getTime();
          if (now >= power_on && deviceIsOff(car2_heater_device)) {
             deviceOn(car2_heater_device);
             setData("#DATA#car2_text#", "(" + Math.round((power_off - now) / 60000) + ")");
             startTimer(timer, 60);
          } else if (now >= power_off && deviceIsOn(car2_heater_device)) {
             deviceOff(car2_check_device);
          } else if (deviceIsOn(car2_heater_device)) {
             long left = Math.round((power_on - now) / 60000);
             long right = Math.round((power_off - now) / 60000) + 1;
             setData("#DATA#car2_text#", "(" + left + "/" + right + ")");
             startTimer(timer, 60);
             hideOutput();
          } else {
             startTimer(timer, 60);
             hideOutput();
          }
       }
    }

Post Reply