github.com/e154/smart-home@v0.17.2-0.20240311175135-e530a6e5cd45/common/events/entities.go (about) 1 // This file is part of the Smart Home 2 // Program complex distribution https://github.com/e154/smart-home 3 // Copyright (C) 2016-2023, Filippov Alex 4 // 5 // This library is free software: you can redistribute it and/or 6 // modify it under the terms of the GNU Lesser General Public 7 // License as published by the Free Software Foundation; either 8 // version 3 of the License, or (at your option) any later version. 9 // 10 // This library is distributed in the hope that it will be useful, 11 // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 // Library General Public License for more details. 14 // 15 // You should have received a copy of the GNU Lesser General Public 16 // License along with this library. If not, see 17 // <https://www.gnu.org/licenses/>. 18 19 package events 20 21 import ( 22 "github.com/e154/smart-home/common" 23 m "github.com/e154/smart-home/models" 24 ) 25 26 // EventStateChanged ... 27 type EventStateChanged struct { 28 StorageSave bool `json:"storage_save"` 29 DoNotSaveMetric bool `json:"do_not_save_metric"` 30 PluginName string `json:"plugin_name"` 31 EntityId common.EntityId `json:"entity_id"` 32 OldState EventEntityState `json:"old_state"` 33 NewState EventEntityState `json:"new_state"` 34 } 35 36 // EventLastStateChanged ... 37 type EventLastStateChanged struct { 38 PluginName string `json:"plugin_name"` 39 EntityId common.EntityId `json:"entity_id"` 40 OldState EventEntityState `json:"old_state"` 41 NewState EventEntityState `json:"new_state"` 42 } 43 44 // EventGetLastState ... 45 type EventGetLastState struct { 46 EntityId common.EntityId `json:"entity_id"` 47 } 48 49 // EventCallEntityAction ... 50 type EventCallEntityAction struct { 51 PluginName *string `json:"plugin_name"` 52 EntityId *common.EntityId `json:"entity_id"` 53 ActionName string `json:"action_name"` 54 Args map[string]interface{} `json:"args"` 55 AreaId *int64 `json:"area_id"` 56 Tags []string `json:"tags"` 57 } 58 59 // EventCallScene ... 60 type EventCallScene struct { 61 PluginName string `json:"type"` 62 EntityId common.EntityId `json:"entity_id"` 63 Args map[string]interface{} `json:"args"` 64 } 65 66 // EventAddedActor ... 67 //type EventAddedActor struct { 68 // PluginName string `json:"plugin_name"` 69 // EntityId common.EntityId `json:"entity_id"` 70 // Attributes m.Attributes `json:"attributes"` 71 // Settings m.Attributes `json:"settings"` //??? 72 //} 73 74 // EventCreatedEntityModel ... 75 type EventCreatedEntityModel struct { 76 EntityId common.EntityId `json:"entity_id"` 77 } 78 79 // EventUpdatedEntityModel ... 80 type EventUpdatedEntityModel struct { 81 EntityId common.EntityId `json:"entity_id"` 82 } 83 84 // EventUpdatedMetric ... 85 type EventUpdatedMetric struct { 86 EntityId common.EntityId `json:"entity_id"` 87 } 88 89 // CommandUnloadEntity ... 90 type CommandUnloadEntity struct { 91 EntityId common.EntityId `json:"entity_id"` 92 } 93 94 // EventEntityUnloaded ... 95 type EventEntityUnloaded struct { 96 EntityId common.EntityId `json:"entity_id"` 97 PluginName string `json:"plugin_name"` 98 } 99 100 // CommandLoadEntity ... 101 type CommandLoadEntity struct { 102 EntityId common.EntityId `json:"entity_id"` 103 } 104 105 // EventEntityLoaded ... 106 type EventEntityLoaded struct { 107 EntityId common.EntityId `json:"entity_id"` 108 PluginName string `json:"plugin_name"` 109 } 110 111 // EventEntitySetState ... 112 type EventEntitySetState struct { 113 EntityId common.EntityId `json:"entity_id"` 114 NewState *string `json:"new_state"` 115 AttributeValues m.AttributeValue `json:"attribute_values"` 116 SettingsValue m.AttributeValue `json:"settings_value"` 117 StorageSave bool `json:"storage_save"` 118 }