Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possibility of Request for Orion Grid Connect Outdoor Siren? #198

Closed
jamiergrs opened this issue Jul 17, 2022 · 20 comments
Closed

Possibility of Request for Orion Grid Connect Outdoor Siren? #198

jamiergrs opened this issue Jul 17, 2022 · 20 comments

Comments

@jamiergrs
Copy link

I'm wondering if it is possible to get support for the Orion grid connect outdoor siren, specifically ability to change the alarm_state. If you connect this device through the official tuya integration you only get ability to change volume and alarm time. Adding through this integration gives a device not supported message.

Happy to provide any information / details as required

@make-all
Copy link
Owner

make-all commented Jul 17, 2022

It may be possible, but I will need more information about the device. Best is to send the local dps mapping which is output to the Home Assistant log as a warning message when you try to add it, and information from iot.tuya.com developer portal about the device attributes, specifically the info under Cloud / API_ Explorer / Device Control / the last "Get Device Specification Attribute" listed. Also, while you are in there, the product_id which you can get from General Devices Management / Get Device Information - but a lot of the information under there is private (local key, device id, owner id, latitude, longitude) so don't post it all.

@make-all make-all added new device Unsupported device awaiting feedback Needs more information labels Jul 17, 2022
@jamiergrs
Copy link
Author

See below for the information:

Get Device Information

