Esempio n. 1
0
        public void Reload(dynamic?data = null)
        {
            var serviceData = new FluentExpandoObject();

            if (data is ExpandoObject)
            {
                serviceData.CopyFrom(data);
            }
            else if (data is object)
            {
                var expObject = ((object)data).ToExpandoObject();
                serviceData.CopyFrom(expObject);
            }

            DaemonRxApp.CallService("zone", "reload", serviceData);
        }
Esempio n. 2
0
        public void MarkRead(dynamic?data = null)
        {
            var serviceData = new FluentExpandoObject();

            if (data is ExpandoObject)
            {
                serviceData.CopyFrom(data);
            }
            else if (data is object)
            {
                var expObject = ((object)data).ToExpandoObject();
                serviceData.CopyFrom(expObject);
            }

            DaemonRxApp.CallService("persistent_notification", "mark_read", serviceData);
        }
Esempio n. 3
0
        public void SelectPrevious(dynamic?data = null)
        {
            var serviceData = new FluentExpandoObject();

            if (data is ExpandoObject)
            {
                serviceData.CopyFrom(data);
            }
            else if (data is object)
            {
                var expObject = ((object)data).ToExpandoObject();
                serviceData.CopyFrom(expObject);
            }

            serviceData["entity_id"] = EntityId;
            DaemonRxApp.CallService("input_select", "select_previous", serviceData);
        }
Esempio n. 4
0
        public void ShuffleSet(dynamic?data = null)
        {
            var serviceData = new FluentExpandoObject();

            if (data is ExpandoObject)
            {
                serviceData.CopyFrom(data);
            }
            else if (data is object)
            {
                var expObject = ((object)data).ToExpandoObject();
                serviceData.CopyFrom(expObject);
            }

            serviceData["entity_id"] = EntityId;
            DaemonRxApp.CallService("media_player", "shuffle_set", serviceData);
        }
Esempio n. 5
0
        public void SelectSoundMode(dynamic?data = null)
        {
            var serviceData = new FluentExpandoObject();

            if (data is ExpandoObject)
            {
                serviceData.CopyFrom(data);
            }
            else if (data is object)
            {
                var expObject = ((object)data).ToExpandoObject();
                serviceData.CopyFrom(expObject);
            }

            serviceData["entity_id"] = EntityId;
            DaemonRxApp.CallService("media_player", "select_sound_mode", serviceData);
        }
Esempio n. 6
0
        public void MediaPreviousTrack(dynamic?data = null)
        {
            var serviceData = new FluentExpandoObject();

            if (data is ExpandoObject)
            {
                serviceData.CopyFrom(data);
            }
            else if (data is object)
            {
                var expObject = ((object)data).ToExpandoObject();
                serviceData.CopyFrom(expObject);
            }

            serviceData["entity_id"] = EntityId;
            DaemonRxApp.CallService("media_player", "media_previous_track", serviceData);
        }
Esempio n. 7
0
        public void Record(dynamic?data = null)
        {
            var serviceData = new FluentExpandoObject();

            if (data is ExpandoObject)
            {
                serviceData.CopyFrom(data);
            }
            else if (data is object)
            {
                var expObject = ((object)data).ToExpandoObject();
                serviceData.CopyFrom(expObject);
            }

            serviceData["entity_id"] = EntityId;
            DaemonRxApp.CallService("camera", "record", serviceData);
        }
Esempio n. 8
0
        public void DisableMotionDetection(dynamic?data = null)
        {
            var serviceData = new FluentExpandoObject();

            if (data is ExpandoObject)
            {
                serviceData.CopyFrom(data);
            }
            else if (data is object)
            {
                var expObject = ((object)data).ToExpandoObject();
                serviceData.CopyFrom(expObject);
            }

            serviceData["entity_id"] = EntityId;
            DaemonRxApp.CallService("camera", "disable_motion_detection", serviceData);
        }
Esempio n. 9
0
        /// <summary>
        /// Performs a specified service call to a specified domain with specified data
        /// </summary>
        /// <param name="domain">The domain to which the service call belongs</param>
        /// <param name="service">The service in the domain to call</param>
        /// <param name="data">Additional data to send to the service</param>
        /// <param name="sendEntityId">If true it will include the entity_id attribute with this entity's EntityId with the service call</param>
        protected void CallService(string domain, string service, dynamic?data = null, bool sendEntityId = false)
        {
            var serviceData = new FluentExpandoObject();

            if (data is ExpandoObject)
            {
                serviceData.CopyFrom(data);
            }
            else if (data is not null)
            {
                var expObject = ((object)data).ToExpandoObject();
                if (expObject is not null)
                {
                    serviceData.CopyFrom(expObject);
                }
            }

            if (sendEntityId)
            {
                serviceData["entity_id"] = EntityId;
            }

            DaemonRxApp.CallService(domain, service, serviceData);
        }