timeupdater.py 文件源码

python
阅读 29 收藏 0 点赞 0 评论 0

项目:pknx 作者: open-homeautomation 项目源码 文件源码
def send_updates(self):
        """ Send updated to the KNX bus. """
        d = datetime.now()
        if self.timeaddr:
            self.tunnel.group_write(self.timeaddr,
                                    time_to_knx(d))

        if self.dateaddr:
            self.tunnel.group_write(self.dateaddr,
                                    date_to_knx(d))

        if self.datetimeaddr:
            self.tunnel.group_write(self.datetimeaddr,
                                    datetime_to_knx(d))

        if self.daynightaddr:
            from pysolar.solar import get_altitude
            alt = get_altitude(self.lat, self.long, d)
            if alt > 0:
                self.tunnel.group_write(self.daynightaddr, 1)
            else:
                self.tunnel.group_write(self.daynightaddr, 0)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号