{
"result": {
"active_time": 1657944076,
"category": "sgbj",
"category_name": "Siren",
"create_time": 1657944076,
"gateway_id": "",
"icon": "smart/icon/ay1536534747810ekKBj/737088b8db34d661fed632b77a715cbd.png",
"id": "bfea172b71cf9e6b45mybn",
"ip": "#####",
"lat": #####,
"local_key": #####",
"lon": #####,
"model": "SWS08HA",
"name": "Outdoor Siren",
"online": true,
"owner_id": "#####",
"product_id": "im2eqqhj72suwwko",
"product_name": "Outdoor siren",
"sub": false,
"time_zone": "+08:00",
"update_time": 1657944095,
"uuid": "2458413e365474c4"
},
"success": true,
"t": 1658132671286,
"tid": "0c1ae1e3067311ed889e9287a6a8350d"

Device Specification Attribute

{
"result": {
"category": "sgbj",
"functions": [
{
"code": "alarm_state",
"desc": "{"range":["alarm_sound","alarm_light","alarm_sound_light","normal"]}",
"name": "报警器状态",
"type": "Enum",
"values": "{"range":["alarm_sound","alarm_light","alarm_sound_light","normal"]}"
},
{
"code": "alarm_volume",
"desc": "{"range":["low","middle","high","mute"]}",
"name": "报警音量",
"type": "Enum",
"values": "{"range":["low","middle","high","mute"]}"
},
{
"code": "alarm_time",
"desc": "{"unit":"min","min":1,"max":10,"scale":0,"step":1}",
"name": "报警时长",
"type": "Integer",
"values": "{"unit":"min","min":1,"max":10,"scale":0,"step":1}"
}
],
"status": [
{
"code": "alarm_state",
"name": "报警器状态",
"type": "Enum",
"values": "{"range":["alarm_sound","alarm_light","alarm_sound_light","normal"]}"
},
{
"code": "alarm_volume",
"name": "报警音量",
"type": "Enum",
"values": "{"range":["low","middle","high","mute"]}"
},
{
"code": "charge_state",
"name": "充电状态",
"type": "Boolean",
"values": "{}"
},
{
"code": "alarm_time",
"name": "报警时长",
"type": "Integer",
"values": "{"unit":"min","min":1,"max":10,"scale":0,"step":1}"
},
{
"code": "battery_percentage",
"name": "电池电量百分比",
"type": "Integer",
"values": "{"unit":"%","min":0,"max":100,"scale":0,"step":1}"
},
{
"code": "temper_alarm",
"name": "防拆报警",
"type": "Boolean",
"values": "{}"
}
]
},
"success": true,
"t": 1658132842296,
"tid": "72064a73067311ed889e9287a6a8350d"
}

Log Information

Logger: custom_components.tuya_local.config_flow
Source: custom_components/tuya_local/config_flow.py:73
Integration: Tuya Local (documentation, issues)
First occurred: 4:28:36 PM (1 occurrences)
Last logged: 4:28:36 PM

Device matches None with quality of 0%. DPS: {'1': 'normal', '5': 'middle', '6': True, '7': 10, '15': 0, '20': True, 'updated_at': 1658132915.8694942}

@make-all
Copy link
Owner

Hi, that is not the correct Device Specificaton Atrribute, you need to use the last one listed under "Device Control", as that is the only function in the entire API that lists the dp_id field needed for local protocol use.

@jamiergrs
Copy link
Author

Apologies, here is the correct one

{
"result": {
"category": "sgbj",
"functions": [
{
"code": "alarm_state",
"dp_id": 1,
"type": "Enum",
"values": "{"range":["alarm_sound","alarm_light","alarm_sound_light","normal"]}"
},
{
"code": "alarm_volume",
"dp_id": 5,
"type": "Enum",
"values": "{"range":["low","middle","high","mute"]}"
},
{
"code": "alarm_time",
"dp_id": 7,
"type": "Integer",
"values": "{"unit":"min","min":1,"max":10,"scale":0,"step":1}"
}
],
"status": [
{
"code": "alarm_state",
"dp_id": 1,
"type": "Enum",
"values": "{"range":["alarm_sound","alarm_light","alarm_sound_light","normal"]}"
},
{
"code": "alarm_volume",
"dp_id": 5,
"type": "Enum",
"values": "{"range":["low","middle","high","mute"]}"
},
{
"code": "charge_state",
"dp_id": 6,
"type": "Boolean",
"values": "{}"
},
{
"code": "alarm_time",
"dp_id": 7,
"type": "Integer",
"values": "{"unit":"min","min":1,"max":10,"scale":0,"step":1}"
},
{
"code": "battery_percentage",
"dp_id": 15,
"type": "Integer",
"values": "{"unit":"%","min":0,"max":100,"scale":0,"step":1}"
},
{
"code": "temper_alarm",
"dp_id": 20,
"type": "Boolean",
"values": "{}"
}
]
},
"success": true,
"t": 1658186784806,
"tid": "0a45270506f111ed8219daf929f70cab"
}

@make-all make-all added the enhancement New feature or request label Jul 19, 2022
@make-all
Copy link
Owner

It looks like HomeAssistant has support for a siren platform, which supports setting volume, tone and duration. So I guess that is where the limitation of the official cloud-based tuya integration support is coming from.

I don't currently have siren support, but it looks quite simple to add. As this integration supports multiple entities per device, adding the alarm state to this will be a matter of adding a select entity (also sensors for the battery, charge state and tamper alarm - or is the tamper alarm another setting in the Tuya app?)

@make-all
Copy link
Owner

Actually it looks like the alarm state could be emulated as tones. Maybe that would be better as it keeps everything in the standard alarm entity, so might work better in the UI.

@jamiergrs
Copy link
Author

I think keeping it all together in the alarm entity would work better in the UI.

As for the tamper alarm, that is simply a state in the app that is either true or false based on whether someone has opened the cover on the siren

@make-all make-all removed the awaiting feedback Needs more information label Jul 23, 2022
make-all added a commit that referenced this issue Aug 7, 2022
Siren supports volume, duration and tone, turn on and turn off (not implemented, as initial device does not appear to support direct control).  It doesn't contain any standard attributes, however where available we return the standard values as extra attributes so they can be read as well as set via the turn_on service.

- Support Orion Grid Connect outdoor siren using it, along with a battery sensor and charge and tamper binary sensors.

Issue #198
@make-all make-all added awaiting confirmation Wating for confirmation the issue is solved unreleased Will be in next release and removed enhancement New feature or request new device Unsupported device unreleased Will be in next release labels Aug 7, 2022
@make-all
Copy link
Owner

This was released in the latest version. But I am not sure if I understood the way this device works correctly, so please feed back on how it is working compared to the Tuya app.

@zerocritical
Copy link

Hi,
Just got my hands on one of these sirens. It gets added to HA , battery, Charging status and Tamper Detection shows correctly but it doesnt trigger the alarm from HA. Please let me know what information you need, I can work with you to resolve the issue.
image

@zerocritical
Copy link

My guess is,

to turn on, tone should be set to one of these - sound (for sound only), light (For light only) or sound+light (for both sound and light)

to turn off, tone should be set to normal

@make-all
Copy link
Owner

You should be able to test that, as the tone is exposed in the siren entity. Unless there is a specific siren card, you may need to call a service from the developer console to test.

@make-all
Copy link
Owner

My interpretation of the available controls when writing the config was that the siren could only be triggered by a hardware input, which is supposed to connect to the alarm controller, and the settings available via the network were just for configuration. But if the Tuya app is able to trigger the siren then there must be some way, and the presence of "normal" in the tone settings did raise some questions in my mind.

@zerocritical
Copy link

Yes, can trigger siren from the app. Here are the screenshots from the app:

when triggered:
image

when disabled:
image

@zerocritical
Copy link

zerocritical commented Sep 15, 2022

The selling point of this siren is that it can be triggered using an event from another Tuya device.. like a door contact sensor or camera. So it allows to trigger remotely from the app.

@make-all
Copy link
Owner

So to test, you should be able to go into Developer Tools, on the Services tab, and run the siren.turn_on service with a tone argument ("sound", "light" or "sound+light"). If that works, to turn it off, you may need to run the turn_on service again with a tone argument of "normal" rather than using the turn_off service.

@zerocritical
Copy link

Brilliant! It works!!

I was trying to trigger from services before but without specifying the tone! with tone, it works perfectly to trigger and disable. :)

