Sharp Aquos TV Help?

Hi All!

So I integrated my 70" sharp aquos tv into OH with Power and inputs etc. I am working now on the volume which works if i set an actual number. What I need is some way to increment the number like with the setpoint command preferably. my current setup is this,

Items:
Rollershutter Volume “TV Volume” (LivingRoom) { sharptv = “uid=livingroom, bindingType=volume” }

sitemap:
Switch item=Volume label=“Volume Up/Down” mappings=[20=“UP”, 0=“DOWN”]

Thanks!!!

Your best bet is a rule. Put a slider or setpoint on your sitemap and use a Number Item. then write a rule that triggers when the Number Item is updated and send out the new volume to the TV.

Actually tried with this but kept getting errors.

rule "Volume Up/Down"
when
Item Volume received command
then
var Number percent = 0
if(Volume.state instanceof DecimalType) percent = Volume.state as DecimalType

    if(receivedCommand==INCREASE) percent = percent + 5
    if(receivedCommand==DECREASE) percent = percent - 5

    if(percent<0)   percent = 0
    if(percent>100) percent = 100
    postUpdate(Volume, percent);

end

Care to elaborate? What errors?

Also, you can format your code to make it readable in a number of ways. My preferred approach is wrapping the lines in three backticks:

```
// Your code goes here
```

If the error was on the postUpdate you can change that to:

Volume.postUpdate(percent)

or

postUpdate(Volume, percent.toString)

Sure, Sorry i was wondering how to do that :wink:

Sitemap:
Switch item=Volume label=“Volume Up/Down” mappings=[INCREASE=“UP”, DECREASE=“DOWN”]

Items:
Setpoint Volume “TV Volume” (LivingRoom) { sharptv = “uid=livingroom, bindingType=volume” }

The error:
Received unknown command ‘INCREASE’ for item ‘Volume’

code:

rule "Volume Up/Down"
    when
        Item Volume received command
    then
        var Number percent = 0
        if(Volume.state instanceof DecimalType) percent = Volume.state as DecimalType

        if(receivedCommand==INCREASE) percent = percent + 5
        if(receivedCommand==DECREASE) percent = percent - 5

        if(percent<0)   percent = 0
        if(percent>100) percent = 100
        postUpdate(Volume, percent);
end

Sorry had “Switch” and “Setpoint” swapped as it was not showing on the page as the setpoint buttons. Swapped them and i get…

Received unknown command ‘Uninitialized’ for item ‘Volume’

ie:

Sitemap:
Setpoint item=Volume label="Volume Up/Down" mappings=[INCREASE="UP", DECREASE="DOWN"]

Items:
Switch Volume "TV Volume"  (LivingRoom) { sharptv = "uid=livingroom, bindingType=volume" }

A switch can only have ON and OFF as a state. It makes no sense to send a Number/Percent to a Switch. Try using a Number.

Changed:


Items:
Switch Volume "TV Volume"  (LivingRoom) { sharptv = "uid=livingroom, bindingType=volume" }Reply as linked Topic

to 

Items:
Number Volume "TV Volume"  (LivingRoom) { sharptv = "uid=livingroom, bindingType=volume" }Reply as linked Topic

same error.

OK, here is the problem.

You want to use a setpoint to adjust the value of an Item. The setpoint is issuing INCREASE and DECREASE command which means your Item needs to be able to understand INCREASE and DECREASE commands. Looking at the list of Item types and what they accept on the Items wiki page I see that Number only accepts Decimal commands.

I think what you want to use is a Dimmer type. It will accept OnOff, Increase/Decrease, or Percent type commands which is perfect in this situation as Percent can only between 0 and 100. I think if you use a Dimmer you don’t even need have the rule.

1 Like

Ok I can give that a whirl…

got it! Had to try a few switch/dimmer combos. Works perfectly now lol… Thanks yet again! :wink: