logo elektroda
logo elektroda
X
logo elektroda

Orange PI Zero with Domoticz: Auto-Startup, Updating Sensor Data via Atmega644 & ESP8266

maximus22_kr 7242 8
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 16435726
    maximus22_kr
    Level 18  
    Hello
    Based on the description for Raspberry PI, I was able to run Domoticz.
    I don't plan to use GPIO yet - I think you need a library for this. I rather treat Orange PI as a server.

    1. I was unable to set it to start automatically after startup. I tried something like this:
    Code: Text
    Log in, to see the code

    Code: Text
    Log in, to see the code

    Code: Text
    Log in, to see the code

    but no results

    2. Updating sensor data
    When I do it "manually" through the site it is OK
    Code: Text
    Log in, to see the code


    but I wanted to send data from Atmega644, which acts as a master (polls various sensors, calculates hysteresis, sends, via RFM12, saves to SD card) via ESP8266 to Domoticz.
    Should I do it like this:
    Code: VB.net
    Log in, to see the code


    I wonder how "fast" and "often" data can be updated? I thought about sending after each reading from a given sensor. You would also need to check the answer by looking for:
    "OK" or "Update Device"
    Do you have a problem with Raspberry? Ask question. Visit our forum Raspberry.
  • ADVERTISEMENT
  • #2 16439219
    starob
    Level 29  
    I have a fairly extensive system focused on Domoticz.
    Sensors on the RFLink gateway http://www.nemcon.nl/blog2/ 433Mhz
    and on MySensors 2.4GHz www.mysensors.org
    In the extensive system there are problems with the radio: interference, range, mutual direct impact on the sensors, uncontrolled operation of control relays, and when connecting factory wireless devices there are no channels.
    My advice is from the beginning not to push into the RF radio without need.
    Currently, I do everything via WiFi using ESP, by placing a MySensors LAN gateway on it.
    Domoticz natively supports MySensors and operation on json is eliminated.
    The json command set is limited and you can't always do what you want.
    In addition, I found a cheap module www.itead.cc/sonoff-wifi-wireless-switch.html
    From the original, I exchange the built-in soft for MySensors and for a little money I have a compact device with a power supply, in a housing and an executive relay. Other sensors are connected via goldpin on the inside.
    With this method I did: monitoring and control of a gas boiler, Ambiligth, measurement of media consumption (water, electricity, gas), humidity and temperature measurement, bathroom ventilation control and several lighting switches.
    If necessary, instead of operations json uses direct domoticz.db operations via SQlite.

    Back to the question. The sensors are updated only when the value changes and not more often than 1 minute. One time depends on the specific application.
    Domoticz archives sensor logs every 5 minutes.
    Adding to autostart on RPi works
    
    cd domoticz
    sudo cp domoticz.sh /etc/init.d
    sudo chmod +x /etc/init.d/domoticz.sh
    sudo update-rc.d domoticz.sh defaults
    
  • ADVERTISEMENT
  • #3 16439280
    maximus22_kr
    Level 18  
    For me, after entering these commands and reboot, after running, I write orangepizero login
    Does it matter what account Domoticz installed on?
    I found something like this:
    
    sudo cp domoticz.sh /etc/init.d
    sudo chmod +x /etc/init.d/domoticz.sh
    sudo update-rc.d domoticz.sh defaults
    

    Edit the startup script and change the USERNAME, DAEMON and DAEMON_ARGS parameters to reflect your current settings
    
    sudo vi /etc/init.d/domoticz.sh
    
    USERNAME=pi
    DAEMON=/home/$USERNAME/domoticz/$NAME
    DAEMON_ARGS="-daemon -www 8080"
    


    Unfortunately, I was dealing with Unix years ago at the university - now Windows habits dominate, for now I changed the communication program to Putty and now at least it is readable and the nano editor that I installed - works, it means it looks as it should.

    As for the frequency, 1 minute is between the update for one sensor, is it about sending each time data or sending data for a specific sensor? Because for me it looks like the atmega triggers the measurement, and then every 2 seconds it polls each sensor in turn (but the interval between reading these sensors is 2 minutes), i.e. I would like to read the sensor, check if something has changed (atmega calculates my hysteresis so if there is no change why send it, if so send it to Domoticz, after asking all eight there is a 2 minute break.
  • ADVERTISEMENT
  • #4 16439546
    starob
    Level 29  
    Domoticz server works in the background and you do not need to log in to Pi. Check if you connect remotely via the browser: IP 9090. At least that's how it works on raspbbers. First of all, check the correctness of the domoticz settings. Times depend on the sensor function and your expectations. Send data that is important in terms of response speed. Others (e.g. room temperature etc. are not important and can be sent less often. There is no universal prescription.
    Sensors can be queried more often, they only choose the frequency of domotics updates. When using factory sensors, you do not have the option of adjusting the update time, so you must do it carefully. As the system expands, be careful not to "talk" to the radio.
  • #5 16439796
    maximus22_kr
    Level 18  
    Unfortunately, I have Domoticz Offline all the time (in another browser open "purely" does not enter at all) - for me it is on port 8080.
    Is there anything in Domoticz's settings that can cause such problems?

    Works only after logging into your account and
    
    cd ~/domoticz
    sudo ./domoticz
    


    It helped
    
    sudo nano /etc/init.d/domoticz.sh
    

    and change of user

    Added after 3 [hours] 14 [minutes]:

    As for these modules, it's actually cheap. On Aliexpress fakes are more expensive than on the given page.

    I wonder if it is possible to download current data from the Domoticz database? This means to write an application that will read data from the database and generate an image at the output of Orange pi, which could be connected to a modulator and sent to the whole house.
  • ADVERTISEMENT
  • #6 16440348
    gebir
    Level 11  
    Have you set everything in /etc/init.d/domoticz.sh (user and path to domoticz).
    As for installation, there is a nice description for Cubieboard2. Ideally suited for Nano pi / Orange Pi etc.
    I always try to compile by myself (remember swap min 1gb), if the compilation is ok it means that your system is ok ;)
    Note, the build takes ~ 1h 30 min on H3.


    best regards
    gebir
  • #7 16440485
    starob
    Level 29  
    maximus22_kr wrote:
    I wonder if it is possible to download current data from the Domoticz database?


    Yes, back up your database. The "domotycz.db" file will be downloaded to your computer.
    For example, you can use SQLiteStudio to familiarize yourself with the structure of the database, make corrections and restore to domotics.
    I often use direct operations based on python scripts.
    Especially when adding equipment with a large number of virtual sensors or when there is no proper json function.
    An example of a function that "changes something" directly in the database.
    Code: Python
    Log in, to see the code


    This is an example of a thermostatic head added in one call
    script
    Orange PI Zero with Domoticz: Auto-Startup, Updating Sensor Data via Atmega644 & ESP8266 [/ Img]

    Orange PI Zero with Domoticz: Auto-Startup, Updating Sensor Data via Atmega644 & ESP8266
  • #8 16441485
    maximus22_kr
    Level 18  
    I am interested in the issue of these wireless modules. They have the option of only controlling via Wifi. I would like to be able to control the buttons. So it builds an Atmega + ESP8266 system having e.g. 4 isolated inputs + 4 outputs (i.e. one system per room). Configures the fixed IP address and connect to Domoticz. The point is that when I turn something on or off using the Domoticz button, he knows about it, and the other way he can change the state of any output in Domoticz.
  • #9 16441714
    starob
    Level 29  
    You complicate your life. ESP has Gpio ports. You can always add expander after IC2 to sonoff. Other requirements will be met.
    That is why I suggested using MySensors, whose support is built into domoticz. The sensor sends info about its condition and the system does the rest. There is no need for "personal" searching in the database.

    People work wonders on them http://tinkerman.cat/sonoff-th10-th16-sensors-displays-actuators/

Topic summary

The discussion revolves around setting up the Orange PI Zero to run Domoticz as a server, focusing on auto-startup configuration and updating sensor data via Atmega644 and ESP8266. Users share their experiences with the startup script for Domoticz, emphasizing the need to correctly set the USERNAME, DAEMON, and DAEMON_ARGS in the script located at /etc/init.d/domoticz.sh. Issues with accessing Domoticz through the browser and ensuring it runs in the background without needing to log in are also addressed. Additionally, participants discuss the challenges of using RF sensors and suggest using WiFi with ESP modules for better reliability. The conversation includes methods for sending sensor data to Domoticz and the possibility of controlling devices through a custom Atmega + ESP8266 setup. Suggestions for database management and using MySensors for easier integration with Domoticz are also provided.
Summary generated by the language model.
ADVERTISEMENT