@zerocritical
Copy link

zerocritical commented Sep 15, 2022

By any chance would you be able to add configuration parameters to edit volume and duration? Like this:

image

@make-all
Copy link
Owner

volume and duration are also set as parameters when calling the siren.turn_on service.
The Home Assistant interface to sirens only has the three services turn_on, turn_off and toggle, and nothing else. I added the current settings as extra attributes so you can read them back, but that is not part of the standard interface. Volume has a range between 0.0 and 1.0 per the HA interface, which will snap to the nearest value from 0.0=mute, 0.33=low, 0.67=middle, 1.0=high. Duration has the same 1 - 10 range as the Tuya docs, which I think is in minutes.

In response to this report, I now know how to make this siren work, so in the next release, "normal" will disappear from the available tones list, and be replaced with a working turn_off. turn_on without a tone argument and the toggle service will select sound by default.

@make-all make-all added partially working Needs more work to complete and removed awaiting confirmation Wating for confirmation the issue is solved labels Sep 18, 2022
make-all added a commit that referenced this issue Sep 18, 2022
- Use the tone attribute as the primary on/off for the siren, as that is the way it appears to work.
- Add support for a `default` value to be marked in a mapping.  Use this when siren.turn_on is called with no tone value and the siren is not already on.
- Treat "off" tone specially, use it to turn_off instead of handling in turn_on
- map "normal" to "off" in the Orion siren config, mark sound+light as default.

Issue #198
@make-all make-all added awaiting confirmation Wating for confirmation the issue is solved unreleased Will be in next release and removed partially working Needs more work to complete unreleased Will be in next release labels Sep 18, 2022
@make-all
Copy link
Owner

The siren should now fully function in 0.19.0, including the turn_off and toggle service calls, and turn_on with or without arguments..

@make-all
Copy link
Owner

Note that 0.19.0 and 0.19.1 had some issues that might make it difficult to judge whether this is working correctly. And I found a further problem after 0.19.2 which probably stops the turn_off command from functioning, so if you want to check it, please use the main development branch (can be installed from HACS by selecting "Redownload" from the tuya-local details page, main should be at the bottom of the list of versions available - it will nag you to upgrade after that, but you can ignore it until a later version than 0.19.2 is available).

@make-all make-all added unreleased Will be in next release and removed unreleased Will be in next release labels Sep 28, 2022
@make-all make-all removed the awaiting confirmation Wating for confirmation the issue is solved label Oct 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants