Skip to content

Latest commit

Β 

History

History
128 lines (88 loc) Β· 3.48 KB

README.md

File metadata and controls

128 lines (88 loc) Β· 3.48 KB

🌦️ Ecowitt to Narodmon Data Sender

CodeFactor

This Python script collects weather data from an Ecowitt weather station and sends it to Narodmon, a popular public monitoring service. The script periodically queries the Ecowitt API, extracts all available weather data, and sends it to Narodmon for visualization and tracking.

✨ Features

  • πŸ“Š Collects data from an Ecowitt weather station using its API.
  • πŸ“‘ Sends weather data such as temperature, humidity, pressure, wind speed, gust, direction, rainfall rate, solar radiation, and UV index to Narodmon.
  • πŸ”„ Designed to run continuously, sending updates every 5 minutes.
  • πŸ› Simple logging to console for debug purposes.

πŸ“‹ Requirements

  • 🐍 Python 3.7 or higher
  • 🌦️ Ecowitt weather station with API access enabled
  • πŸ“‘ Narodmon account to monitor and share weather data

πŸš€ Installation

  1. Clone this repository:

    git clone https://github.com/CyberScopeToday/ecowitt-elevator-narodmon.git
    cd ecowitt-elevator-narodmon
  2. Create a virtual environment:

    python3 -m venv venv
  3. Activate the virtual environment:

    • On Linux/macOS:
      source venv/bin/activate
    • On Windows:
      venv\Scripts\activate
  4. Install the required Python packages:

    pip install -r requirements.txt

βš™οΈ Usage

  1. Update the configuration parameters in bot.py:

    • Set your Ecowitt API credentials:

      • ecowitt_application_key
      • ecowitt_api_key
      • ecowitt_mac
    • Set your Narodmon device MAC address:

      • narodmon_device_mac
  2. Run the script:

    python bot.py
  3. Optionally, run the script as a service:

    Create a systemd service unit file as follows to run the script as a background service (e.g., /etc/systemd/system/ecowitttonarodmon.service):

    [Unit]
    Description=Ecowitt to Narodmon Data Sender
    After=network.target
    
    [Service]
    User=root
    WorkingDirectory=/home/server/ecowitttonarodmon
    ExecStart=/home/server/ecowitttonarodmon/venv/bin/python /home/server/ecowitttonarodmon/bot.py
    Restart=always
    RestartSec=5
    Environment="PYTHONPATH=/home/server/ecowitttonarodmon/venv/bin/python"
    StandardOutput=file:/var/log/ecowitttonarodmon.log
    StandardError=file:/var/log/ecowitttonarodmon.log
    
    [Install]
    WantedBy=multi-user.target

    Then enable and start the service:

    sudo systemctl daemon-reload
    sudo systemctl enable ecowitttonarodmon.service
    sudo systemctl start ecowitttonarodmon.service

πŸ”§ Configuration Parameters

  • ecowitt_application_key: Your Ecowitt application key.
  • ecowitt_api_key: Your Ecowitt API key.
  • ecowitt_mac: MAC address of the Ecowitt weather station.
  • narodmon_device_mac: MAC address of your Narodmon device.

πŸ“œ Logs

Logs will be stored at /var/log/ecowitttonarodmon.log. You can check them with:

cat /var/log/ecowitttonarodmon.log

🀝 Contributing

Feel free to submit pull requests, open issues, and suggest features. Contributions are always welcome! πŸ™Œ

πŸ“„ License

This project is licensed under the MIT License.

πŸ™ Acknowledgements

  • 🌦️ Ecowitt for providing their weather station API.
  • πŸ“‘ Narodmon for enabling public data monitoring.