Ankündigung

Einklappen
Keine Ankündigung bisher.

Trying to make heating controler with logics.

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

  • chrissou
    antwortet
    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 ?

    Einen Kommentar schreiben:


  • chrissou
    antwortet
    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

    Einen Kommentar schreiben:


  • 2ndsky
    antwortet
    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

    Einen Kommentar schreiben:


  • chrissou
    hat ein Thema erstellt Trying to make heating controler with logics..

    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
Lädt...
X