> For the complete documentation index, see [llms.txt](https://enriquemoran95.gitbook.io/pybittle/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://enriquemoran95.gitbook.io/pybittle/documentation/wifimanager/wifimanager.md).

# WifiManager()

### Attributes

* **ip (str):** Bittle ip address.
* **http\_address (str):** Bittle REST API address.

### Methods

* **get\_status\_code():** Returns REST API ***actionpage*** (e.g., <http://192.168.1.18/actionpage>) request code (int). If there is no connection to Bittle REST API, -1 is returned.&#x20;
* **has\_connection():** Returns True if there is connection to REST API actionpage, False otherwise.
* **send\_msg(msg):** Sends passed msg parameter (string) to Bittle. Returns request response (int).

### Example

The following example shows the complete process of connecting and sending messages to Bittle through WiFi connection.

```python
import time

from pyBittle import wifiManager

# Create WifiManager instance
wifiManager = wifiManager.WifiManager()

# Set Bittle REST API ip address
rest_api_ip = '192.168.1.115'
wifiManager.ip = rest_api_ip

if wifiManager.has_connection():  # http://192.168.1.115/actionpage is accessible
    response = wifiManager.send_msg('khi')  # Send GREETING command
    print(f"khi message sent, received response: {response}, expected: 200")
    time.sleep(6)  # Wait for GREETING action to finish
    response = wifiManager.send_msg("d")  # Send SHUTDOWN command
    print(f"d message sent, received response: {response}, expected: 200")
else:
    print("Can't access to Bittle REST API address!")
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://enriquemoran95.gitbook.io/pybittle/documentation/wifimanager/wifimanager.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
