Jump to content

Pat28

Members
  • Gesamte Inhalte

    15
  • Benutzer seit

  • Letzter Besuch

Posts erstellt von Pat28

  1. Hi Borg and Rtrbt,

    Enabling SPI and  editing of the  /etc/brickd.conf file did the job.

    But the mqtt code for the motion detection only seems to work once with this result:

    image.png.f2cc299b9232c501e59ce2a604ca26c0.png

    For the NFC: nothing in the mqtt explorer.

    I think i will stop trying to use tinkerforge mqtt to get the data to openhab.

    To complicated.

    Tinkerforge was a good hardware, easy to use with openhab 2 binding for non pro's of coding.

    A pity it is not working with openhab 3 anymore.

    You are losing potential users.....

    Thanks for the help.

    Patrick

     

  2. Hi,

    Sorry i did not reply to your last mail, but my HAT Zero is not detected anymore (is less than 2 years old).

    I could not test your MQTT code.

    I see the blue leds of the HAT zero and the bricklet, but no data.

    Found a post ( HAT Zero and Thermal sensor are not responding ) and tried the tests.

    Attached the brikd.log file from /var/log/brickd.log

    brickd.log

    Then did

    sudo systemctl stop brickd

    and then start a non-daemonized instance with debug logging:

    sudo brickd --debug -all,+bricklet.c

    and got this result:

    pi@raspberrypi:~ $ sudo brickd --debug -all,+bricklet.c
    2022-08-19 09:09:51.123255 <I> <main_linux.c:367> Brick Daemon 2.4.3 started (pid: 1220, daemonized: 0)
    2022-08-19 09:09:51.138444 <D> <bricklet.c:237> No HAT product_id file in device tree, not using default HAT Brick config
    2022-08-19 09:09:51.139510 <D> <bricklet.c:237> No HAT product_id file in device tree, not using default HAT Zero Brick config
    2022-08-19 09:09:51.140378 <D> <bricklet.c:424> Found no supported HAT product_id in device tree, checking bricklet.* section in config file instead
    2022-08-19 09:09:51.141187 <D> <bricklet.c:505> Found no bricklet.* section in config file

    That seems not very good.

    Then i send this command: brickd --check-config and got this results:

    image.png.eba1ff7a412b45213b8fb113b962b24d.png

     

    image.png.b5e050d5051dd34f98219f3d98cbf2ec.png

    image.png.855beda42be3afde9fe266e42716ec31.png

    I then formatted the SD card and loaded the latest PI image on the PI ZERO and nothing else than the brickd and brickv software.

    No luck, still not HAT detection in brickv.

    Tested on a pi4 , same result.

    Any chances to get the HAT Zero back to life?

    Thanks

    Patrick

     

  3. Hi,

    I tried the NFC and motion bricklet , without success. 

    I am not a programmer and try to learn by example with the help of documentation.

    I was using the tinkerforge binding in OH 2 without any "coding", just configuration the things and items.

    Very easy to use for a not pro.

    But tinkerforge did not make the OH3 binding and told to use MQTT.

    I try to do/learn this, but it is more difficult than configuring a OH binding.

    Did not fully understand your previous post and the documentation is not very explaining.

    After some trail and error i tried this:

       "tinkerforge/request/nfc_bricklet/Y2U/set_mode": {"mode": "simple"},
        "tinkerforge/request/nfc_bricklet/Y2U/simple_get_tag_id": {"index": 0, "tag_type": 2, "tag_id": 0, "last_seen": 0},
        
        "tinkerforge/register/motion_detector_v2_bricklet/MPc/motion_detected": {"register": true}

    But did only got errors or null values.

    Now i have bricks and bricklets i cannot use....

    On every bricklet MQTT you have an example at the top off the document, but never in the api section. 

    I would be easier for the non-pro's like me to have some results.

    Thanks

    Patrick

     

     

  4. Hi,

    That is exactly what i did for the ambiant light bricklet:

    "tinkerforge/register/ambient_light_v3_bricklet/L2H/illuminance/get_illuminance": {"register": true},
     "tinkerforge/request/ambient_light_v3_bricklet/L2H/set_illuminance_callback_configuration": {"period": 1000, "value_has_to_change": false, "option": "off", "min": 0, "max": 0},

    with success.

     

    But the motion detection and nfc bricklets are not working. No data is shown in the mqtt explorer.

    Here is what it tried without success with the info i found in the docs:

        "tinkerforge/register/nfc_bricklet/Y2U/reader_get_tag_id": {"register": true},
        "tinkerforge/request/nfc_bricklet/Y2U/reader_state_changed": {"period": 2000},

        "tinkerforge/register/motion_detector_v2_bricklet/MPc/get_motion_detected": {"register": true},
        "tinkerforge/request/motion_detector_v2_bricklet/MPc/motion_detected": {"period": 2000}

    Could you send me a working code for those two not working bricklets?

    Thanks

    Patrick

  5. Hi,

    Made some progress.

    change tf_mqtt.txt file to:

    {
        "tinkerforge/register/air_quality_bricklet/X3s/all_values": {"register": true},
        "tinkerforge/request/air_quality_bricklet/X3s/set_all_values_callback_configuration": {"period": 5000, "value_has_to_change": false},

        "tinkerforge/register/air_quality_bricklet/X3s/iaq_index": {"register": true},
        "tinkerforge/request/air_quality_bricklet/X3s/set_iaq_index_callback_configuration": {"period": 5000, "value_has_to_change": false, "option": "off", "min": 0, "max": 0},

        "tinkerforge/register/air_quality_bricklet/X3s/temperature": {"register": true},
        "tinkerforge/request/air_quality_bricklet/X3s/set_temperature_callback_configuration": {"period": 5000, "value_has_to_change": false, "option": "off", "min": 0, "max": 0},
     
         "tinkerforge/register/air_quality_bricklet/X3s/humidity": {"register": true},
        "tinkerforge/request/air_quality_bricklet/X3s/set_humidity_callback_configuration": {"period": 5000, "value_has_to_change": false, "option": "off", "min": 0, "max": 0},
     
         "tinkerforge/register/air_quality_bricklet/X3s/air_pressure": {"register": true},
        "tinkerforge/request/air_quality_bricklet/X3s/set_air_pressure_callback_configuration": {"period": 5000, "value_has_to_change": false, "option": "off", "min": 0, "max": 0},
    }

    and see the individual values in MQTT explorer:

    image.thumb.png.f885f8ee8745f2c31f74b75473d0c3cc.png

     

    In Openhab 3.3.0 made a mqtt generic binding with this code:

    UID: mqtt:topic:651a155cc0:b06c533a7f
    label: MQTT PI21 Generic Thing
    thingTypeUID: mqtt:topic
    configuration: {}
    bridgeUID: mqtt:broker:651a155cc0
    channels:
       - id: PI21_IAQ_Index
        channelTypeUID: mqtt:string
        label: MQTT PI21 IAQ index
        description: ""
        configuration:
          stateTopic: tinkerforge/callback/air_quality_bricklet/X3s/iaq_index
      - id: PI21temperature
        channelTypeUID: mqtt:string
        label: MQTT PI21 temperature
        description: ""
        configuration:
          stateTopic: tinkerforge/callback/air_quality_bricklet/X3s/temperature
          unit: '"°C"'
      - id: PI21Allvlues
        channelTypeUID: mqtt:string
        label: MQTT PI21 All values
        description: null
        configuration:
          stateTopic: tinkerforge/callback/air_quality_bricklet/X3s/all_values
      - id: MQTTPI21humidity
        channelTypeUID: mqtt:string
        label: MQTT PI21 Humidity
        description: ""
        configuration:
          stateTopic: tinkerforge/callback/air_quality_bricklet/X3s/humidity
      - id: MQTTPI21Air_pressure
        channelTypeUID: mqtt:string
        label: MQTT PI21 Air Pressure
        description: ""
        configuration:
          stateTopic: tinkerforge/callback/air_quality_bricklet/X3s/air_pressure

    The error i made before is that i used a number type instead of a string (see channelTypeUID: mqtt:string

    I checked the "default" profile instead of the JSONPATH profile when linking the new item.

    And i can see the temperature value in a string format/

    image.thumb.png.8fd427ceba90bb83e03ede32d9e15c5e.png

    Add the channels for  IAQ_index, humidity and air-pressure in the same way and it works fine.

    I have other bricklets (motion detection, nfc and ambiant light) to try to get the mqtt values.

    From the mqtt examples in the TF documentation, i see that not every bricklet has the same register and request as the air quality bricklet i use in my tf_mqtt.txt file to get the data. How do for example you can get the motion detection and nfc bricklet mqtt data in a mqtt.txt file?

    Now find out how the convert the string data into a number in openhab. Will search the openhab forum.

    Thanks for the help.

    Patrick

  6. Hi Rtrbt,

    Thanks for the link.

    But there is not much info how to do this json transformation.

    Googled a lot, but did not find the solution. Here is what i tried without success?

    I saw in the MQTT explorer is in the PUBLISH frame a line called TOPIC:

    image.png.ea13041105175bf43e2d7f67f74b99fb.png

    with tinkerforge/callback/air_quality_bricklet/X3s/all_values in it.

    I suppose i have to fill this in the Openhab MQTT binding channel:

    image.png.e10e431e6056a4c88596219bd3608888.png

    In the item configuration i saw a JSONPath  in profile profile:

    image.thumb.png.970d58ccefbf3cdffd73713d29dfc241.png

    I tried to put $.device.status.temperature as in the example on the required example line(and many other expressions i found on google) but no success to get the temperature value( is always NULL !!!)

    Could you please send me, in detail, how to get the, for example the temperature, as above example, value  in the OH3 item.

    I am stuck getting the data in my OH3.

    A step by step example would help me to fix/learn how to do it.

    Thanks in advance,

    Patrick

     

     

  7. Hi Rtrbt,

    How do you do this Jason transformation or other operation?

    Where can i found the doc or can you send me a detailed how to do this.

    Or is their a easier way to get the topic data from the bricklets to import in Openhab 3?

    I am missing the tinkerforge binding we had for version 2.5 and lost for 3.3.

    It was so easy to get the data.

    Thanks

    Patrick

  8. Thanks very much rtrbt,

    I used your code, run the command and using mqtt explorer i can see the air quality values:

    image.png.157b1ee91604b26baa9bf90196b8a3f3.png

    But i have a new problem.

    What are the topic names of the air quality bricklet?

    I tried to load the iaq_index, iaq_index_accuracy, temperature, humidity and air_pressure as topic into openhab3 and i only see a value= null, not the 60, low, 2598, 5071 and 100674 that i see in the value frame of the mqtt explorer.

    Also if you have two or more air quality bricklets on the same broker, can you give every value a specific topic name so you know from witch bricklet for instance the temperature or humidity is coming from ?

    Again thanks for help me,

    Patrick

     

     

  9. Hi Everyone.

    I am new to TF MQTT binding and i have got some problems.

    Her is what i did:

    My hardware setup:

    ·         * Raspberry pi 2B with Buster os with latest updates and upgrades

    ·         * Network connection with fixed IP 192.168.10.21 from PI to switch

    ·       *   Tinkerforge master brick with USB cable to PI and my air quality bricklet connected

    ·         * Synology DSM7.1 (IP 192.168.10.5) with mosquitto package installed used as MQTT broker and Openhab 3.3 software

     

    Install brick viewer on pi :

    sudo apt install brickv

    See bricklet UID via brickv software on PI: can see that it is working without problems

     

    Install mqtt api binding on raspberry pi:

    sudo apt install tinkerforge-mqtt

     

    Copy the tinkerforge-mqtt fle to the /usr/local/bin folder on pi

    Create a init-file in the same /usr/local/bin folder to put the mqtt commands

    For example tf_mqtt.txt file with MQTT commands for air quality bricklet found in the Tinkerforge MQTT documentation examples webpage:

    https://www.tinkerforge.com/en/doc/Software/Bricklets/AirQuality_Bricklet_MQTT.html#air-quality-bricklet-mqtt-examples

    My content tf_mqtt.txt file:

    subscribe to tinkerforge/callback/air_quality_bricklet/XYZ/all_values

    publish '{"register": true}' to tinkerforge/register/air_quality_bricklet/XYZ/all_values

    publish '{"period": 1000, "value_has_to_change": false}' to tinkerforge/request/air_quality_bricklet/X3s/set_all_values_callback_configuration

    replace XYZ with your air quality bricklet UID value from the brick viewer.

     

    In Pi terminal run :

    python3 /usr/local/bin/tinkerforge_mqtt --broker-host 192.168.10.5 --init-file /usr/local/bin/tf_mqtt.txt

    Where the broker host is the IP of my Synology MQTT broker on same network.

    and i receive this error message:

    pi@raspberrypi:~ $ python3 /usr/local/bin/tinkerforge_mqtt --broker-host 192.168.10.5 --init-file /usr/local/bin/tf_mqtt.txt
    Could not read init file: Expecting value: line 1 column 1 (char 0)

    what did i do wrong/forgot.

    Thanks for helping me out.

    Patrick

     

     

  10. Hi rwblinn,

     

    Thanks for the instructions steps.

    It works fine thanks to you.

     

    I modified the last line:

    python brick-mqtt-proxy.py --brickd-host 192.168.1.xxx --brickd-port 4223 --broker-host localhost --broker-port 1883 --update-interval 5& 

     

    where xxx = ip address tinkerforge brick

    and interval 5 to have a 5 seconds refresh.

     

    Again , thanks for helping me solve this problem.

     

    Patrick

  11. Hi,

    On a raspberry pi with Jessie image (latest update and upgrades), python 2.7.9

     

    installed brick MQTT proxy:

    wget https://raw.githubusercontent.com/Tinkerforge/brick-mqtt-proxy/master/brick-mqtt-proxy.py

     

    installed brick deamon:

    sudo apt-get install libusb-1.0-0 libudev0 pm-utils

      wget http://download.tinkerforge.com/tools/brickd/linux/brickd_linux_latest_armhf.deb

      sudo dpkg -i brickd_linux_latest_armhf.deb

     

    Brick deamon is working fine; I can see the values of the bricklets

     

    Installed the Python API bindings:

    sudo pip install tinkerforge

     

    Installed  Eclipse Paho MQTT Python client library:

    sudo pip install paho-mqtt     

     

    Started the proxy with:

    sudo python brick-mqtt-proxy.py

     

    And receive this error:

     

    pi@PI1:~ $ sudo python brick-mqtt-proxy.py

    Traceback (most recent call last):

      File "brick-mqtt-proxy.py", line 1233, in <module>

        proxy.connect()

      File "brick-mqtt-proxy.py", line 1100, in connect

        self.client.connect(self.broker_host, self.broker_port)

      File "/usr/local/lib/python2.7/dist-packages/paho/mqtt/client.py", line 686, in connect

        return self.reconnect()

      File "/usr/local/lib/python2.7/dist-packages/paho/mqtt/client.py", line 808, in reconnect

        sock = socket.create_connection((self._host, self._port), source_address=(self._bind_address, 0))

      File "/usr/lib/python2.7/socket.py", line 571, in create_connection

        raise err

    socket.error: [Errno 111] Connection refused

     

    What did I do wrong?

     

    Thanks

    Patrick

     

     

     

     

     

×
×
  • Neu erstellen...