Ankündigung

Einklappen

Serverwartung 21.2.



Am 21.2. im Laufe des späten Abends wird eine Serverwartung durchgeführt. Das Forum ist dadurch für gut zwei Stunden nicht erreichbar.
Es wird eine Wartungsseite geschaltet.

Mehr anzeigen
Weniger anzeigen

Trying to make heating controler with logics.

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

    Trying to make heating controler with logics.

    Hello,

    I'm tring to manage my heating with logics.
    I try this but the scheduler didn t seem to work :

    Code:
    from datetime import date, datetime
    
    
    programmes = {
    	'P1': ['6h30','7h45','16h00','22h45'],
    	'P2': ['7h30','23h30']
    }
    
    zones = {
    	'Z1': ['salon','sam','cuisine'],
    	'Z2': ['chenfant','chparents']
    }
    
    sched = [
    	# LMMJVSDCAbs day of week + holidays => day mode on when * present else night mode
    	('-----***-', 'Z1', 'P1'),
    	('*----***-', 'Z2', 'P1')
    ]
    
    # Gestion du jour
    jour = date.today().weekday()
    
    if sh.system.conges:
    	jour = 7
    
    if sh.system.absence:
    	jour = 8
    
    # Parcours du sched
    for cron, zone, prog in sched:
    	if cron[jour] == '*':
    		# On applique le planing a la zone
    		status = True
    		for hour in programmes[prog]:
    			for room in zones[zone] :
    				h, m = map(int, hour.split('h'))
    				dt = sh.now().replace(hour = h, minute = m)
    				logger.info("***" +str(dt) +"***")
    				sh.trigger('ItemChange', value=(room +".temp.journuit", status), dt=dt)
    			status = not status
    Is it possible to schedule a logics several times ?
    Thanks a lot

    #2
    Have a look at

    Configuration ? SmartHome.py 1.0 documentation

    and

    Configuration ? SmartHome.py 1.0 documentation

    It's hard to understand your logic because I don't understand the language. But as far as I understood it, you could achieve the same thing by using crontab together with a value. With that, you could avoid to declare the time values in the logic itself. You even can combine several crontab entries with the pipe symbol '|'.

    hth
    Mit freundlichen Grüßen
    Niko Will

    Logiken und Schnittstelle zu anderen Systemen: smarthome.py - Visualisierung: smartVISU
    - Gira TS3 - iPhone & iPad - Mobotix T24 - ekey - Denon 2313 - Russound C5 (RIO over TCP Plugin) -

    Kommentar


      #3
      i can't use crontab and cycle, the value change all days (holidays, WE ...)
      so i should use sh.trigger ?

      i comment my code in english :

      Code:
      from datetime import date, datetime
      
      
      progs = {
              #the first hour always put mode day on radiator, second hour mode night etc ....
              'P1': ['6h30','7h45','16h00','22h45'],
              'P2': ['7h30','23h30']
      }
      
      zones = {
              #make zone for radiator
              'Z1': ['salon','sam','cuisine'],
              'Z2': ['chenfant','chparents']
      }
      
      sched = [
              # MTWTFSSH day of week + holidays => day mode on when * present else night mode
              ('-----***-', 'Z1', 'P1'),
              ('*----***-', 'Z2', 'P1')
      ]
      
      # day handle
      jour = date.today().weekday()
      
      if sh.system.conges: #if holidays but at home
              jour = 7
      
      if sh.system.absence: #if holidays not at home
              jour = 8
      
      # sched read
      for cron, zone, prog in sched:
              if cron[jour] == '*':
                      status = True
                      for hour in progs[prog]:
                              for room in zones[zone] :
                                      h, m = map(int, hour.split('h'))
                                      dt = sh.now().replace(hour = h, minute = m)
                                      logger.info("***" +str(dt) +"***")
                                      #schedule the change of heating on each radiator
                                      sh.trigger('ItemChange', value=(room +".temp.journuit", status), dt=dt)
                              status = not status
      Is it more understandable ?
      Thanks for your help

      Kommentar


        #4
        Ho my god ! It works

        i thinked it didn't work because the trigger was not listed in "lo" command

        i don't know where i can find the schedule action ?

        Kommentar

        Lädt...
        X