# Analog Clock demo help

**URL:** <https://community.info-beamer.com/t/analog-clock-demo-help/869>\
**Category:** How-to and Tutorials\
**Created:** [April 29, 2020, 10:59am UTC](https://community.info-beamer.com/t/analog-clock-demo-help/869 "2020-04-29T10:59:46Z")\
**Posts on this page:** 6\
**Page:** 2

<div class="post-metadata">

**Author:** ![Wassini](https://community.info-beamer.com/user_avatar/community.info-beamer.com/wassini/32/203_2.png) [@Wassini](https://community.info-beamer.com/u/Wassini)\
**Post date:** [May 1, 2020, 12:08pm UTC](https://community.info-beamer.com/t/analog-clock-demo-help/869/22 "2020-05-01T12:08:21Z")

</div>

It from this: [https://github.com/info-beamer/package-screen-info/blob/master/node.lua](https://github.com/info-beamer/package-screen-info/blob/master/node.lua)

Apparently I haven’t figured out how Info-Beamer is working. I haven’t implemented the “service” for this. I thought it was something standard in Lua.  
So let me get this right. If I want to use the “util.data\_mapper” - I also need to implement something in the “service” file - and not in the “clock.py” file?

---

<div class="post-metadata">

**Author:** ![infobeamer-fw](https://community.info-beamer.com/user_avatar/community.info-beamer.com/infobeamer-fw/32/3_2.png) [@infobeamer-fw](https://community.info-beamer.com/u/infobeamer-fw)\
**Post date:** [May 1, 2020, 12:23pm UTC](https://community.info-beamer.com/t/analog-clock-demo-help/869/23 "2020-05-01T12:23:59Z")

</div>

> [@Wassini](#):
>
> So let me get this right. If I want to use the “util.data\_mapper” - I also need to implement something in the “service” file - and not in the “clock.py” file?

Not quite. Let me explain: info-beamer (the process on each Raspberry Pi) always opens up a local UDP/TCP listen socket on port 4444. This allows other local processes to send data to the running info-beamer process. This can be useful as info-beamer (again, the process) itself cannot, for example, contact any outside service on its own. So it needs to be fed additional non-static data in some way. Using UDP/TCP for that is one way to do that.

Now there are various ways you can do that: If you open the info-beamer port to other machines on the network ([here](https://info-beamer.com/doc/device-configuration#exposeinfobeamerports) for how to do that, but doing so it usually not recommended as there’s no authentication in any way), another program on another machine can send data. That’s what my `netcat` call in my previous post did. Another way is to use the [device command API call](https://info-beamer.com/doc/api#devicecommand), which essentially allows you to send such UDP packets from anywhere using the API.

The final method is to have a local [package service](https://info-beamer.com/doc/package-services) running on each Pi. This isn’t something magic: It’s just that any file named `service` within a package will be marked executable and will be executed on the Pi when installing that package. Such a package service can be written Python, like [this one in the repository you linked](https://github.com/info-beamer/package-screen-info/blob/master/service). Such a service can also send UDP packets locally to the info-beamer process by sending data to `127.0.0.1:4444`.

---

<div class="post-metadata">

**Author:** ![Wassini](https://community.info-beamer.com/user_avatar/community.info-beamer.com/wassini/32/203_2.png) [@Wassini](https://community.info-beamer.com/u/Wassini)\
**Post date:** [May 1, 2020, 12:28pm UTC](https://community.info-beamer.com/t/analog-clock-demo-help/869/24 "2020-05-01T12:28:15Z")

</div>

AH! That’s why the clock is not working. The demo code ([https://github.com/dividuum/info-beamer-nodes/tree/master/analogclock](https://github.com/dividuum/info-beamer-nodes/tree/master/analogclock)) contains a “clock.py” and not a “service” file 🙂

---

<div class="post-metadata">

**Author:** ![infobeamer-fw](https://community.info-beamer.com/user_avatar/community.info-beamer.com/infobeamer-fw/32/3_2.png) [@infobeamer-fw](https://community.info-beamer.com/u/infobeamer-fw)\
**Post date:** [May 1, 2020, 12:31pm UTC](https://community.info-beamer.com/t/analog-clock-demo-help/869/25 "2020-05-01T12:31:36Z")

</div>

Yep. That’a also from a time when info-beamer hosted didn’t exist yet. So there was no convention on how anything outside of info-beamer or its Lua code should be named. The `service` name and the special handling that ensured that such a file is executed on a Pi was added to hosted.

If you run [info-beamer pi](https://info-beamer.com/product/info-beamer-pi) on Raspbian, you can of course name those scripts any way you want, but that’s it’s up to you to ensure they are executed somehow. As that’s boring, info-beamer hosted solves that for you 🙂

---

<div class="post-metadata">

**Author:** ![Wassini](https://community.info-beamer.com/user_avatar/community.info-beamer.com/wassini/32/203_2.png) [@Wassini](https://community.info-beamer.com/u/Wassini)\
**Post date:** [May 1, 2020, 1:34pm UTC](https://community.info-beamer.com/t/analog-clock-demo-help/869/26 "2020-05-01T13:34:41Z")

</div>

Another problem seems to be that datetime is no longer supported 🙃

.py:

```
from hosted import datetime
```

---

<div class="post-metadata">

**Author:** ![infobeamer-fw](https://community.info-beamer.com/user_avatar/community.info-beamer.com/infobeamer-fw/32/3_2.png) [@infobeamer-fw](https://community.info-beamer.com/u/infobeamer-fw)\
**Post date:** [May 1, 2020, 2:28pm UTC](https://community.info-beamer.com/t/analog-clock-demo-help/869/27 "2020-05-01T14:28:29Z")

</div>

It’s `import datetime`. See [https://docs.python.org/library/datetime.html](https://docs.python.org/library/datetime.html)

[Previous page](https://community.info-beamer.com/t/analog-clock-demo-help/869.md?page=1)
