# Add-on API Description missing

**URL:** <https://discourse.mozilla.org/t/add-on-api-description-missing/58828>\
**Category:** WebThings\
**Created:** [April 27, 2020, 3:21pm UTC](https://discourse.mozilla.org/t/add-on-api-description-missing/58828 "2020-04-27T15:21:24Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![marv](https://avatars.discourse-cdn.com/v4/letter/m/8e8cbc/32.png) [@marv](https://discourse.mozilla.org/u/marv)\
**Post date:** [April 27, 2020, 3:21pm UTC](https://discourse.mozilla.org/t/add-on-api-description-missing/58828/1 "2020-04-27T15:21:24Z")

</div>

Hey there,  
I am new to Mozilla IoT and just set up my gateway. On the long run I would like to connect my Homeatic IP devices to the gateway through an homeatic Access point. Since there is no fitting adapter I would like to write one using python. I am wondering wether there is an Api description for the gateway-addon?  
I found the following link:  
[https://github.com/mozilla-iot/addon-list](https://github.com/mozilla-iot/addon-list),  
which links to an wiki-page that does not seem to be available.

Any help would be much appreciated.

---

<div class="post-metadata">

**Author:** ![mstegeman](https://avatars.discourse-cdn.com/v4/letter/m/b782af/32.png) [@mstegeman](https://discourse.mozilla.org/u/mstegeman)\
**Post date:** [April 27, 2020, 4:13pm UTC](https://discourse.mozilla.org/t/add-on-api-description-missing/58828/2 "2020-04-27T16:13:38Z")

</div>

First, we do have a HomeMatic add-on available in the add-on list. It was created by @t1m1 and the code lives [here](https://github.com/tim-hellhake/homematic-adapter#readme).

As for the README, apologies, it’s been updated. See [here](https://github.com/mozilla-iot/wiki/wiki#general-1) for a good list of resources.

Generally speaking, there are not external API docs available, but [the code](https://github.com/mozilla-iot/gateway-addon-python) is well documented, and there are a good number of Python add-ons you could use as a starting point (if you still have a need to create one).

---

<div class="post-metadata">

**Author:** ![marv](https://avatars.discourse-cdn.com/v4/letter/m/8e8cbc/32.png) [@marv](https://discourse.mozilla.org/u/marv)\
**Post date:** [April 28, 2020, 3:12pm UTC](https://discourse.mozilla.org/t/add-on-api-description-missing/58828/3 "2020-04-28T15:12:02Z")

</div>

Thanks for your reply. I am aware of the available add-on. However, the existing add-on handles a CCU, whereas I would like to connect an access point. There is a python api for this so I think it should be doable to integrate.

I used the existing adapters and started today with a simple adapter, which connects a DHT22 sensor to the GPIO of a Raspberry Pi. The adapter is running. However, somehow the thing view is not updating.  
I am updating the properties using the following functions, within a polling thread:

self.set\_cached\_value(value)  
self.device.notify\_property\_changed(self)

However, the thing-view keeps the values which were set during property creation.

Is there anything else to do, in order to update the things view?  
My Code is [here](https://github.com/Marv-plc/dht22-adapter)

---

<div class="post-metadata">

**Author:** ![mstegeman](https://avatars.discourse-cdn.com/v4/letter/m/b782af/32.png) [@mstegeman](https://discourse.mozilla.org/u/mstegeman)\
**Post date:** [April 28, 2020, 4:39pm UTC](https://discourse.mozilla.org/t/add-on-api-description-missing/58828/4 "2020-04-28T16:39:58Z")

</div>

Hmm, your code looks ok. Are you seeing your new values get logged in the `update()` method?

---

<div class="post-metadata">

**Author:** ![marv](https://avatars.discourse-cdn.com/v4/letter/m/8e8cbc/32.png) [@marv](https://discourse.mozilla.org/u/marv)\
**Post date:** [April 28, 2020, 4:48pm UTC](https://discourse.mozilla.org/t/add-on-api-description-missing/58828/5 "2020-04-28T16:48:03Z")

</div>

Yes, the log file shows the correct values for temperature and humidty. What I find suspicious is, that I can change the values in the Thing view, even though on of them is set to “readonly”

 ![image](https://us1.discourse-cdn.com/flex001/uploads/mozilla/original/3X/2/b/2b6540849ad7f14fd0636813d2e0aaaad3bab972.png)

---

<div class="post-metadata">

**Author:** ![mstegeman](https://avatars.discourse-cdn.com/v4/letter/m/b782af/32.png) [@mstegeman](https://discourse.mozilla.org/u/mstegeman)\
**Post date:** [April 29, 2020, 8:30pm UTC](https://discourse.mozilla.org/t/add-on-api-description-missing/58828/6 "2020-04-29T20:30:03Z")

</div>

The read-only issue is because you used `readonly` rather than `readOnly`. The case matters.

---

<div class="post-metadata">

**Author:** ![marv](https://avatars.discourse-cdn.com/v4/letter/m/8e8cbc/32.png) [@marv](https://discourse.mozilla.org/u/marv)\
**Post date:** [April 29, 2020, 10:34pm UTC](https://discourse.mozilla.org/t/add-on-api-description-missing/58828/7 "2020-04-29T22:34:26Z")

</div>

True, changing to readOnly helped in that manner. Thanks!  
However, I still do not get the view to update. I tried to downgrade the gateway to 0.11.0, to see if the behaviour changes. It is still the same. From the log I can see that the property value is updated once (“getValue for property”), when calling the consctructor. After this the properties update method is being called and logs the values. However, the gateway doesn’t seem attempting to collect the new values anymore.

> Blockquote 2020-04-29 23:15:45.439 INFO : Not updating dht22-adapter since a .git directory was detected  
> 2020-04-29 23:15:45.485 INFO : Finished updating add-ons  
> 2020-04-29 23:15:48.371 INFO : thing-url-adapter: Opening database: /home/pi/.mozilla-iot/config/db.sqlite3  
> 2020-04-29 23:15:50.922 INFO : dht22-adapter: Wed Apr 29 23:15:50 2020 Value of temperature sensor on pin 4 has changed from 0 to 1  
> 2020-04-29 23:15:52.811 INFO : thing-url-adapter: Loading add-on thing-url-adapter from /home/pi/.mozilla-iot/addons/thing-url-adapter  
> 2020-04-29 23:15:53.799 INFO : thing-url-adapter: Starting mDNS discovery  
> 2020-04-29 23:15:55.918 INFO : dht22-adapter: Wed Apr 29 23:15:55 2020 Value of temperature sensor on pin 4 has changed from 1 to 2  
> 2020-04-29 23:16:00.934 INFO : dht22-adapter: Wed Apr 29 23:16:00 2020 Value of temperature sensor on pin 4 has changed from 2 to 3  
> 2020-04-29 23:16:05.946 INFO : dht22-adapter: Wed Apr 29 23:16:05 2020 Value of temperature sensor on pin 4 has changed from 3 to 4  
> 2020-04-29 23:16:07.130 INFO : getValue for property temp for: returning 0  
> 2020-04-29 23:16:10.950 INFO : dht22-adapter: Wed Apr 29 23:16:10 2020 Value of temperature sensor on pin 4 has changed from 4 to 5  
> 2020-04-29 23:16:15.959 INFO : dht22-adapter: Wed Apr 29 23:16:15 2020 Value of temperature sensor on pin 4 has changed from 5 to 6  
> 2020-04-29 23:16:20.968 INFO : dht22-adapter: Wed Apr 29 23:16:20 2020 Value of temperature sensor on pin 4 has changed from 6 to 7

Is there any configuration which is required in order to require the Gateway to update?

---

<div class="post-metadata">

**Author:** ![mstegeman](https://avatars.discourse-cdn.com/v4/letter/m/b782af/32.png) [@mstegeman](https://discourse.mozilla.org/u/mstegeman)\
**Post date:** [April 30, 2020, 4:17pm UTC](https://discourse.mozilla.org/t/add-on-api-description-missing/58828/8 "2020-04-30T16:17:14Z")

</div>

Works for me with this PR: [https://github.com/Marv-plc/dht22-adapter/pull/1](https://github.com/Marv-plc/dht22-adapter/pull/1)
