Mercurial > code > home > repos > homeauto
comparison service/reasoning/actions.py @ 280:c192d37b2bc8
lots of logging updates (patch may be imprecise)
Ignore-this: cfe81299fe9a1e2b6b1140e9ec46aaf7
author | drewp@bigasterisk.com |
---|---|
date | Fri, 06 May 2016 17:32:41 -0700 |
parents | 570b0e73d2bc |
children | b069bb37f817 |
comparison
equal
deleted
inserted
replaced
279:57c9dbd2fdd0 | 280:c192d37b2bc8 |
---|---|
51 | 51 |
52 inferredObjects = list(inferred.objects(dev, pred)) | 52 inferredObjects = list(inferred.objects(dev, pred)) |
53 if len(inferredObjects) == 0: | 53 if len(inferredObjects) == 0: |
54 self._putZero(deviceGraph, dev, pred, url) | 54 self._putZero(deviceGraph, dev, pred, url) |
55 elif len(inferredObjects) == 1: | 55 elif len(inferredObjects) == 1: |
56 log.debug('inferredObject: %r', inferredObjects[0]) | 56 log.debug('inferredObject: %s %s %r', |
57 deviceGraph.qname(dev), | |
58 deviceGraph.qname(pred), | |
59 inferredObjects[0]) | |
57 self._putInferred(deviceGraph, url, inferredObjects[0]) | 60 self._putInferred(deviceGraph, url, inferredObjects[0]) |
58 elif len(inferredObjects) > 1: | 61 elif len(inferredObjects) > 1: |
59 log.info("conflict, ignoring: %s has %s of %s" % | 62 log.info("conflict, ignoring: %s has %s of %s" % |
60 (dev, pred, inferredObjects)) | 63 (dev, pred, inferredObjects)) |
61 # write about it to the inferred graph? | 64 # write about it to the inferred graph? |
166 HTTP PUT to putUrl, with a payload that's either obj's :putValue | 169 HTTP PUT to putUrl, with a payload that's either obj's :putValue |
167 or obj itself. | 170 or obj itself. |
168 """ | 171 """ |
169 value = deviceGraph.value(obj, ROOM.putValue) | 172 value = deviceGraph.value(obj, ROOM.putValue) |
170 if value is not None: | 173 if value is not None: |
171 log.info("put %s to %s", value, putUrl) | |
172 self._put(putUrl, payload=str(value)) | 174 self._put(putUrl, payload=str(value)) |
173 elif isinstance(obj, Literal): | 175 elif isinstance(obj, Literal): |
174 log.info("put %s to %s", obj, putUrl) | |
175 self._put(putUrl, payload=str(obj)) | 176 self._put(putUrl, payload=str(obj)) |
176 else: | 177 else: |
177 log.warn("don't know what payload to put for %s. obj=%r", | 178 log.warn("don't know what payload to put for %s. obj=%r", |
178 putUrl, obj) | 179 putUrl, obj) |