Skip to content

Commit

Permalink
docs: update readme w/ install steps
Browse files Browse the repository at this point in the history
  • Loading branch information
EvanSchalton committed Mar 16, 2024
1 parent 584468b commit 3212864
Show file tree
Hide file tree
Showing 2 changed files with 216 additions and 2 deletions.
190 changes: 189 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ into the base Tuya integration, but the API change means the non-standard data p
I forked an old version of the HA repo, using the legacy Tuya SDK.

# Setup:

## Setup in Tuya Platform

1. This integration reverts the Tuya core integration to use the [tuya-iot-python-sdk](https://github.com/tuya/tuya-iot-python-sdk) which returns the `DP Instruction` set instead of just the `Standard Instruction` so follow it's standard [setup](https://github.com/tuya/tuya-iot-python-sdk)

>I've logged [an issue](https://github.com/tuya/tuya-device-sharing-sdk/issues/11) with the Tuya team, if they merge that I'll be able to merge my [PR](https://github.com/tuya/tuya-device-sharing-sdk/issues/11) into core
Expand All @@ -24,6 +27,25 @@ Select `DP Instruction`, you should see the additional value populate.

![DP Instruction](screenshots/instruction-mode.png)

## Add to HACS

[![hacs_badge](https://img.shields.io/badge/HACS-Custom-orange.svg?style=for-the-badge)](https://github.com/hacs/integration)

Installation is easiest via the [Home Assistant Community Store
(HACS)](https://hacs.xyz/), which is the best place to get third-party
integrations for Home Assistant. Once you have HACS set up, simply click the button below (requires My Homeassistant configured) or
follow the [instructions for adding a custom
repository](https://hacs.xyz/docs/faq/custom_repositories) and then
the integration will be available to install like any other.

[![Open your Home Assistant instance and open a repository inside the Home Assistant Community Store.](https://my.home-assistant.io/badges/hacs_repository.svg)](https://my.home-assistant.io/redirect/hacs_repository/?owner=EvanSchalton&repository=tuya-homeassistant-openapi&category=integration)

## Add Integration

After installing, you can easily configure your devices using the Integrations configuration UI. Go to Settings / Devices & Services and press the Add Integration button, or click the shortcut button below (requires My Homeassistant configured).

[![Add Integration to your Home Assistant
instance.](https://my.home-assistant.io/badges/config_flow_start.svg)](https://my.home-assistant.io/redirect/config_flow_start/?domain=tuya_openapi)

# Hardware
- Sensor: [IBS-M2](https://amzn.to/3wX0Ir3)
Expand Down Expand Up @@ -58,6 +80,172 @@ climate:
precision: 0.1
```
# Dashboard
## Current Pool Dashboard (for Inspiration)
![Mobile Dashboard](screenshots/mobile-dashboard.png)
### Glance Yaml:
```yaml
show_name: true
show_icon: true
show_state: true
type: glance
entities:
- entity: sensor.ibs_m2_temperature_3
name: Temperature
- entity: sensor.ibs_m2_ch_2_battery
name: Battery
state_color: true
```
### Pump Yaml
`It's disabled right now because the breaker is off for my pool house`
```yaml
type: custom:button-card
name: Pump
show_state: false
show_icon: true
show_name: true
entity: switch.pool_pump_socket_1
icon: mdi:water-pump
state:
- operator: template
value: |
[[[ return entity.state === 'on'; ]]]
styles:
icon:
- color: rgb(16, 30, 194)
- operator: template
value: |
[[[ return entity.state === 'off'; ]]]
icon: mdi:water-pump-off
styles:
icon:
- color: rgb(90, 90, 90)
- operator: template
value: >
[[[ return entity.state === 'unknown'; ]]] # Set "unknown" as the default
state
icon: mdi:alert-circle-outline
styles:
icon:
- color: rgb(255, 0, 0)
tap_action:
action: toggle
```

### Heater

`It's disabled right now because the breaker is off for my pool house`

```yaml
type: custom:button-card
name: Heater
show_state: false
show_icon: true
show_name: true
entity: switch.pool_heater_socket_1
icon: mdi:heat-wave
state:
- operator: template
value: |
[[[ return entity.state === 'on'; ]]]
styles:
icon:
- color: rgb(194, 28, 16)
- operator: template
value: |
[[[ return entity.state === 'off'; ]]]
icon: mdi:heat-wave
styles:
icon:
- color: rgb(90, 90, 90)
- operator: template
value: >
[[[ return entity.state === 'unknown'; ]]] # Set "unknown" as the default
state
icon: mdi:alert-circle-outline
styles:
icon:
- color: rgb(255, 0, 0)
tap_action:
action: toggle
```

# Automations
Turn on the pump anytime the heater is on:
```yaml
- id: 'xxxxxx'
alias: Pump turns on with heater
description: ''
trigger:
- platform: state
entity_id:
- switch.pool_heater_socket_1
attribute: 'On'
condition: []
action:
- type: turn_on
device_id: xxxxxx
entity_id: xxxxxx
domain: switch
mode: single
```

Run the pump for 20 minutes after the heater turns off
```yaml
alias: Turn off pump first
description: ""
trigger:
- platform: device
type: changed_states
device_id: __pump_device_id__
entity_id: __pump_entity_id__
domain: switch
condition:
- condition: device
type: is_on
device_id: __heater_device_id__
entity_id: __heater_entity_id__
domain: switch
action:
- type: turn_on
device_id: __pump_device_id__
entity_id: __pump_entity_id__
domain: switch
- type: turn_off
device_id: __heater_device_id__
entity_id: __heater_entity_id__
domain: switch
- delay:
hours: 0
minutes: 20
seconds: 0
milliseconds: 0
- if:
- condition: device
type: is_off
device_id: __heater_device_id__
entity_id: __heater_entity_id__
domain: switch
then:
- type: turn_off
device_id: __pump_device_id__
entity_id: __pump_entity_id__
domain: switch
mode: restart
```
> This should be improved upon: I could store pump/heater on/off timestamps to action if the pump should stay on after the heater turns off -- I haven't tested this w/ the new themostat controller so they may interact oddly, in which case I'll need to update.

# Other Ideas
1. I'll probably add weather integration that controls the pool temp based on the weather (no point in heating when it's raining or on a particularly cool night or overcast day where we wont want to swim)
2. I happen to have multiple sensors, instead of having one sit on the shelf I'm going to play with creating a sensor that averages the and is used as the `target_sensor` in the climate control.
2. I happen to have multiple sensors, instead of having one sit on the shelf I'm going to play with creating a sensor that averages the and is used as the `target_sensor` in the climate control.

# Ways to support:
- [![BuyMeCoffee](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/evanschalton)
- Cosign the [issue](https://github.com/tuya/tuya-device-sharing-sdk/issues/11) on Tuya's sdk (give it a thumbs up or add a comment in support)
28 changes: 27 additions & 1 deletion info.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ into the base Tuya integration, but the API change means the non-standard data p
I forked an old version of the HA repo, using the legacy Tuya SDK.

# Setup:

## Setup in Tuya Platform

1. This integration reverts the Tuya core integration to use the [tuya-iot-python-sdk](https://github.com/tuya/tuya-iot-python-sdk) which returns the `DP Instruction` set instead of just the `Standard Instruction` so follow it's standard [setup](https://github.com/tuya/tuya-iot-python-sdk)

>I've logged [an issue](https://github.com/tuya/tuya-device-sharing-sdk/issues/11) with the Tuya team, if they merge that I'll be able to merge my [PR](https://github.com/tuya/tuya-device-sharing-sdk/issues/11) into core
Expand All @@ -24,6 +27,25 @@ Select `DP Instruction`, you should see the additional value populate.

![DP Instruction](screenshots/instruction-mode.png)

## Add to HACS

[![hacs_badge](https://img.shields.io/badge/HACS-Custom-orange.svg?style=for-the-badge)](https://github.com/hacs/integration)

Installation is easiest via the [Home Assistant Community Store
(HACS)](https://hacs.xyz/), which is the best place to get third-party
integrations for Home Assistant. Once you have HACS set up, simply click the button below (requires My Homeassistant configured) or
follow the [instructions for adding a custom
repository](https://hacs.xyz/docs/faq/custom_repositories) and then
the integration will be available to install like any other.

[![Open your Home Assistant instance and open a repository inside the Home Assistant Community Store.](https://my.home-assistant.io/badges/hacs_repository.svg)](https://my.home-assistant.io/redirect/hacs_repository/?owner=EvanSchalton&repository=tuya-homeassistant-openapi&category=integration)

## Add Integration

After installing, you can easily configure your devices using the Integrations configuration UI. Go to Settings / Devices & Services and press the Add Integration button, or click the shortcut button below (requires My Homeassistant configured).

[![Add Integration to your Home Assistant
instance.](https://my.home-assistant.io/badges/config_flow_start.svg)](https://my.home-assistant.io/redirect/config_flow_start/?domain=tuya_openapi)

# Hardware
- Sensor: [IBS-M2](https://amzn.to/3wX0Ir3)
Expand Down Expand Up @@ -222,4 +244,8 @@ mode: restart

# Other Ideas
1. I'll probably add weather integration that controls the pool temp based on the weather (no point in heating when it's raining or on a particularly cool night or overcast day where we wont want to swim)
2. I happen to have multiple sensors, instead of having one sit on the shelf I'm going to play with creating a sensor that averages the and is used as the `target_sensor` in the climate control.
2. I happen to have multiple sensors, instead of having one sit on the shelf I'm going to play with creating a sensor that averages the and is used as the `target_sensor` in the climate control.

# Ways to support:
- [![BuyMeCoffee](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/evanschalton)
- Cosign the [issue](https://github.com/tuya/tuya-device-sharing-sdk/issues/11) on Tuya's sdk (give it a thumbs up or add a comment in support)

0 comments on commit 3212864

Please sign in to comment.